Ethereum Series #01| Basics | 2022

Sm4rty
6 min readAug 14, 2022

--

Hey there, I am Samrat Gupta aka Sm4rty, a Security Researcher and a Bug Bounty Hunter. In this blog I will be explaining basics of Ethereum Blockchain and some of the terminology we use with ethereum like Nodes, Accounts, Smart contracts, EOAs etc. Lets get started:

What is Ethereum?

Ethereum is an open source, globally decentralized computing infrastructure that executes programs called smart contracts. It uses a blockchain technology to synchronize and store the system’s state changes, along with a cryptocurrency called ether to meter and constrain execution resource costs. It is often described as “the world computer.”

The Ethereum platform enables developers to build powerful decentralized applications with built-in economic functions. While providing high availability, auditability, transparency, and neutrality, it also reduces or eliminates censorship and reduces certain counterparty risks.

What are Smart Contracts?

A “smart contract” is simply a program that runs on the Ethereum blockchain. It’s a collection of code (its functions) and data (its state) that resides at a specific address on the Ethereum blockchain.
Smart contracts work by following simple “if/when…then…” statements that are written into code on a blockchain. A network of computers executes the actions when predetermined conditions have been met and verified.

In Ethereum Smart Contracts are written in Solidity or Vyper. But Solidity is more preferred while writing Smart Contracts.

What is Ether?

Ether is native currency for Ethereum Blockchain. It is utility currency to pay for use of the Ethereum platform as the world computer. Fundamentally, it is the only acceptable form of payment for transaction fees in Ethereum.

The ether cryptocurrency supports a pricing mechanism for Ethereum’s computing power. When users want to make a transaction, they must pay ether to have their transaction recognized on the blockchain. Since many transactions on Ethereum are small, ether has several denominations which may be referenced for smaller amounts. Of these denominations, Wei and gwei are particularly important. Below are some most common Denomination of Ethereum:

Some Common Terminologies:

1. Turing Complete:

Ethereum is Turing-complete programming language. Now let’s understand what is the meaning of Turing Complete.
A Turing-complete language is a language that, by definition, can perform any computation. In other words, if there is an algorithm for something, it can express it. Ethereum scripts, called smart contracts, can thus run any computation.

2. Accounts:

There are two types of accounts in Ethereum: Externally Owned Accounts (EOA) and Contract Accounts. Both account types have the ability to Receive, hold and send ETH and tokens and Interact with deployed smart contract.

3. Externally Owned Accounts (EOA)

Ownership of ether by EOAs is established through private keys, Ethereum addresses, and digital signatures. Anyone with a private key has control of the corresponding EOA account and any ether it holds.
EOAs are controlled by users. This control occurs often through software such as a wallet application. Externally owned accounts are simple accounts without any associated code or data storage. This type of Ethereum account is controlled by and cryptographically signed using a private key in the “real world.”

4. Contract Accounts:

A contract account has code and associated storage and every time it receives a message its code activates, allowing it to read and write to internal storage and send other messages or create contracts in turn.
A contract account is controlled by code executed by the Ethereum Virtual Machine. It is also referred to as a smart contract.

Lets Understand Difference between EOA and Contract Accounts:

5. Ethereum Transaction :

Transactions are cryptographically signed instructions from accounts. An account will initiate a transaction to update the state of the Ethereum network. The simplest transaction is transferring ETH from one account to another.
For example, if Bob sends Alice 1 ETH, Bob’s account must be debited and Alice’s must be credited. This state-changing action takes place within a transaction.

6. Ethereum Transaction Structure:

A transaction is a serialized binary message that contains the following components:

  • recipient – the receiving address (if an externally-owned account, the transaction will transfer value. If a contract account, the transaction will execute the contract code)
  • signature – the identifier of the sender. This is generated when the sender's private key signs the transaction and confirms the sender has authorized this transaction
  • value – amount of ETH to transfer from sender to recipient (in WEI, a denomination of ETH)
  • data – optional field to include arbitrary data
  • gasLimit – the maximum amount of gas units that can be consumed by the transaction. Units of gas represent computational steps
  • maxPriorityFeePerGas - the maximum amount of gas to be included as a tip to the miner
  • maxFeePerGas - the maximum amount of gas willing to be paid for the transaction (inclusive of baseFeePerGas and maxPriorityFeePerGas)

7. Ethereum Networks:

Networks are different Ethereum environments you can access for development, testing, or production use cases. Since Ethereum is a protocol, there can be multiple independent “networks” that conform to the protocol without interacting with each other.

Your Ethereum account will work across the different networks, but your account balance and transaction history won’t carry over from the main Ethereum network. For testing purposes, it’s useful to know which networks are available and how to get testnet ETH to play around with.

8. Blocks:

Blocks are batches of transactions with a hash of the previous block in the chain. This links blocks together (in a chain) because hashes are cryptographically derived from the block data. This prevents fraud, because one change in any block in history would invalidate all the following blocks as all subsequent hashes would change and everyone running the blockchain would notice.
To preserve the transaction history, blocks are strictly ordered (every new block created contains a reference to its parent block), and transactions within blocks are strictly ordered as well. This means dozens (or hundreds) of transactions are committed, agreed on, and synchronized on all at once.

9. What’s in a block?

  • timestamp – the time when the block was mined.
  • blockNumber – the length of the blockchain in blocks.
  • baseFeePerGas - the minimum fee per gas required for a transaction to be included in the block.
  • difficulty – the effort required to mine the block.
  • mixHash – a unique identifier for that block.
  • parentHash – the unique identifier for the block that came before (this is how blocks are linked in a chain).
  • transactions – the transactions included in the block.
  • stateRoot – the entire state of the system: account balances, contract storage, contract code and account nonces are inside.
  • nonce – a hash that, when combined with the mixHash, proves that the block has gone through proof-of-work.

10. Nodes:

A node is a software application that implements the Ethereum specification and communicates over the peer-to-peer network with other Ethereum nodes. A client is a specific implementation of Ethereum node. The two most common client implementations are Geth and OpenEthereum. Ethereum transactions are sent to Ethereum nodes to be broadcast across the peer-to-peer network.
Many Ethereum execution clients and consensus clients exist, in a variety of programming languages such as Go, Rust, JavaScript, Typescript, Python, C# .NET, Nim and Java.

This is just the basics of Ethereum and some of the common terminologies. In future blogs, I will explain more on other terminology like gas, EVM, and many other topics.

Connect with me:

Twitter
LinkedIn
Github
Instagram
Hashnode

Thanks for Reading. Any Suggestions are always welcomed!!

--

--

Sm4rty
Sm4rty

Written by Sm4rty

Smart contract Auditor and Web3 Security Researcher. Interested in Web3 and SmartContract Security.

Responses (2)