I've been playing with the chainlink getRandom call which returns a random number every time it's called. What I'm confused by though is the blockchain should be deterministic so if we were to rebuild this entire network from node 0 wouldn't that same call to getRandom be a different number and this not be deterministic? Same for external api calls, what if that node goes away and when you rebuild that data is no longer available, wouldn't that change the entire chain going forward?
1 Answer
You're correct in saying that blockchains are deterministic, oracles however, operate outside of blockchains. Oracles deliver data the same way that people make transactions.
When you replay a blockchain that uses oracle data, your replay what the oracle returned. In the same way when you replay a blockchain that has human transactions, you replay the result of those transactions.
An oracle works by delivering data in a transaction. So the oracle only delivers the data once, and that becomes a part of the historical transaction data of the blockchain.
Does that make sense?
-
1It does, for some reason, I was thinking the "playback" would include the call to the oracle but it's basically just running through all transactions that were recorded. Thanks Commented Feb 13, 2022 at 21:52
-
I have the same question as Ryan but regarding the Price Data Feed. For example, in chainlink documentation there is a simple contract called PriceConsumerV3 (ethereum.org/cs/developers/docs/oracles/#chainlink-data-feeds) that calls the "latestRoundData" function on the feed. If a PriceConsumerV3 's transaction is replayed after some time doesn't the "latest" value change?– vbgdCommented Feb 15, 2022 at 9:15
-
No, since the data is included in the transaction, when you replay it, it will include the exact same data that was done the first time. Commented Feb 15, 2022 at 23:58