Web3 & Ethereum Basics Cheat Sheet
Introduces core blockchain and Ethereum concepts, a minimal Solidity smart contract, and calling contracts from JavaScript with ethers.js.
2 PagesIntermediateMar 12, 2026
Core Web3/Ethereum Concepts
The vocabulary of Ethereum development.
- Blockchain- Append-only distributed ledger; each block cryptographically references the prior one
- Smart contract- Immutable code deployed to the chain that executes deterministically when called
- Wallet- Holds a private key that signs transactions; the address derives from the public key
- Gas- Fee paid in ETH to compensate validators for computation/storage a transaction consumes
- EVM- Ethereum Virtual Machine — executes smart contract bytecode identically on every node
- RPC provider- Service (e.g. Infura, Alchemy, or a self-hosted node) exposing JSON-RPC endpoints
- Mainnet vs Testnet- Testnets (e.g. Sepolia) use worthless test ETH for development before mainnet
Minimal Solidity Contract
A storage contract with an owner-only setter and an event.
solidity
// SPDX-License-Identifier: MITpragma solidity ^0.8.20;contract SimpleStorage { uint256 private value; address public owner; event ValueChanged(uint256 newValue); constructor() { owner = msg.sender; // deployer becomes the owner } function setValue(uint256 _value) public { require(msg.sender == owner, "Not authorized"); value = _value; emit ValueChanged(_value); } function getValue() public view returns (uint256) { return value; // 'view' = no gas cost when called off-chain }}
Interacting with a Contract (ethers.js)
Reading state for free, then sending a signed transaction.
javascript
import { ethers } from 'ethers';// Read-only provider (no signing capability)const provider = new ethers.JsonRpcProvider('https://sepolia.infura.io/v3/YOUR_KEY');// Signer wraps a private key/wallet for sending transactionsconst wallet = new ethers.Wallet(process.env.PRIVATE_KEY, provider);const abi = ['function getValue() view returns (uint256)', 'function setValue(uint256)'];const contract = new ethers.Contract('0xContractAddress...', abi, wallet);// Read call — free, no transaction, no gasconst current = await contract.getValue();// Write call — creates a signed transaction, costs gas, needs confirmationconst tx = await contract.setValue(42);const receipt = await tx.wait(); // waits for the tx to be minedconsole.log('Confirmed in block', receipt.blockNumber);
Gas & Transaction Terms
Concepts you need to reason about transaction cost.
- Gas limit- Maximum gas units a transaction may consume before it reverts
- Base fee / gas price- Cost per gas unit in gwei (1 gwei = 10^-9 ETH), set by EIP-1559 dynamics
- Priority fee (tip)- Extra amount paid to incentivize validators to include the transaction sooner
- Nonce- Sequential per-account counter preventing replay and enforcing ordering
- Revert- Failed transaction that undoes state changes, but the sender still pays gas already spent
- Wei/Gwei/Ether- Denominations: 1 ETH = 10^9 Gwei = 10^18 Wei
Pro Tip
Always call view/pure functions through a read-only provider (free, instant) and reserve signed transactions for actual state changes — calling a state-changing function when only a read was needed wastes real gas for no reason.
Was this cheat sheet helpful?
Explore Topics
#Web3EthereumBasics#Web3EthereumBasicsCheatSheet#WebDevelopment#Intermediate#CoreWeb3EthereumConcepts#MinimalSolidityContract#InteractingWithAContractEthersJs#GasTransactionTerms#CheatSheet#SkillVeris