Create and Verify a Transaction (Ethereum)

Learn how to efficiently create and verify transactions in the crypto world.

0x15AF...A3e3

An Ethereum transaction is a signed data message sent from one account to another on the Ethereum blockchain.

Pieces in a Transaction?

A typical transaction in Ethereum requires the following:

Nonce: A unique number that serves as a transaction count for the sender's address.

  • Ensures that each transaction is only processed once and in order. The nonce prevents double-spending by making sure each transaction is unique.

Gas Price: The amount of Ether the sender is willing to pay per unit of gas (measured in wei).

  • Incentivizes miners to include the transaction in a block. The higher the gas price, the more likely miners are to prioritize the transaction.

Gas Limit: The maximum amount of gas units that the sender is willing to use for the transaction.

  • Sets a cap on how much computational work (and thus cost) the transaction can consume. It also protects against inadvertently sending transactions that could exhaust the sender’s balance.

To Address: The recipient address of the transaction. It could be an external account or a smart contract address.

  • Specifies where the funds or the call data should be sent. If deploying a new contract, this field is typically empty.

Amount Value: The amount of Ether (in wei) to send to the recipient address.

  • Transfers value from the sender's account to the recipient's account. This field is set to zero when the transaction does not involve a transfer of Ether.

Data: A field containing optional data. This can be empty, contain a contract deployment bytecode, or contain the encoded function call and parameters for a smart contract.

  • Allows interaction with smart contracts, either by deploying a new contract or invoking functions on an existing contract.

v, r, s (Signature Components): Components of the transaction signature.

  • v: Recovery id that helps identify which chain the transaction is meant for and the version of the signature.

  • r and s: Cryptographic signatures generated from the sender’s private key.

  • Provides cryptographic proof that the transaction was authorized by the owner of the sender's address. This ensures the integrity and authenticity of the transaction.

Different Types of Transactions

Transactions can do the following:

  • Transfer Ether between accounts.

  • Deploy a new smart contract.

  • Interact with an existing smart contract.

We're only going to cover the first one, transfering Ether between accounts.

Recieving Funds

post image

It's always nice to be on the recieving end of funds, there's transaction building and of course you're recieving funds.

All you have to do is provide the address of your wallet, you can either share the QR code or copy the address.

Note: When we're starting out in Testnet we'll fund our wallet using a Faucet in the testnet network, the faucet provides free test cryptos.

There are quite a few faucets, but Alchemy (https://www.alchemy.com/faucets/) seems to be most reliable one, but you will need to create an account them to use their faucet. After you choose your network, we're using Sepolia Test network (the Ethereum test network changes every so often) and you prove you're a human you can paste in your wallet address and recieve funds.

post image
post image

Sending Funds

Luckily our Wallet takes care of filling out most of the details for a transaction, we just have to provide a to address and amount, if we want to make specific changes we can but for this post we'll keep it simple.

Switching Networks

We're not sending real funds, just testnet so it's important to make sure we are switching the network on our wallet.

On the left hand side of your wallet select the little logo of the network and it will take you to this page. Here you will select 'Show test networks' and then select 'Sepolia'. After you're done exit out of this window.

Sending Funds

  1. Hit the 'Send' button in your Metamask browser extension

  2. Enter the amount you want to transfer and the address the funds are being sent to and hit continue.

    Note!!!!: Before you continue please double check that the address belongs to person or organization you're sending funds to. Sometimes you can also verify if an address doesn't belong to a scammer by entering it here https://ethscamcheck.io/ (But this is also not always up to date).

    post image
  3. You will see all the transaction details along with the gas (transaction) fees. Depending on the network's activity and amount the fees can vary. Now you need to confirm the transaction with the estimated gas and network fee.

    post image
  4. After you confirm the transaction is sent for validation. If you see a speed up button that means your transaction hasn't been picked up by a validator and they need a "tip" (extra ETH as an incentive to pick it up).

post image
  1. Once you see the status as 'Confirmed' then you know the transaction is in the network and the transaction is ready to be verified.

Verifying Transaction

This is the most important step, after you transaction is submitted you will get a transaction ID. When you click on the transaction you will see all the details about the transaction, this is your receipt.

post image

When you 'Copy Transaction ID' you will get to see the details on a Ethereum Network Explorer like Etherscan or whatever your preference is. You can also also just select 'View on block explorer' and it should take you to Etherscan so you can check that your transaction actually went to the address you sent it to.

Note: If you're a decent being, you should always send the transaction ID after the transaction is submitted so both parties are aware of the status of the transaction.

post image

Call to Action -> Assignment

  1. Fund your wallet with Testnet ETH

  2. Send 0.0001 to our class wallet 0x6836684527E29572A855fEf7348637bE8d972BB7

  3. Email me the transaction ID and the Block number it was mined in

Create and Verify a Transaction (Ethereum)