Reputation: 11
I want to make external http calls such as (eg. RPC calls to infura) from substrate contract. Is it possible? If possible, then suggest me ways or some code snippet.
Upvotes: 1
Views: 234
Reputation: 12434
No it is not possible as such calls would be non-deterministic.
The closest thing you have to functionality like this is Offchain Workers:
But this would require you to write special logic which handles consensus about offchain data, and then additional code or features which would expose this data correctly to a contract.
I think like most oracles on existing smart contract platforms, you will want to submit a transaction to the chain which populates the data, rather than have a contract try and pull the data from the outside world.
Upvotes: 2