What oracles are for
What you build
You build an oracle output, a consumer, or both. The oracle output is one output within Arkade that stores the prices the signers sign. A consumer is a contract that reads a price from the output. Oracle Output is the contract, with one signer. Multi-Oracle Aggregation is the same contract with more signers, and the consumers that take a median.Verify a signed price
The simplest pattern verifies the signature in the consumer itself. The signer signs a hash of the ticker, the price, and the time. The spender supplies the price, the time, and the signature:examples/option/option_vault.ark @ f9f8866
num2bin writes the price and the time as 8 bytes each. This pattern ties the contract to the signer’s key. The Coupling Problem explains why the oracle output avoids that.
Understand
How a script verifies a signed message, why a contract must not store the key, and how an asset names the output.
Oracle Output
The contract, with the source to copy.