简体   繁体   中英

How can I include real world data in a smart contract?

Lets say that I want to write a simple contract to bet on the weather 10 days from now, or the outcome of a sporting event.

How could I connect to a third party application that hosts data and use that to write my smart contract?

What you are looking for is an oracle.

Ethereum and other blockchains are unable to access data outside of their network(The way to think about it is imagine if the entire Ethereum network tried to access the weather api you mentioned at the same time...) which is where Oracles come in. Oracles are third party services designed for use with smart contracts that provide and push external data to the chain including weather for example.

There are many different ways to set this up and different services you can use for your own oracle

I included a link to Gnosis' white paper so you can see how they handle Oracles. https://gnosis.pm/ And I included a link to further general explanation on Oracles https://blockchainhub.net/blockchain-oracles/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM