I'm using geth to store data strings into Ropsten. All of them are 128 byte long strings (in fact they are all SHA512 hashes of data files).

I just call web3.eth.sendTransaction with the string I need to store in its "data" field, like this:

web3.eth.sendTransaction({from: source, to:source, value:0, data: '0x' + imgHash})

The transaction is created and uploaded to the blockchain. It works like a charm.

I'm also using "getTransaction" to read those strings from the blockchain, and it works perfectly, too.

Please note that I'm not using smart contracts at all.

The problem comes when I take a look at those transactions in ropsten.etherscan.io. The result of all of the transactions sent is "Error in Txn: Stack underflow", although as I mentioned, they're all correctly uploaded to the blockchain.

enter image description here

I'm not too worried, since everything works as I want it to, but I can't figure out why is this "stack underflow" error happening. It seems a bit weird to me that everytime I send a transaction it shows a "contract creation" in etherscan...

Can anyone please explain to me why is this happening and how to fix it?

Thanks in advance! :)

  • Sure: ropsten.etherscan.io/address/…
    – JaVinci
    Commented Oct 19, 2017 at 12:52
  • I just tried this exact line of code on the main network: etherscan.io/tx/… Can you check what the value of the source variable is when you call sendTransaction? As far as I know, transactions to the 0x0 zero address are considered contract creation.
    – Jesbus
    Commented Oct 19, 2017 at 13:33
  • The source variable was ok, but I was missing a blank space after the :, looks like it wasn't working for that reason. Thank you so much, Jesse! :)
    – JaVinci
    Commented Oct 20, 2017 at 8:18

1 Answer 1


The problem here is in your transaction it is setting "to" to null. Since transaction with receiver set to null are interpreted as contract creation, it tries to execute your data is it were a constructor for a contract.

Since you data is random, it will fail. Some of the bytes from you data are valid opcodes for the EVM, it tries to execute them and fail with the error message you are getting, and that stops the execution.

Make sure your "source" variable is not null, or undefined, or 0.

  • Yes, that was the problem. For some reason to:source wasn't working, I had to put a blank space after the :, because source was correct. Thanks a lot! :)
    – JaVinci
    Commented Oct 20, 2017 at 8:16

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.