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.
Ethereum Stack Exchange is a question and answer site for users of Ethereum, the decentralized application platform and smart contract enabled blockchain. It only takes a minute to sign up.Sign up to join this community
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
https://github.com/ethereum/go-ethereum/blob/ec8ee611caefb5c5ad5d796178e94c1919260df4/internal/ethapi/api.go (look for
input: transaction hash
output: bytes of the corresponding transaction
Have a look at getTransactionByHash() of the JSON-RPC API.
eth_getTransactionByHash Returns the information about a transaction requested by transaction hash. Parameters DATA, 32 Bytes - hash of a transaction params: [ "0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238" ] Returns Object - A transaction object, or null when no transaction was found: hash: DATA, 32 Bytes - hash of the transaction. nonce: QUANTITY - the number of transactions made by the sender prior to this one. blockHash: DATA, 32 Bytes - hash of the block where this transaction was in. null when its pending. blockNumber: QUANTITY - block number where this transaction was in. null when its pending. transactionIndex: QUANTITY - integer of the transactions index position in the block. null when its pending. from: DATA, 20 Bytes - address of the sender. to: DATA, 20 Bytes - address of the receiver. null when its a contract creation transaction. value: QUANTITY - value transferred in Wei. gasPrice: QUANTITY - gas price provided by the sender in Wei. gas: QUANTITY - gas provided by the sender. input: DATA - the data send along with the transact
You can also find the raw transaction hex on etherscan.io by going to a transaction, picking
Tools & Utilities and choosing
Get Raw TxHash. See for example:
If you want to do this programatically with
geth, I present a solution for that here:
Can I get the raw transaction using Nethereum?