The general architecture of StarkLink VRF can be described in the four steps in the diagram below.
We will now go through each step of this process and inspect each individual element of our architecture.
  1. 1.
    A StarkNet smart contract that needs a random number will call the request_randomness function of the deployed StarkLink VRF. The smart contract must specify a beacon address which will be the third party tasked with generating the random number This function creates a randomness request that is stored in the VRF. The request id is then returned to the calling smart contract in order to keep track of multiple requests.
  2. 2.
    When the randomness request is created, the chosen randomness beacon picks up on this on-chain event and begins using metadata included in this event to generate a random number along with an accompanying proof.
  3. 3.
    The beacon calls the resolve_randomness_request of the StarkLink VRF with the request index that is being resolved, a random number and a randomness proof. If the proof passes verification then the will_receive_randomness function of the requesting smart contract is called and the request is marked as complete by the VRF.
  4. 4.
    The smart contract receives a random number and the corresponding request id from StarkLink and is able to use the random number for indiscriminate use.