2

Recently, Chainlink published their VRF v2. The new VRF uses subscription management app. There is a delay between the requestRandomWords and fulfillRandomWords function.

On the Goerli test net, average time is around 300 seconds. Therefore, I set a timeout of 300 seconds between request and fulfill function calls.

Is there a way to find this pending time programmatically?

In the documentation, they mention

"You can see a list of pending requests for your subscription ID in the Subscription Manager"

I wasn't able to find an API that would give me a pending time for my subscription id in chainlink docs.

What is the recommended waiting approach between requestRandomWords and FulfillRandomWords function calls?

3
  • I am also wondering the same thing. Trying to call requestRandomWords in fulfillRandomWords.
    – Danny B
    Commented Sep 2, 2022 at 0:54
  • Currently, I am trying to estimate it using num of confirmation I provide and see the average block finality time and use that as my base value to wait between requestRandomWords and fulfillRandomWords functions. This way I can get the correct state changes implemented by fulfillRandomWords. However, I can't think of anything better. Perhaps, a smart contract provided by chainlink that tells us estimated waiting time for given subscriber id would be a better option Commented Sep 2, 2022 at 8:42
  • 1
    Using event listeners could be another way to solve this problem. Example. github.com/smartcontractkit/hardhat-starter-kit/blob/main/test/… Commented Sep 3, 2022 at 4:17

1 Answer 1

0

Shubham Sharma

The waiting time depends on the requestConfirmations parameter.

  • requestConfirmations: The number of block confirmations the oracle node will wait to respond.
  • The longer the node waits, the more secure the random value is.
  • It must be greater than the minimumRequestBlockConfirmations limit on the coordinator contract.
  • The minimum and maximum confirmations for your network can be found here.

Like you said in comments, using event listeners is excellent if you would like to know when your smart contract receive the numbers = when the function fulfillRandomWords was called. You can create an event to be called inside the function, per example.

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.