How Ethereum contract can communicate with external data source

Aug 26, 2017 · 3 min read

You will face into the problem when your product logic is implemented in a solidity and deployed to Ethereum network should start communicating with outside world. Ethereum virtual state machine cannot communicate with the outside world in the simple and an easy way. Why?

Because to approve each block-chain BLOCK validity, all mining nodes should get the same results from the outside. And it is not an easy task to deal with that.

After some time of research I will try to summarize my findings.

There are two ways how this can happen: Pull way or Push way.

Pull way:

To use this method you should trust 3rd party solution like Oraclize. This service is not free and you should pay them for all magic they do. Usage is a really simple example:

- Easy and fast to use, no need to think about implementation.
- Fixed cost. Gas spending will always be the same because they will call your contract __callback after they form the response (if the call is successful).

- Oracle query can reach only this public API, that means that no data security available here. All data provided for contracts or published to Ethereum block chain instantly is public. It is a problem if you are working with sensitive data and don`t want to give the public access to your API.
- Full trust of Oracle. If Oracle gets hacked, your __callback calling can happen unexpectedly.
- Only the success case is covered. Not a lot of space to handle failures.
- Unclear how and who will pay for __callback execution.

Push way:

- Open up data only needed for your calculations logic.
- You can control all process, no 3rd party components.
- More easily to track various communication issues and response statuses.

- Complicated to implement and test it.
- Need Custom development and hosting for “Custom Executor”.
- Your front end application “PINGS” contract, which is not a very nice way to check result availability.

In both ways, your contract will trust an external wallet address, but in the second you can decide how to manage the security and balance of this address.

Overall, it is needed to remember one thing about Etherium VM, that this is a state machine, not a normal computer. Nowadays we think that everything can compute anything. We believe that in the future this global computer could do everything.

We will choose the push way for our implementation if we cannot find a better or smarter way. What do you think guys about such solution?


Check out our testing ground — Aigang!

More about Aigang —
Aigang Whitepaper —
Aigang on Telegram —
Get Aigang Latest Updates —

Autonomous insurance network — fully automated insurance…


Written by


Autonomous insurance network — fully automated insurance for IoT devices and a platform for insurance innovation built around data