0

I saw how this can be done using Oraclize. Is there any native way to access an API from a solidity smart contract? I understand there is a restriction on the solidity program to be able to call an API.

2

If you don't want to use oracles you can evoke event which will trigger some method on your back-end. This method will create a call to an API and when the response is received it will compose new transaction, sign it with your private key and send response to your smart contract (it will update state or/and evoke some event, so you can know that you get a response).

1

In general, no, you can't access outside resources from smart contracts. So there is no "native" way to do it either. There are just different workarounds. Oraclize is one of them and @Roman gave you another option.

Have a look at How can an Ethereum contract get data from a website? for more details.

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.