# Understanding Ethereum Transactions and Its Consensus Algorithm
We can’t talk about Ethereum transactions without talking about
Ethereum, so what is this *Ethereum*?
Ethereum is also known as "the world computer"
But why is it called that?
It’s called "**the world computer**" because any program can run on Ethereum.
Ethereum is a network of computer all over the world that follows a set of rules called **Ethereum Protocols**.
The **Ethereum protocol** is a comprehensive set of rules and standards that govern the Ethereum blockchain network. It defines how nodes in the network communicate, validate transactions, and maintain the distributed ledger.
## Ethereum Transaction
##### What is a transaction?
Transactions are cryptographically signed order or requests from accounts. An account will initiate a orders to update the state of the Ethereum network. The simplest order is transferring ETH from one account to another.
#### What is a Ethereum transaction?
Ethereum transaction are request initiated by the owner of the ethereum account.
Note: It is not a smart contract
*Example*: Mr David Nnamdi send Techhuter 0.3 ETH, Mr David's account must be debited while Techhunter's account must be credited.
State-changing occurs in transaction and this state will be broadcasted on the whole network.
Any node that broadcast a request for a transaction to be executed on the EVM (Ethereum Virtual Machine); after this happens, a validator will execute the transaction and propagate the resulting state change to the rest of the network.
These transactions can be seen on the etherscan.io.

###### Transaction details includes:
- **From:** The address of the sender, who will be signing the operation. This will be an externally-owned account, as contract accounts cannot initiate operations.
- **To:** The receiving address. If it's a contract account, the operation will execute the contract's code.
- **Signature:** The sender's identifier, created when the sender's private key signs the operation, verifying that the sender has authorized it.
- **Nonce:** A sequential counter that indicates the transaction number from the account.
- **Value:** The amount of ETH to be transferred from the sender to the recipient, expressed in WEI (where 1 ETH equals 1e+18 WEI).
- **Input Data:** An optional field for including arbitrary data.
- **Gas Limit:** The maximum number of gas units that the operation can consume. The EVM specifies the gas required for each computational step.
- **maxPriorityFeePerGas:** The highest price per gas unit that can be given as a tip to the validator.
- **maxFeePerGas:** The maximum fee per gas unit that the sender is willing to pay for the operation, including both tbaseFeePerGas and maxPriorityFeePerGas.

```
{
from: "0xEA674fdDe714fd979de3EdF0F56AA9716B898ec8",
to: "0xac03bb73b6a9e108530aff4df5077c2b3d481e5a",
gasLimit: "21000",
maxFeePerGas: "300",
maxPriorityFeePerGas: "10",
nonce: "0",
value: "10000000000"
}
```

###### Explaination of the etherscan overview
- **Transaction hash (also known as a transaction ID or TXID):** This is a unique identifier assigned to a transaction recorded on a blockchain. It is a critical component in tracking and verifying transactions across the network.
- **Status:** It checks if it is success or undefined or failed
- **Block:** It shows the block number and how many comfirmation it passes.
- **Timestamp:** It show the Date of the transaction,
- **From:** Who sent the token.
- **To:** who is receiving the token.
- **Value:** The amount of ETH sent or receive
- **Transaction Fee:** The total amount of ETH paid by the sender to miners for processing the transaction
**Calculation:** Transaction Fee = Gas Used × Gas Price.
**Displayed As:** “Txn Fee” on Etherscan
- **Gas Price:** The amount of ETH the sender is willing to pay per unit of gas.
**Unit:** Usually measured in Gwei (1 Gwei = 0.000000001 ETH).
## Consensus Algorithm
###### Consensus
When numerous nodes—usually most nodes on the network—all have the same blocks in their locally validated best blockchain. Not to be confused with consen‐ sus rules.
###### Consensus rules
The block validation rules that full nodes follow to stay in consensus with other nodes. Not to be confused with consensus.
1. Proof of Work (PoW)
- **Used By:** Bitcoin and early Ethereum (pre-Ethereum 2.0)
- **Mechanism:** Miners compete to solve complex mathematical puzzles using computational power.
The first miner to solve the puzzle gets the right to add a new block to the blockchain and is rewarded with cryptocurrency. This process is resource-intensive and requires significant computational power and energy.
- **Pros:**
* Highly secure and resistant to attacks.
* Proven effectiveness in maintaining decentralized networks.
- **Cons:**
* High energy consumption.
* Slow transaction processing times.
2. Proof of Stake (PoS)
- **Used By:** Ethereum
- **Mechanism:** Validators are chosen to create new blocks based on the number of coins they hold and are willing to "stake" as collateral.
The likelihood of being selected to validate transactions increases with the amount of cryptocurrency staked.
Validators receive transaction fees as rewards.
- **Pros:**
* More energy-efficient compared to PoW.
* Faster transaction processing times.
- **Cons:**
* Can lead to centralization if a small number of participants hold most of the stake.
* Potential security vulnerabilities if the staking process is not well-designed.
3. Delegated Proof of Stake (DPoS)
- **Used By:** EOS, TRON
- **Mechanism:** Stakeholders elect a small number of delegates to validate transactions and create new blocks on their behalf.
Delegates are responsible for maintaining the blockchain and are rewarded with transaction fees.
Delegates can be voted out and replaced by stakeholders.
- **Pros:**
* Highly scalable and fast.
* Lower energy consumption.
- **Cons:**
* Centralization risk due to the small number of delegates.
* Potential governance issues if voting power is concentrated.
4. Proof of Authority (PoA)
- **Used By:** VeChain, POA Network
- **Mechanism:** A limited number of validators are pre-approved and authorized to create new blocks.
Validators' identities are known and trusted by the network.
Used primarily in private or consortium blockchains.
- **Pros:**
* High transaction throughput and low latency.
* Energy-efficient.
- **Cons:**
* Centralized control reduces decentralization benefits.
* Trust in validators' integrity and behavior is required.
5. Practical Byzantine Fault Tolerance (PBFT)
- **Used By:** Hyperledger Fabric, Zilliqa
- **Mechanism:** Nodes in the network communicate with each other to agree on the state of the blockchain.
A two-thirds majority is required to reach consensus.
Designed to tolerate a certain number of faulty or malicious nodes.
- **Pros:**
* High fault tolerance and security.
* Efficient and low latency.
- **Cons:**
* Scalability issues in large networks due to the high communication overhead.
* More complex implementation.
6. Proof of Burn (PoB)
- **Used By:** Slimcoin
- **Mechanism:** Participants "burn" (destroy) a certain amount of cryptocurrency to gain the right to mine new blocks.
Burning coins reduces the total supply, creating scarcity.
Ensures commitment from miners by requiring them to incur a cost upfront.
- **Pros:**
* Reduces energy consumption compared to PoW.
* Provides a fair way to distribute new coins.
- **Cons:**
* Still involves an element of waste (burned coins).
* May not be as secure as PoW or PoS.
7. Proof of Elapsed Time (PoET)
- **Used By:** Hyperledger Sawtooth
- **Mechanism:** Participants wait for a randomly assigned amount of time.
The first participant to finish waiting gets to create a new block.
Uses secure hardware to ensure fairness and randomness.
- **Pros:**
* Energy-efficient and fair.
* Scalable for large networks.
- **Cons:**
* Dependence on specialized hardware for security.
* Potential centralization if hardware is controlled by a few entities.
Feel free to ping me for questions:
- :mailbox: badviruscoder@gmail.com
- Mention `@Gosteanan` on [Twitter](https://twitter.com/g)