Home/Blockchain/Transactions & Nonce/Building Transactions

🛠️ Build Your First Transaction

Create, sign, and broadcast a real blockchain transaction

🛠️ Building Transactions

Now let's put it all together! Build your own transaction and see how all the pieces fit.

🎮 Interactive Transaction Builder

Fill in the fields below to create a transaction:

This is your wallet address (read-only)

Standard transfer = 21,000

Higher = faster confirmation

Estimated Fee:0.000000 ETH

21000 gas × 50 Gwei

📋 Step-by-Step: Real Transaction Flow

1
🔌 Connect Wallet

User connects MetaMask or other Web3 wallet to your dApp

2
📝 Prepare Transaction Data

Gather: to address, value, gas limit, gas price

web3.eth.sendTransaction({from, to, value, gas, gasPrice})
3
🔢 Fetch Current Nonce

Get latest transaction count for the account

const nonce = await web3.eth.getTransactionCount(address, 'pending')
4
✍️ Sign Transaction

Wallet prompts user to approve and sign with private key (happens in wallet, not your code)

5
📡 Broadcast to Network

Signed transaction sent to Ethereum nodes via RPC

const txHash = await web3.eth.sendSignedTransaction(signedTx)
6
⏳ Wait in Mempool

Transaction sits in pending pool until picked up by miner/validator

7
✅ Included in Block

Validator adds transaction to block, becomes part of blockchain

const receipt = await web3.eth.getTransactionReceipt(txHash)
8
🎉 Confirmation(s)

Wait for additional blocks for finality (1-12+ confirmations depending on risk tolerance)

⚡ Transaction Status Tracking

🟡 Pending

Transaction broadcast but not yet in a block

  • Sitting in mempool waiting to be picked up
  • Can be sped up by resubmitting with higher gas
  • Can be cancelled by sending 0 ETH to self with same nonce
🟢 Confirmed (1 block)

Included in latest block

  • Transaction is on the blockchain
  • Still possible to reorg (rare)
  • Most apps consider this "successful"
🔵 Finalized (12+ blocks)

Multiple confirmations deep

  • Extremely unlikely to be reversed
  • Exchanges typically wait 12-35 confirmations
  • Considered permanent
🔴 Failed

Transaction rejected or reverted

  • Common reasons: out of gas, revert in smart contract
  • Gas is still consumed (paid to validators)
  • Nonce is still incremented

💡 Best Practices

🎯
Always Validate Inputs

Check address format, balance, and amount before sending

💰
Estimate Gas First

Use eth_estimateGas to avoid out-of-gas errors

👁️
Show Clear Previews

Let users review all details before signing

🔔
Provide Status Updates

Keep users informed: pending → confirmed → finalized