You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For Chainlink VRF v2 to fulfill your requests, you must maintain a sufficient amount of LINK in your subscription balance. Gas cost calculation includes the following variables:
185
-
186
-
-**Gas price:** The current gas price, which fluctuates depending on network conditions.
187
-
188
-
-**Callback gas:** The amount of gas used for the callback request that returns your requested random values.
189
-
190
-
-**Verification gas:** The amount of gas used to verify randomness on-chain.
191
-
192
-
The gas price depends on current network conditions. The callback gas depends on your callback function, and the number of random values in your request. The cost of each request is final only after the transaction is complete, but you define the limits you are willing to spend for the request with the following variables:
193
-
194
-
-**Gas lane:** The maximum gas price you are willing to pay for a request in wei. Define this limit by specifying the appropriate `keyHash` in your request. The limits of each gas lane are important for handling gas price spikes when Chainlink VRF bumps the gas price to fulfill your request quickly.
195
-
196
-
-**Callback gas limit:** Specifies the maximum amount of gas you are willing to spend on the callback request. Define this limit by specifying the `callbackGasLimit` value in your request.
197
-
198
-
</Fragment>
199
-
<Fragmentslot="panel.2">
200
-
201
-
For Chainlink VRF v2 to fulfill your requests, you must have a sufficient amount of LINK in your consuming contract. Gas cost calculation includes the following variables:
202
-
203
-
-**Gas price:** The current gas price, which fluctuates depending on network conditions.
204
-
205
-
-**Callback gas:** The amount of gas used for the callback request that returns your requested random values. The callback gas depends on your callback function and the number of random values in your request. Set the **callback gas limit** to specify the maximum amount of gas you are willing to spend on the callback request.
206
-
207
-
-**Verification gas:** The amount of gas used to verify randomness on-chain.
208
-
209
-
-**Wrapper overhead gas:** The amount of gas used by the VRF Wrapper contract. See the [Request and Receive Data](/vrf/v2/direct-funding#request-and-receive-data) section for details about the VRF v2 Wrapper contract design.
210
-
211
-
Because the consuming contract directly pays the LINK for the request, the cost is calculated during the request and not during the callback when the randomness is fulfilled. Test your callback function to learn how to correctly estimate the callback gas limit.
212
-
213
-
- If the gas limit is underestimated, the callback fails and the consuming contract is still charged for the work done to generate the requested random values.
214
-
- If the gas limit is overestimated, the callback function will be executed but your contract is not refunded for the excess gas amount that you paid.
215
-
216
-
Make sure that your consuming contracts are funded with enough LINK tokens to cover the transaction costs. If the consuming contract doesn't have enough LINK tokens, your request will revert.
0 commit comments