10

I'm doing some research about generating true randomness on the Ethereum blockchain. Of course I came across Chainlink and its VRF solution.

Although there are many tutorials around, some from chainlink themselves, there is no easily available information about number generation prices (only LINK price itself) or amounts to be spent at each roll.

Does anyone who's had more experience in this know approximately how much it costs for each number roll generation?

3 Answers 3

3

I've had a similar question. As far as I can tell, at the time of writing, the cost of a request to the Chainlink VRF (Verifiable Random Function) v2 on the Ethereum Mainnet is 0.25 LINK, which is around $4.

Quite expensive to pay $4 for one random number. Thoughts anyone?

Edit:

It's true that one request csts 0.25 LINK, however, it seems up to 500 random values can be requested at once, see MAX_NUM_WORDS parameter in the contract.

References

Chainlink Docs: https://docs.chain.link/docs/vrf-contracts/#config

Etherscan, see getFeeConfig: https://etherscan.io/token/0x271682DEB8C4E0901D1a1550aD2e64D568E69909#readContract

2
  • 1
    If you request more than one number, it is a pseudorandom expansion of a true random number. Oct 2, 2022 at 16:38
  • Janine? How do you reckon that? They get one number randomly and then compute all the others from that one?
    – Blissful
    Jan 12, 2023 at 14:39
1

The Chainlink developer documentation currently states a price of 0.0001 LINK. Link to documentation

2
  • 2
    While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review
    – eth
    Mar 30, 2021 at 2:32
  • 1
    0.0001 is for Polygon network, 0.2 LINK on BInance, 2 ETH on Ethereum Mainnet. Unclear how to execute VRF on Polygon from Ethereum deployed contracts. Sep 18, 2021 at 21:54
1

It's more complex than fixed price.

The VRF coordinator verifies the proof on-chain then calls back the consuming contract fulfillRandomWords function. After the request is complete, the final gas cost is recorded based on how much gas is required for the verification and callback. The total gas cost in wei for your request uses the following formula:

(Gas price * (Verification gas + Callback gas)) = total gas cost

The total gas cost is converted to LINK using the ETH/LINK data feed. In the unlikely event that the data feed is unavailable, the VRF coordinator uses the fallbackWeiPerUnitLink value for the conversion instead. The fallbackWeiPerUnitLink value is defined in the coordinator contract for your selected network.

The LINK premium is added to the total gas cost. The premium is defined in the coordinator contract with the fulfillmentFlatFeeLinkPPMTier1 parameter in millionths of LINK.

(total gas cost + LINK premium) = total request cost

The total request cost is charged to your subscription balance.

So besides fixed premium of 0.25 LINK per request it can cost even 20 LINK if floor gas price is 100+ gwei.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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