Can I securely store say 500 random numbers from Chainlink in a private array, then time-lock their ability to be gotten, instead of paying for each?

41 views Asked by At

MORE ACCURATELY PUT: If I have Chainlink VRF give me 500 random numbers(words) in a single query, then I store them all in a private array of uint256, then have an onlyOwner getter function that has essentially a time-mask on the array until a certain block number has passed for instance (preventing peaking at upcoming numbers before it is time). Is this possible? Is there some sort of leakage that prevents this from being a viable approach to offsetting Chainlink VRF cost?

I have tried nothing.

2

There are 2 answers

0
Richard G On

To clarify, private visibility helps protect functions and variables from unwanted access within the blockchain. It does NOT make them completely hidden on the blockchain.

The call data into your contract with the random numbers would also be visible.

TLDR; You should use the values in the same block that they are returned to your contract.

0
Derek On

To elaborate on Richard's answer, any data stored on the blockchain is technically insecure, and is available for public consumption.

If you're storing numbers that contain some sort of financial incentive (ie, a lottery system that pays out for correct guesses), the blockchain isn't a great place to cache them, as you're opening yourself up to a serious attack vector.

I'm curious what your per-request costs are on VRF, and on what chain? And does the randomness in the generation of these numbers to be publicly verifiable, or will any truly random number do? If not, I'm wondering if a traditional request (ie, Direct Request pattern) through a Chainlink oracle might be able to get your costs down a bit.