7

Can EOSIO smart contracts communicate externally, say, to some external (preexisting) web-service?

I suspect the answer is no, as this would violate determinism, among other guarantees.

What is the proposed solution to integrate this with some preexisting service? Any time a user performs some action where an external call is required, is the flow as follows?

  • Smart contract stores this request in the database.
  • (*) Service must periodically poll the smart contract, to check if there is any work to be done.
  • If work is found, perform the work, and transact the result back to the smart contract, which writes confirmation to the database.
  • The user polls the smart contract, until the work is complete, in which event the result is finally returned.

(*) Furthermore, if one cannot modify the service, one must also host their own intermediate proxy service to perform the polling.

Is this correct? Should any additional considerations be made, such as either party waiting for the block to become irreversible, or regarding the polling strategy?

Are there any alternatives? Is there some way for my service to "receive callbacks"? Or some way to "register a native plugin"?

1 Answer 1

5

"Smart contracts can only read data that is part of the transaction or stored in blockchain state. To pass external data into a contract it will need to be sent via an oracle.

If you have an external application, such as a social media app, it can observe transactions and receive callbacks. You can either register a native plugin or you can poll eosiod. Transactions can log data via print()."

See: https://github.com/EOSIO/eos/issues/1483

4
  • Thanks for the very relevant link! Note that "eosiod" has been renamed to "nodeos" since the above comment was made by Dan in that issue. From what I understand, "poll nodeos" (eosiod) would amount to the solution I suggested. Do you know if there are any examples or documentation about registering a "native plugin" or how to "receive callbacks"? If I search for "native plugin" in the EOS documentation, it currently comes up with nada: github.com/EOSIO/Documentation/… May 23, 2018 at 3:44
  • Although eos mentions oracle, but it is difficult to find examples related to it.
    – smarteasy
    Jun 19, 2018 at 1:18
  • In this context, Oracle just means some external service that is trusted by all parties. It doesn't have to do with EOS from what I understand. The idea here is to have something that reads the state of the external service and then transacts that securely to the smart contract. This "thing" would be called the oracle, since you need to trust it to be communicating the true state of the service. Jun 19, 2018 at 17:44
  • eosio.stackexchange.com/questions/355/… <-- This other question may help some for how to "register a native plugin". There is also this tag: eosio.stackexchange.com/questions/tagged/plugin Jun 19, 2018 at 17:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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