[Ethereum] Get raw transaction from hash

go-ethereumraw-transactionwallets

I wonder if there is an equivalent to bitcoind's getrawtransaction, i.e., a command to dump a raw transaction in hex format, given its hash id.

I am working preferably in geth.

Best Answer

There is eth.getRawTransaction(<txhash>) now.

Edit: Please check that you're using an up-to-date version of geth. It's part of the current release (v.1.8.6) and was introduced some time ago. You can also see it in the source code: https://github.com/ethereum/go-ethereum/blob/ca64a122d33008c155c35a9d0e78cfbcafb1820a/internal/web3ext/web3ext.go (look for getRawTransaction)
https://github.com/ethereum/go-ethereum/blob/ec8ee611caefb5c5ad5d796178e94c1919260df4/internal/ethapi/api.go (look for GetRawTransactionByHash)

input: transaction hash
output: bytes of the corresponding transaction