A call to a Michelson contract results in a storage update and the emission of operations. Is there a simple/standard way for the called contract to return a value to the caller?
In my understanding, you can call a contract by sending a
parametrised transaction, that's injected as an operation under
You can trace the flow above in the source of eztz.js.
/injection/operation doesn't return much more, but a hash of the operation you've just injected. (there is a mention of a
$unistring although i'm not sure what it represents right now)
My guess is also that smart contract gets executed, around the time when an operation is injected into a new block. (Don't take me for granted here, i was unable to find resources on this for Tezos, but that's how it works with ethereum)
So you can always get the contract's storage using
.../contract/<contract_id>/storage - this'd represent one part of your contract's return value. But only after your operation has been processed.
And i think there should be a way to extract the operations executed by your smart contract, if you look deep enough into the RPC responses, i'd look for operations coming from your contract's address.
In fact, you can see an example smart contract on TzScan, all it seems to do is set the current storage to a value received as a parameter. You can drill down trough the transactions and operations to see how it was updated over time - this should give you an idea of where to find the required information via RPC.