17

let’s say a contract wants to execute on knowledge contained outside the blockchain (e.g. whats the price of gold, what was the avg windspeed in NYC, how many people moved to portland in the last week) — what are common ways a contract might acquire this sort of information?

17

The common pattern is called an "oracle".

Ethereum contracts cannot communicate directly with the outside world, so they must rely on the outside world pushing information into the network.

You have 2 choices:

1) Use an oracle: Services like Oraclize are formal implementations where you pay to poke their services for oracle data that they provide.

2) Write an oracle: If the data you require is not already oracle-ized, but you have the savvy to do so, you can write your own external service that periodically pokes data into your own oracle contract. Then your application contract just requests it when it needs it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.