1

I use geth. When I submit a tx to a smart contract, the tx hash appears on the same screen with info about my node, like what block it’s on, etc. however, is there a way to receive the tx hash as output from calling the contract directly and easily?

3
  • I am not sure what exactly your question is. When you create a transaction, you immediately have a transaction hash. When the transaction is included in the block, you get a transaction receipt. What do you mean with "is there a way to receive the tx hash as output from calling the contract"?
    – ivicaa
    Commented Feb 22, 2018 at 20:03
  • 1
    Sorry I will clarify. If I type ‘contractAinstance.someMethod(input)’ is there a way from this alone to somehow receive the tx hash when this goes through? I can of course check my pending tx before and after to get the new tx hash, but I was wondering if there is a better and easier way to get it? Thanks.
    – user32096
    Commented Feb 22, 2018 at 20:09
  • I suppose, you're looking for this MyContract.MyMethod.sendTransaction(MyParams)
    – ivicaa
    Commented Feb 22, 2018 at 20:20

1 Answer 1

1

It sounds like you're asking if there is a way to receive the transaction hash from inside a smart contract. If that's what you're asking, then the answer is currently no. There was recently an EIP related to adding this to the EVM as an opcode https://github.com/ethereum/EIPs/issues/901

1
  • Thanks. I think that answers my question. So the only way to keep track of the tx hash is to look at the pending transactions before and after you submit?
    – user32096
    Commented Feb 24, 2018 at 21:23

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