Prize World Pixel
Prize World Pixel

Reputation: 1

About the link token required for Chainlink VRF random number return is too high

I require a random parameter on the BSC test network, which costs about 0.1 ~ 0.15 link tokens each time.

But when I transferred to the BSC mainnet, the cost soared to 113 link tokens. This caught me a bit off guard, where I think the code is different: testnet use: 50 gwei Key Hash 0xd4bb89654db74673a187bd804519e65e3f71a52bc55f11da7601a13dcf505314 mainnet use: 1000 gwei Key Hash 0x17cd473250a9a479dc7f234c64332ed4bc8af9e8ded7556aa6e66d83da49f470 Is there a way to tell me where the possible problem is? I already have a little loss because of this question, thanks for answering.

Why is the price difference between the test network and the main network is so large, and where is the problem?

Upvotes: 0

Views: 526

Answers (2)

DevCrypto
DevCrypto

Reputation: 146

Consider the following calculation for the given formula:

(((Gas lane maximum * (Max verification gas + Callback gas limit)) / (1,000,000,000 Gwei/ETH)) / (ETH/LINK price)) + LINK premium = Minimum LINK

For BSC Mainnet

  • Gas Lane Maximum is 200gwei
  • Max verification gas is always 200,000
  • Callback gas limit is 100000
  • LINK Premium is 0.005
  • ETH/LINK Price is 0.0040368572 (at the time of writing this)

The theoretical estimated maximum cost is 14.89 LINK. However, practically, the cost will be lower due to the current BSC Mainnet GWEI value of 5 (Current) Thus, the minimum LINK required is approximately 0.37 LINK.

NOTE: It is important to note that the above values are only estimations, and actual fees may vary depending on factors such as the Gas Lane, callbackGasLimit, and network congestion.

Upvotes: 0

Frank Kong
Frank Kong

Reputation: 1082

The 113 LINK cost in the VRF App is the theoretical estimated maximum cost, and the actual cost may be much lower than the estimated cost. I guess your request is pending now for insufficient balance and it is not deducted from your balance.

The formula for Chainlink VRF cost is here. The final cost of VRF request is related to the callback gaslimit, premium fee, verification cost, and most importantly, gaslane(keyhash in your VRF request).

The gaslane you are using is 50gwei in BNBChain testnet, while you selected 1000gwei gaslane in the mainnet. According to the formula above, the estimated gas in mainnet would be at least 200 times more than testnet.

Please try to set a proper callbackgas limit in your VRFConsumer contract and send the request again.

Upvotes: 0

Related Questions