decode_signed_transaction
Documentation for eth_defi.tx.decode_signed_transaction function.
- decode_signed_transaction(raw_bytes)[source]
Decode already signed transaction.
Reverse raw transaction bytes back to dictionary form, so you can access its data field and other parameters.
The function supports:
Legacy transactions
EIP-2718, EIP-2930 transactions introduced in Berlin hard fork.
- See TypedTransaction source
for more documentation.
Example:
signed_tx = hot_wallet.sign_transaction_with_new_nonce(raw_tx) signed_tx_bytes = signed_tx.rawTransaction d = decode_signed_transaction(signed_tx_bytes) assert d["chainId"] == 1337 assert d["nonce"] == 0 assert d["data"].hex().startswith("0xa9059cbb0") # transfer() function selector
- Parameters
raw_bytes (Union[bytes, str, hexbytes.main.HexBytes]) – A bunch of bytes in your favorite format.
- Raises
DecodeFailure – If the tx bytes is something we do not know how to handle.
- Returns
Dictionary like object containing data, v, r, s, nonce, value, gas, gasPrice. Some fields like chainId, accessList, maxPriorityFeePerGas depend on the transaction type.
- Return type