Since every node has to execute a smart contract and receive the same result, Ethereum smart contracts can't go out to the Internet to verify data. So, how do these sites that bet on the outcomes of sports game deal with this (e.g., Crypto Sportz)? Or, maybe not even betting but whether other facts that are available online but would be hard to figure out without online access?
1 Answer
They're using Oracles: external services that are authorized to modify some data (like the result of a football game) in the smart contract.
Update, based on the comment on this post:
I added the above short definition of what an Oracle does, in case the linked article disappears (although, a search for ethereum oracles should yield other interesting results). But I wouldn't duplicate other people's blog posts in the answer either.
Yes, anybody can build an oracle. Oracles are basically doing 2 things:
- scraping data off a site
- writing that data into a smart contract.
The smart contract expects that data to be recorded at one moment in time and when it is, it executes some code (like settling the bet).
-
I have read that SO discourages the posting of links because they tend to break or change and prefers relevant parts being copied and pasted into the answer. So specifically can anyone create an oracle? Why are they better than scraping data off a web site? Where do oracles get their data from, if not web sites?– DaveJun 13, 2018 at 18:52
-
@Dave They essentially are data-scrapers. If I'm not mistaken, they are called oracles as that is the role they serve smart contracts, external validators because on contract validation is expensive. Jun 14, 2018 at 20:25