I was trying to understand this pizza sample build by Patrick Collins.

so my understanding is that when we send a transaction (for example store which stores a user provided number) all the nodes in the network first check for the transaction correctness i.e. signature and other parameters and then updates the state by executing function from contract and once all nodes reach the consensus this transaction of updating number gets added to blockchain

Now incase of oracle data transaction many of stackoverflow answers says that the oracle call is not executed by nodes to reach consesnsus which is because since we are just calling the external source for data and not really updating the state on the blockchain.

But here in this example https://github.com/PatrickAlphaC/vrf_pizza/blob/c39c03ea707234a814d3d57419111c8e049d87a9/contracts/VRF_Pizza.sol#L47

interface VRF_Pizza_RNG_Interface {
    function create_random_pizza(uint256 userProvidedSeed) external returns (bytes32 requestId);

Contract Pizza{
function order_pizza(uint256 userProvidedSeed) public payable is_paid returns (bytes32){
        return VRF_Pizza_RNG_Interface(pizza_rng_address).create_random_pizza(userProvidedSeed);

Here we are updating pizza_orderers array which is state variable so this transaction call will be executed by all the nodes and will even fail as nodes will not provide LINK tokens for execution. Can anyone please tell me how this works and what am i missing here?

  • Does this answer your question? ethereum.stackexchange.com/questions/90728/…
    – Emrah
    May 7 at 14:17
  • @Emrah Thank you for your response. But I am still not clear on how nodes reach consensus to update the state in my case pizza_ordrers. The post which you shared states that chainlink transaction is not mined which I agree as it just makes external call as shown here github.com/PatrickAlphaC/vrf_pizza/blob/… but in my case there is state update that's happening for pizza_orderers so isn't this transaction mined?
    – Venessa
    May 7 at 14:33
  • Wouldn't the miner execute this order_pizza contract function in which case it will create output for pizza_orderers and then call this VRF_Pizza_RNG_Interface(pizza_rng_address).create_random_pizza(userProvidedSeed)? Which calls external source of chainlink i.e. request to chainlink.
    – Venessa
    May 7 at 14:48

1 Answer 1



When the create_random_pizza function is called, in the line 45 the requestRandomness function is called, which is requesting the random number for the Chainlink VRF. This transaction is changing the state. Over there the VRF call is being validated, not the result, which would be the number returned later.

The number is generated outside the blockchain, by the Chainlink VRF nodes. In VRF Docs V1, you can see that:

With every new request for randomness, Chainlink VRF generates a random number and cryptographic proof of how that number was determined. The proof is published and verified on-chain before it can be used by any consuming applications. This process ensures that the results cannot be tampered with nor manipulated by anyone, including oracle operators, miners, users and even smart contract developers.

After the number is generated, another transaction will be sent from a node running Chainlink VRF to the smart contract, for the callback function that must exist. This is the function fulfillRandomness, in line 51. This is the transaction which is updating the number in the smart contract, and it will also be validated and included in the blockchain, at another time, in another block.

This is an important concept to you know, the Request and Receive cycle.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.