The transaction object on Ethereum is made up of the following components:
DATA, 32 Bytes - hash of the block where this transaction was in. null when it is pending.
QUANTITY- block number where this transaction was in. null when it's pending.
DATA, 20 Bytes - sender's address.
QUANTITY- gas provided by the sender.
QUANTITY- gas price provided by the sender in Wei.
DATA, 32 Bytes - hash of the transaction.
DATA- the data sent along with the transaction.
QUANTITY- the number of transactions made by the sender prior to this one.
DATA, 20 Bytes - address of the receiver. null when it's a contract creation transaction.
QUANTITY- integer of the transactions index position in the block. null when it's pending.
QUANTITY- value transferred in Wei.
QUANTITY- ECDSA recovery id
DATA, 32 Bytes - ECDSA signature r
DATA, 32 Bytes - ECDSA signature s
Below you will find more detailed explanations for each parameter on the transaction object.
Every transaction that has been verified and added to the blockchain will receive an assigned
hash. This creates a unique identifier for the transaction that can be used to locate and retrieve information about a specific transaction.
Each block has a corresponding cryptographic hash which includes all the data of that block. The
blockHash is the hash of the block where this transaction has been included. In the case of a pending transaction that has not been added to a block, you will receive a
null value in return.
Once a block has been added to the blockchain, it is assigned the following available number in sequential order. Using the
blockNumber, you can tell when the transaction has been added to a block.
Ethereum transactions have both a sender and receiver. The
from field is the address of the sender and can be used to find out which address started the transaction.
For transactions to be completed and added to a block, the sender must provide an amount of gas in addition to the value of the transaction. Gas is used to cover the computation costs required to complete the transaction. This
gas field shows you the amount of gas that was provided by the sender.
Another way to show the gas price is in wei. Wei is the smallest denomination of ETH and is a better way to work with smaller transactions of ETH. 1 wei is the equivalent of 10^-18 ETH. This
gasPrice shows the amount of gas provided by the sender in WEI.
Data can be added to the data field of a transaction whenever a user deploys or makes a call to a function in a smart contract. This data is a message to the smart contract that points to the function that will be executed.
input field contains the data that is included in the transaction. If this field is empty, the transaction is a transfer between users and doesn't involve a smart contract.
To prevent any double-spend from a user and to ensure transactions occur in the correct order, each transaction from a given address has an assigned
nonce. The nonce is the number of transactions from that specific address. The nonce increases by 1 after every transaction. A transaction must but be completed before another one can begin.
Transactions have both a sender and receiver. The
to field is the address of the receiver and can be used to find out which address started the transaction.
When a transaction is added to a block, it is assigned a numbered position inside that block. The
transactionIndex returns the value of the position of the transaction in the block to which it has been added.
Every transaction has an attached value which is the amount that is being transferred from the sender to the receiver. The
value returns this quantity and is shown in Wei.
Ethereum uses ECDSA (Elliptic Curve Digital Signature Algorithm) to create digital signatures of a transaction. These signatures are used to verify that they are authentic and coming from the correct sender, much like a real signature.
A digital signature can be divided into two numbers -
s. These numbers are generated by your private key. By sending
s through an algorithm, you should get the value of
R which is used to validate the signature.
ECDSA uses the
v value to recover the correct public key when performing validation on the signature of the transactions. It is a combination of:
- recovery_id - the position on the curve that is used by ECDSA to generate the keys.
- chain_id - the Ethereum Network ID (ex: 1 - Ethereum Mainnet).
Updated over 1 year ago