Ethereum Overview

Difficulty: Beginner

Ethereum is a decentralized, open-source blockchain platform that extends the foundational concepts of Bitcoin by introducing a built-in, Turing-complete programming language. While Bitcoin was designed primarily as a peer-to-peer electronic cash system, Ethereum was conceived as a "world computer" - a global, censorship-resistant platform on which anyone can deploy and execute arbitrary programs called smart contracts. Proposed by Vitalik Buterin in 2013 and launched in 2015, Ethereum has become the dominant platform for decentralized applications.

Smart contracts are self-executing programs stored on the Ethereum blockchain. Once deployed, a smart contract's code is immutable and its execution is deterministic - given the same inputs and state, every node in the network will compute the same result. Smart contracts can hold funds, enforce agreements, manage digital assets, and interact with other contracts. They eliminate the need for trusted intermediaries in many scenarios: escrow services, token issuance, lending protocols, and governance systems can all be encoded as smart contracts and executed trustlessly by the network.

Ether (ETH) is the native cryptocurrency of the Ethereum network. It serves two primary purposes: as a store of value and medium of exchange (like Bitcoin), and as "fuel" for the network. Every computation and storage operation on Ethereum requires gas, and gas must be paid in ETH. This dual role gives ETH intrinsic utility beyond speculation - anyone who wants to use the Ethereum network must acquire and spend ETH. After Ethereum's transition to Proof of Stake, ETH also serves as the staking collateral that secures the network.

Decentralized applications (dApps) are applications built on top of Ethereum that leverage smart contracts for their backend logic. Unlike traditional applications where the backend runs on centralized servers controlled by a company, a dApp's core logic runs on the blockchain and is transparent, auditable, and resistant to censorship. The frontend of a dApp is typically a conventional web application (React, Vue, etc.) that interacts with smart contracts through libraries like ethers.js or web3.js. Users connect to dApps using browser wallets like MetaMask, which manage their private keys and sign transactions.

The Ethereum ecosystem has given rise to several transformative innovations. ERC-20 defined a standard interface for fungible tokens, enabling the ICO boom and the creation of thousands of tokens. ERC-721 standardized non-fungible tokens (NFTs), revolutionizing digital art and collectibles. Decentralized Finance (DeFi) protocols like Uniswap, Aave, and MakerDAO have created an open financial system with billions of dollars in value. Layer 2 scaling solutions like Optimism, Arbitrum, and zkSync address Ethereum's throughput limitations by processing transactions off-chain while inheriting the security of the main chain.

Code examples

Connecting to Ethereum with ethers.js

import { ethers } from 'ethers';

// Connect to an Ethereum node (using a public RPC endpoint)
const provider = new ethers.JsonRpcProvider('https://eth-mainnet.g.alchemy.com/v2/YOUR_KEY');

async function exploreEthereum() {
  // Get the latest block number
  const blockNumber = await provider.getBlockNumber();
  console.log('Latest block:', blockNumber);

  // Get a specific block with transactions
  const block = await provider.getBlock(blockNumber);
  console.log('Block hash:', block.hash);
  console.log('Timestamp:', new Date(block.timestamp * 1000).toISOString());
  console.log('Transaction count:', block.transactions.length);
  console.log('Gas used:', block.gasUsed.toString());
  console.log('Gas limit:', block.gasLimit.toString());

  // Check an account balance
  const vitalikAddress = '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045';
  const balance = await provider.getBalance(vitalikAddress);
  console.log('\nVitalik balance:', ethers.formatEther(balance), 'ETH');

  // Get transaction count (nonce) for an address
  const txCount = await provider.getTransactionCount(vitalikAddress);
  console.log('Transaction count:', txCount);

  // Look at a specific transaction
  if (block.transactions.length > 0) {
    const tx = await provider.getTransaction(block.transactions[0]);
    console.log('\nFirst transaction in block:');
    console.log('From:', tx.from);
    console.log('To:', tx.to);
    console.log('Value:', ethers.formatEther(tx.value), 'ETH');
    console.log('Gas price:', ethers.formatUnits(tx.gasPrice, 'gwei'), 'gwei');
  }
}

exploreEthereum();

This example shows how to interact with the Ethereum network using the ethers.js library. You can query block data, check balances, and inspect transactions. The provider connects to an Ethereum node via JSON-RPC - the standard API for communicating with Ethereum clients.

Key points

Concepts covered

World Computer, Smart Contracts, Ether, dApps