4

This question already has an answer here:

I was reading this link and have a question that I don't think was answered there .

I understand that the third party providers act as Oracles and they bridge the gap by putting real world info into their contracts and then they can influence your contracts.

Is there a way to actually do on your own instead of relying on these third parties?

Just say I want to build a contract that takes information from the real world, can I just connect my Ethereum client into the real world directly? I know that other people running the contract can't do the same, but at least I can get data in and out without needing to rely on these companies.

EDIT: The possible duplication has only two answers for two third party services. I am looking into not using Oraclize or Reality Keys at all and running my own input/output into an Ethereum contract becoming my own Oracle.

marked as duplicate by galahad, Sebi, Paul S, Joris Bontje Sep 29 '16 at 13:56

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 2
    why not to write a program who reads the data and send it within a transaction to your contract – Badr Bellaj Sep 21 '16 at 14:09
  • The answers to the duplicate question however contain the ins/outs of what you'd have to do to write your own oracle. If you want the nuts and bolts of the APIs to do so, however, there's already tons of info on that - see the tag web3.js for example (also the equivalent python tag, probably a java tag too) – Paul S Sep 26 '16 at 20:07
3

Yes. There's two things you'll need to do.

In the smart contract, you'll need to create some function (example: updateData()) that will only accept call from an address you control. This is already done in many contracts with owners.

Outside, you'll need to write a program that connects to an Ethereum node and also connects to whatever outside data source you use. This program must read from the outside world and automatically send a transaction calling the smart contract. For JS, you can use the web3 library.

Before you begin, you may wish to think about overall architecture. (For example, what happens if your node crashes, and the updates stop happening?) It's well possible, though.

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