7

What is the mechanism to know whether miners/validators have indeed executed one's contract, instead of just blindly validating it?

3

Using terms from the question, the process of "validating" a transaction that invokes a contract, involves "executing" the contract.

"Blindly validating" suggests you are asking about "light clients", such as clients on mobile or less powerful devices. For such clients, they will have to obtain proofs from "full nodes" that have executed the contract, and then verify the proof to determine whether to accept the data provided by the "full node". The mechanism is proofs, one example from Bitcoin is its SPV.

  • What are those proofs and how do they work? – Symeof Jan 21 '16 at 8:07
2

Or, in case you are asking "How can I know that my transaction has made it into the blockchain?":

Call getTransactionReceipt() with the transaction hash that was passed back to you when you submitted it. If the receipt contains a value in the blockNumber field then it's been included in a mined block.

Also, if your transaction was a contract creation, check the contractAddress to see if the contract creation worked.

Or if your transaction was a contract function call, and the function made use of the log() facility to record a result, that result can be read from the receipt's logs field

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.