How Ethereum Manages Transactions

decorative line

How to build Ethereum blockchain applications

Note

If you are new to the blockchain technology, taking our Introduction to Blockchain Technology self-paced course is highly recommended. Also, for a comprehensive coverage of blockchain development in Ethereum or mastering Solidity programming, taking our below self paced courses is highly recommended:

Recap

In our previous article (How Ethereum Manages Accounts), we discussed how accounts are created and managed in Ethereum.

In this article, we learn how transactions are processed and managed in Ethereum.

Transactions and messages

Transactions and messages in Ethereum are a little bit confusing, largely because they are often discussed together. There are some subtle differences. The following diagram will give some clarity about the differences and commonalities between these two terms:

Ethereum blockchain

 

In Ethereum, the term transaction represents the signed data package of a message that is sent from an EOA to another account. The message itself instructs what action to take on the blockchain. They all require the initiator of the transaction to digitally sign the messages, and transactions will be recorded into the blockchain. Three types of transactions can happen:

  • CA creation: In this case, an Externally Owned Account (EOA) - covered in our previous article- acts as the initiator or creator of the new contract account.
  • A transaction between two EOAs: In this case, one EOA initiates an ether movement transaction by sending a message to the receiving EOA.
  • A transaction between EOA and CA: In this case, the EOA initiates a message call transaction, and the CA will react with the referenced smart contract code execution.

The CA can send messages to other CAs or EOAs. Unlike the transaction, messages are virtual objects during the execution and will not be recorded into the blockchain. If an EOA is the recipient, the recipient's account state will be updated and recorded in the world state. If a CA is the message recipient, they are accepted as function calls and the associated contract code will be executed.
From a data structure perspective, a transaction is a digitally signed message. According to web3.js, a message contains the following attributes. Apart from attribute, all others are optional:

Attribute

Data type

Length

Description

from

DATA

20

This is a required field as the sender's address.

to

DATA

20

This represents the receiver's address.

gas

QUANTITY

 

This represents the gas value provided for the transaction execution.

GasPrice

QUANTITY

 

This represents the unit gas price used for each paid gas.

value

QUANTITY

 

This represents the ether value to be sent with this transaction.

 

data

 

DATA

 

This represents the compiled code of a contract when creating a contract account or the hash of the invoked method signature and encoded parameters during the contract invocation.

nonce

QUANTITY

 

This represents a nonce. This allows you to overwrite your own pending transactions that use the same nonce.

Transactions will have additional attributes. Ethereum uses an Elliptic Curve Digital Signature Algorithm (ECDSA) signature for digital signatures; r and s are outputs of an ECDSA signature, and v is the recovery ID.

Next Article

In our next article (How Smart Contracts Work in Ethereum), we discuss how blockchain smart contracts work in Ethereum.

This article is written in collaboration with Brian Wu who is a leading author of “Learn Ethereum: Build your own decentralized applications with Ethereum and smart contracts” book. He has written 7 books on blockchain development.

Resources

Free Webinars on Blockchain

Here is the list of our free webinars that are highly recommended:

Free Courses

Here is the list of our 10 free self-paced courses that are highly recommended:


Self-Paced Blockchain Courses

If you like to learn more about Hyperledger Fabric, Hyperledger Sawtooth, Ethereum or Corda, taking the following self-paced classes is highly recommended:

  1. Intro to Blockchain Technology
  2. Blockchain Management in Hyperledger for System Admins
  3. Hyperledger Fabric for Developers
  4. Intro to Blockchain Cybersecurity
  5. Learn Solidity Programming by Examples
  6. Introduction to Ethereum Blockchain Development
  7. Learn Blockchain Dev with Corda R3
  8. Intro to Hyperledger Sawtooth for System Admins

Live Blockchain Courses

If you want to master Hyperledger Fabric, Ethereum or Corda, taking the following live classes is highly recommended:

 

Articles and Tutorials on Blockchain Technology

If you like to learn more about blockchain technology and how it works, reading the following articles is highly recommended:

Articles and Tutorials on Ethereum and Solidity

If you like to learn more about blockchain development in Ethereum with Solidity, reading the following articles and tutorials is highly recommended:

Articles and Tutorials on Hyperledger Family

If you like to learn more about blockchain development with Hyperledger, reading the following articles and tutorials is highly recommended:

Articles and Tutorials on R3 Corda

If you like to learn more about blockchain development on Corda , reading the following articles and tutorials is highly recommended:

Articles and Tutorials on Other Blockchain Platforms

If you like to learn more about blockchain development in other platforms, reading the following articles and tutorials is highly recommended:

Private Custom Tutoring

decorative line

We offer private custom tutoring classes both online and in DC, MD and VA for almost all of our courses or bootcamps. Give us a call or email us to discuss your needs.

$90 Regular

$50 Limited Offer

REGISTER NOW