Does Chainlink store Oracle response for a transaction somewhere on blockchain?

Viewed 111

Lets consider an example of transaction lifecycle where a smart contract uses Oracle to get external data ETH/USD price feed that is changed in real-time.

  1. Transaction is executed during mining, so it creates request to Chainlink oracles that return Price1. Is Price1 stored/cached somewhere on the blockchain?

  2. Once block is mined, mining node sends it to other Ethereum nodes to validate.

  3. Validating nodes also execute that smart contract. What will happen to subsequent calls to the Oracle to get the ETH/USD price? Would Oracle return "cached" response Price1 during block validation or we would get Price2. Does it mean if we get Price2 then block validation fails?

2 Answers

First of all, when you use the blockchain Option in 20c for tables, a new row inserted gets chained by calculating the new chainvalue from the previous inserted row. This stuff is stored in hidden colums and can be extracted but not changed by update. Just deleted after a defined time after insert. Now to transactions: Oracle Db by default is read committed and uses SCN assigned to each ddl, dml executed. This means when you insert a row the chainvalue gets calculated immediatly - this would mean, the ETH/USD rate when mined. Now you can do a trick: (1) use a colum named txscn which stores the current SCN and txts Type DATimestamp and a sequence counting up. When your validation process comes back you insert a new row which creates a new chainvalue with the ETH/USD rate, SCN from (1) and the current TIMestamp. This results for every TX in a pair of rows to be used for validation - if a process does not come back, only initial row is written - or you avoid to write a second row because verfication falls in specific amount of Time. I assume the REST API for Blockchain does it in the same way since it allows a sort of waittime for completion and a TX id. A sort of "flashback" does not exist when I unterstand documentation correctly.

Related