I'm working on a proof-of-relay contract that pays out if and only if a given transaction hash has been mined. I imagine there is some kind of merkle proof that would make this possible?

1 Answer 1


From within the contract you are limited to a number of predefined structures available to the block containing the contract (see this question).

You cannot make granular queries on transactions and their fields. There is a nice code summary of pyethapp here that shows what happens when a transaction is confirmed.


You'll find all variables that you have access to in solidity here. The visibility scope is only the last block (which contains the mined contract) meaning that you can't get data on previous and future blocks. That said you can still have a look at the transaction origin; if it is from an account that you expect to make a transaction and appears in the block chain in a non-local node (relative to the initiator of the transaction) then there is a chance that the transaction is going to be confirmed by multiple miners (it's a valid transaction).

  • 1
    The blockhash contains a hash of the transaction root. Meaning you should be able to pass some combination of header fields and transaction hashes to prove the existence of a given transaction hash
    – Akhil F
    Commented Jul 18, 2016 at 16:52
  • 1
    You don't have access to those header fields from within the contract. At most you can define a contract that accepts a set of fields that have been obtained from the block chain itself and perform some operation over them .
    – Sebi
    Commented Jul 19, 2016 at 8:15
  • yup thats exactly what im looking to create. the contract would take inputs and verify a transaction has been mined
    – Akhil F
    Commented Jul 19, 2016 at 13:13
  • I've edited the answer..
    – Sebi
    Commented Jul 20, 2016 at 9:55

Your Answer

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

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