- A blockchainĀ oracleĀ is any device or entity that connects a deterministic blockchain with off-chain data
- Smart contracts cannot make API calls themselvesĀ because they are deterministic, therefore to get data onto the chain, we have to have an off-chain entity that makes the API call and creates a transaction on-chain with the data (from the API) posted.
- This process of posting data from the real world onto a blockchain is what oracles do
- Some famous oracle services,
Chainlink Example §
function getWinner()
public
onlyOwner
{
Chainlink.Request memory req = buildChainlinkRequest(JOB, address(this), this.fulfill.selector);
req.add("get", "example-winner.com/winner");
req.add("path", "winner");
sendChainlinkRequestTo(ORACLE, req, ORACLE_PAYMENT);
}
Refs §
- https://ethereum.stackexchange.com/questions/85178/what-is-a-blockchain-oracle