DEV Community

Cover image for What is a transaction in Ethereum?
Leyutsega Abebaw
Leyutsega Abebaw

Posted on

What is a transaction in Ethereum?

*A transaction in Ethereum is like sending a signed message that says: “I, the owner of this wallet, want to send money or trigger a program.”
Every transaction changes something on the blockchain — for example:-Sending ether to another person.
-Running a smart contract (like trading tokens or minting NFTs).
Only Externally Owned Accounts (EOAs)— wallets controlled by people — can start transactions.
The Parts of a Transaction
Each transaction includes several important pieces of data: Part, Meaning, Nonce
A unique number that keeps your transactions in order.
*
Gas price
How much you’re willing to pay per unit of work (like “fuel price”).
****Gas limit
The maximum amount of work you’ll allow for this transaction.

*Recipient
The address you’re sending ether or data to.
*
Value
The amount of ether you want to send.
****Data
Optional— used if you’re calling a smart contract.
v, r, s
Signature pieces that prove it’s really you who sent it.
All of this information is encoded and sent through the Ethereum network.
Nonce (Transaction Number)
Think of the nonce as the transaction number for your account.
-Your first transaction = nonce 0
-Your second transaction = nonce 1

  • and so on... It prevents hackers from re-sending old transactions(called replay attacks) and helps the network process them in the right order. *Example (incode):web3.eth.getTransactionCount("0xYourAddress"); This shows how many transactions you’ve already made — that’s your next nonce. *Gas (Transaction Fuel) Ethereum uses gas to pay for computation. It’s like fuel for running a program. -Gas price→how much you’re willing to pay for each “unit of work.” -Gas limit→ the maximum units you’ll allow the transaction to use. If gas didn’t exist, someone could overload the network for free. Gas prevents that. ****Recipient Every transaction goes to a recipient address: -If it’s a normal wallet →the money just moves there. -If it’s a contract address →it runs code (like executing a smart contract function). Digital Signatures (Security) Each transaction must be signed with your private key using something called ECDSA. That signature proves:
  • You authorized it (ownership).
  • You can’t later deny it (non-repudiation).
  • It wasn’t changed after signing (integrity). How a Transaction Is Signed Here’s the simplified process:
  • Make the transaction data.
  • Encode it properly (RLP encoding).
  • Hash it (with Keccak-256).
  • Sign it with your private key → creates 'v,r,s.
  • Add the signature to the transaction. This signed message is what actually gets sent to the network. How Transactions Spread Once signed, the transaction is sent to one Ethereum node. That node checks it and shares it with others (like spreading news through friends). This is called flood routing— it helps the transaction reach the entire network quickly.

Top comments (0)