Oracle Contract
Price Feed Oracle Contract
Chainsight typically deploys an Oracle
contract on the target EVM chain, which can store arbitrary data keyed by (sender, key)
. Below is a simplified explanation of how it works:
Key Points & Interface Highlights
updateStateByKey(...)
Chainsight (or any authorized sender) writes data to the contract, specifying a unique
key
(often abytes32
that references the price feed name or asset).The contract automatically timestamps each update.
readAsUint256WithTimestamp(...)
DApps call this to retrieve the stored 256-bit integer plus the last update’s timestamp. It’s the primary function for price retrieval.
The contract also supports
readAsString...
,readAsInt...
, etc., for more advanced or text-based data.
In short, developers can read the most up-to-date on-chain data by calling readAsUint256ByKey(sender, key)
, receiving the integer plus a timestamp.
Writing Data to Each Chain
Internally, chainsight uses a distributed node approach with threshold ECDSA based on the chain-key cryptography:
Canister Node Collects or Generates Data
The node network finalizes data (like a price or time-series point).
Threshold Signing
The node network collectively signs an EVM transaction using a shared private key (generated by DKG).
This private key is never held by a single party. Instead, each node holds a partial share—only by combining a threshold of shares can they produce a valid signature.
Transaction Submission
The final signed transaction is broadcast to the EVM chain, calling
updateStateByKey(...)
on theOracle
contract.No external bridging contract is required, as the node network “natively” signs an Ethereum-compatible tx.
Note: This entire process is cryptographically distributed. No single node can forge or block updates, ensuring decentralized reliability.
Last updated