An important part of smart contract development is how to interact with off-blockchain data sources.
An interesting idea to explore is to do inversion of control, where oracles call contracts (to communicate outside truths) through a common interface method, and can implement their oracle logic as wanted: trusted expert, closed voting, open voting, API wrapper.
Instead of contracts requesting data from oracles, oracles inform contracts of data changes.
We are currently implementing an oracle with https://tls-n.org/, I can let you guys know how our experience was. (TLS-N needs no special Hardware as compared to town crier, but a plugin on the webserver)
That's actually very interesting @superphil0!
Using inversion of control (oracle is calling the contract) is a very interesting idea!
There are multiple ways to achieve that, the most trivial would be that contract owner would designate particular oracle (allow them to send data in) and then only this oracle would be allowed to update the state.
Challenges here: 1) oracle is 'coupled' with the contract (as it has to be designated by the contract creator), hence changing the oracle will be an issue
2) what would be an incentive for an oracle to call contract back?
ad1) adding a proxy: owner is picking the proxy, and via this proxy oracle will be decoupled. fixes the issue with coupling, and introducing own additional issue: how proxy could be trusted.
Are there better options?
ad2) in the contract method, when called (only by designated oracle), paying back could be implemented (ie fee based).
is this a correct direction of thinking?
Hey @miktam, those sound like good points to explore.
Maybe, at the same time that an oracle is designated, some money can be left for it to pull. This money will be transferred as the last step of the method that the oracle calls to deliver the data.
We can just trust the oracle, and use an small allowance that will be dripping every time we receive data. We could add some time based constraints so we receive data slowly, and the oracle can't call the method a million times at once.
Or we can research how to validate the data that we receive from the oracle. This is hard because it will depend on the type of data, but filecoin is exploring that for storage, foam for location, wibson for personal data. You can also check Oraclize.
This is a very interesting problem, please let us know if you need some help from our side :)
@elopio, thank you for your help!
to continue:
struct, eg struct ExternalData.ExternalData, defining:ExternalData struct.ExternalData, creator would specify sane limits (eg if its a temperature, then limits would be [-50, 50]now its becoming quite a complex problem, still manageable tho.
does it sound enough to draft an interface?
should be enough for a start, what do you think?
I think you have more than enough to start :D I would recommend to start with a very basic usecase, and grow from there. If you make a PR for your work-in-progress, we can give you feedback early.
Thank you!
An EIP relevant to this feature: https://github.com/ethereum/EIPs/pull/1154
Closing as outlined in #971.
Most helpful comment
An EIP relevant to this feature: https://github.com/ethereum/EIPs/pull/1154