Nadcab logo

Ethereum Token Standards Explained: ERC-20, ERC-: Engineering Playbook

Published on: 11 Jun 2026

Ai Overview

Teams selecting an Ethereum token standard face a technical decision that shapes gas costs, wallet compatibility, and contract audit scope. ERC 1155 uses mapping(uint256 => mapping(address => uint256)), enabling batch transfers that write multiple balances in one transaction, amortizing the 21,000 gas base cost across many tokens. A batch mint of 1,000 NFTs on ERC 721 can cost 70,000,000 gas.

Teams selecting an Ethereum token standard face a technical decision that shapes gas costs, wallet compatibility, and contract audit scope. ERC 20 defines fungible tokens with balance mappings and allowance mechanics. ERC 721 introduces unique token IDs for non fungible assets with metadata pointers. ERC 1155 merges both models into a single contract that handles fungible and non fungible tokens through ID based balance arrays and batch operations. Your choice determines state variable structure, event log patterns, and the failure modes you will debug in production. ethereum token standards.

Key Takeaways

  • ERC 20 uses two dimensional balance and allowance mappings. State updates emit Transfer and Approval events that indexers parse for off chain balance tracking.
  • Each ERC 721 token ID maps to exactly one owner. Metadata lives on chain or at an external URI, creating data availability trade offs and gas overhead for enumeration.
  • ERC 1155 stores balances in a nested mapping by ID, enabling atomic batch transfers and reducing deployment costs when a project needs both fungible and non fungible tokens.
  • Gas costs scale differently. ERC 20 transfers cost roughly 21,000 plus 5,000 per SSTORE. ERC 721 adds metadata lookup overhead. ERC 1155 batch operations amortize per token cost.
  • Audit checkpoints differ by standard. ERC 20 requires reentrancy guards in approve/transferFrom. ERC 721 mandates safe transfer callbacks. ERC 1155 needs batch atomicity validation.
  • Production integration ties to Ethereum Token development workflows: testnet validation, mainnet gas profiling, contract verification, and event indexer setup.

Why Token Standard Selection Shapes Ethereum Projects

Ethereum token standards define the function signatures, state variables, and event logs that wallets, exchanges, and indexers expect. Deploy a contract implementing ERC 20 and every execution client knows to look for balanceOf(address) and Transfer(address,address,uint256) events. Wallet software calls these functions without custom integration. Exchanges parse Transfer events to credit deposits. Block explorers decode transaction data automatically. Pick the wrong standard and you break this interoperability, forcing every downstream system to write custom adapters.

Gas costs vary by standard because state layout differs. ERC 20 stores balances in a single mapping(address => uint256), so each transfer writes one storage slot. ERC 721 maintains ownerOf(uint256 => address) plus optional enumeration mappings, increasing SSTORE operations per mint. ERC 1155 uses mapping(uint256 => mapping(address => uint256)), enabling batch transfers that write multiple balances in one transaction, amortizing the 21,000 gas base cost across many tokens. Model gas consumption per standard before you write a single line of Solidity. A batch mint of 1,000 NFTs on ERC 721 can cost 70,000,000 gas. The same operation on ERC 1155 might drop to 10,000,000. ethereum token standards.

Audit complexity scales with standard features. ERC 20 audits focus on reentrancy in approve/transferFrom, integer overflow in legacy contracts without SafeMath, and allowance front running vectors. ERC 721 introduces safe transfer callbacks that execute arbitrary code in the receiver contract, expanding the attack surface. ERC 1155 batch operations require atomicity checks so partial failures revert the entire transaction. A simple ERC 20 audit might take two weeks. An ERC 1155 contract with custom batch logic can stretch to six. ethereum token standards.

Fungibility determines your starting point. Every token identical and divisible? ERC 20 fits. Each token unique with distinct metadata? ERC 721 applies. Need both fungible currencies and unique items in one contract, or mint thousands of tokens per transaction? ERC 1155 reduces deployment and operational costs. Map your business requirements to these technical capabilities before you commit. Coin and Token distinctions clarify when you need a standard versus a native blockchain asset. ethereum token standards.

Ethereum Token Standards Explained Erc Engineering — labelled architecture diagram
Ethereum token standards

ERC 20 Architecture: Fungible Token Mechanics and State Management

ERC 20 defines six mandatory functions: totalSupply, balanceOf, transfer, transferFrom, approve, and allowance. Two state variables underpin these functions. mapping(address => uint256) private _balances tracks each account’s token count. mapping(address => mapping(address => uint256)) private _allowances records how many tokens one address permits another to spend. When Alice calls transfer(Bob, 100), the contract subtracts 100 from _balances[Alice], adds 100 to _balances[Bob], and emits Transfer(Alice, Bob, 100). Execution clients update the state root in the block header after applying this transaction. ethereum token standards.

Multiple transactions modifying balances in the same block expose ordering dependencies. Ethereum sequences transactions within a block deterministically. If Alice sends 50 tokens to Bob and Bob sends 30 to Carol in the same block, the final state depends on transaction order. Miners or validators sequence transactions by gas price and nonce. The execution layer applies each transaction to the previous state, recalculates the Merkle Patricia trie root, and includes that root in the block header. Light clients verify state transitions by checking Merkle proofs against this root. Balance changes propagate through this mechanism, so off chain indexers must replay transactions in block order to reconstruct accurate balances. Miss one transaction and your balance table drifts from chain state. ethereum token standards.

Three failure modes dominate production incidents. Reentrancy occurs when transferFrom calls an external contract before updating _allowances, letting that contract call transferFrom again with the old allowance value. The classic mitigation is checks effects interactions: update state before external calls. Integer overflow plagued early tokens before Solidity 0.8.0 introduced automatic overflow checks. Legacy contracts still in production require SafeMath wrappers. Gas exhaustion hits batch operations that loop over recipient arrays. If the array exceeds block gas limit, the transaction reverts. Test with maximum expected array sizes and measure gas per iteration. Production contracts fail when users pass 500 element arrays that worked fine in local tests with 10 elements. ethereum token standards.

Event emission patterns control off chain indexing. Transfer(address indexed from, address indexed to, uint256 value) and Approval(address indexed owner, address indexed spender, uint256 value) use indexed parameters so log filters can query by address. Indexers subscribe to these events, parse the logs, and update database tables. Missing events break wallet balance displays and exchange deposit detection. Contracts that mint tokens must emit Transfer(address(0), recipient, amount) so indexers recognize new supply. Burn operations emit Transfer(sender, address(0), amount). ERC 20 integration in web applications relies on these event logs for real time balance updates. ethereum token standards.

Function State Reads State Writes Typical Gas Cost
transfer _balances[sender], _balances[recipient] _balances[sender], _balances[recipient] ~51,000 gas
approve none _allowances[owner][spender] ~46,000 gas
transferFrom _allowances[owner][spender], _balances[owner], _balances[recipient] _allowances[owner][spender], _balances[owner], _balances[recipient] ~65,000 gas
balanceOf _balances[account] none ~23,000 gas (view)

Testnet deployment on Goerli or Sepolia starts with minting tokens to test accounts. Execute transfers, verify balances match expected values. Call approve then transferFrom to confirm allowance logic. Monitor emitted events with a local indexer or Etherscan API. Measure gas consumption per function call and compare against budget. Audit the contract for reentrancy guards, overflow protection, and correct event parameters. Only after these checks pass do you deploy to mainnet. Ethereum Development workflows integrate these validation steps into CI/CD pipelines. ethereum token standards.

ERC 721: Non Fungible Token Ownership and Metadata Layers

ERC 721 assigns each token a unique uint256 ID. The core state variable is mapping(uint256 => address) private _owners, which records the current owner of each token. ownerOf(uint256 tokenId) returns _owners[tokenId]. transferFrom(address from, address to, uint256 tokenId) updates _owners[tokenId] to the new owner and emits Transfer(from, to, tokenId). Unlike ERC 20, there is no balance aggregation: each token is distinct. Wallet software queries ownerOf for every token ID the user might own, or it relies on Transfer event logs to build an ownership index.

Metadata resolution introduces a new layer of complexity. tokenURI(uint256 tokenId) returns a string pointing to off chain JSON. Common patterns store metadata on IPFS with a URI like ipfs://QmHash/tokenId.json. The JSON contains name, description, image URL, and attributes. On chain metadata costs prohibitive gas for images or large text, so most projects use external storage. Data availability risk surfaces when the IPFS node goes offline or the centralized server hosting metadata disappears. Some contracts store metadata hashes on chain to prove immutability, but the actual data lives off chain. I have seen production incidents where NFT collections lost metadata because the team’s AWS S3 bucket expired.

Enumeration extensions add discoverability at a gas cost. ERC 721 Enumerable maintains mapping(address => mapping(uint256 => uint256)) private _ownedTokens to list all tokens owned by an address, plus an array of all token IDs. totalSupply and tokenByIndex enable iteration over every minted token. These mappings require additional SSTORE operations per transfer, increasing gas by roughly 20,000 per transaction. Projects that need wallet UIs to display all owned tokens implement enumeration. Projects optimizing for gas skip it and rely on event indexing. The choice is binary: pay 20,000 gas per transfer or run your own indexer.

Minting a single token writes _owners[tokenId], increments _balances[owner], and emits Transfer(address(0), owner, tokenId). This costs around 70,000 gas. Batch minting without enumeration can loop over token IDs in one transaction, but each iteration still writes a new storage slot. ERC 721A optimizes batch mints by updating _owners only for the first token in a consecutive range, reducing per token cost to roughly 5,000 gas. Transfer overhead exceeds ERC 20 because you must verify the sender owns the specific token ID, not just check a balance. Marketplace approval patterns call setApprovalForAll(operator, true) once, then the operator can transfer any token the owner holds, avoiding per token approve calls.

ERC 721 Transfer Flow

1. Verify Ownership
require(_owners[tokenId] == from)
2. Check Approval
_tokenApprovals[tokenId] or _operatorApprovals
3. Update State
_owners[tokenId] = to; _balances[from] ; _balances[to]++
4. Emit Event
Transfer(from, to, tokenId)
5. Safe Transfer Callback
onERC721Received if recipient is contract

Safe transfer functions (safeTransferFrom) call onERC721Received(operator, from, tokenId, data) on the recipient if it is a contract. This callback prevents accidental transfers to contracts that cannot handle NFTs. The recipient must return a specific selector to confirm receipt. If the callback reverts or returns the wrong value, the transfer fails. Reentrancy risk surfaces here: the recipient contract can call back into the token contract during the callback. Update _owners[tokenId] before the external call. Auditors test reentrancy by writing malicious receiver contracts that attempt recursive transfers. ICO Token projects using ERC 721 for access passes must validate safe transfer logic carefully.

Testnet deployment requires minting a token, transferring it, and confirming Transfer events appear in block explorers. Query tokenURI and verify the metadata JSON loads correctly. Test safe transfer callbacks with a mock receiver contract that logs the call and returns the correct selector. Measure gas for mint, transfer, and approval operations. Check that ownerOf reverts for non existent token IDs. Validate that setApprovalForAll updates _operatorApprovals correctly. Run reentrancy tests with a malicious receiver that calls back into the token contract. Deploy a receiver contract that deliberately returns the wrong selector and verify the transfer reverts. Only after these checks pass do you deploy to mainnet and submit for contract verification on Etherscan.

Ethereum Token Standards Explained Erc Engineering — technical process flow chart
ERC 20 token

ERC 1155 Multi Token Standard: Batch Operations and Hybrid Use Cases

ERC 1155 stores balances in mapping(uint256 => mapping(address => uint256)) private _balances, where the first key is the token ID and the second is the owner address. This nested structure supports both fungible and non fungible tokens in one contract. For fungible tokens, multiple addresses hold non zero balances of the same ID. For non fungible tokens, exactly one address holds a balance of 1 for a unique ID. balanceOf(address account, uint256 id) returns _balances[id][account]. Transfers update both sender and recipient balances for the specified ID.

safeBatchTransferFrom(address from, address to, uint256[] ids, uint256[] amounts, bytes data) loops over the arrays, subtracting amounts[i] from _balances[ids[i]][from] and adding to _balances[ids[i]][to]. If any subtraction underflows, the entire transaction reverts. This atomicity guarantees that either all tokens transfer or none do. Gas cost amortizes the 21,000 base transaction fee across many tokens: transferring 10 tokens in one batch costs roughly 100,000 gas total, versus 510,000 for 10 separate ERC 20 transfers. The savings compound at scale. A game distributing 100 item drops to 50 players can batch the operation into a single transaction instead of 5,000 individual calls.

Operator approval uses setApprovalForAll(address operator, bool approved), which sets mapping(address => mapping(address => bool)) private _operatorApprovals[owner][operator]. An approved operator can transfer any token ID and any amount the owner holds. ERC 20 allowances specify exact amounts per spender. ERC 1155 approval is binary: all tokens or none. Projects needing granular control must implement custom approval logic on top of the standard.

Testnet validation requires specific edge case testing. Mint multiple token IDs to one address, and call safeBatchTransferFrom with arrays of IDs and amounts. Intentionally cause one transfer to fail by setting an amount higher than the balance. Verify the entire transaction reverts and no balances change. Test partial failure scenarios by manipulating array lengths or passing mismatched ID and amount arrays. Confirm the contract reverts with a clear error message. Measure gas consumption for batch sizes from 1 to 100 tokens and identify the point where block gas limit becomes a constraint. On mainnet, the 30 million gas block limit caps batch size around 300 to 500 tokens depending on your contract logic.

Gas Cost Comparison: Single vs Batch Transfers

ERC 20 (10 transfers) 510,000 gas
ERC 721 (10 transfers) 620,000 gas
ERC 1155 batch (10 tokens) 100,000 gas
ERC 1155 batch (50 tokens) 280,000 gas

Gaming inventories that include currencies, consumables, and unique items benefit from a single contract managing all asset types. Fractionalized real estate tokens where each property is an ID and fractional shares are fungible balances of that ID fit the model. Supply chain tracking where each product batch has a unique ID and units within the batch are fungible uses the dual nature. High volume minting scenarios where you create thousands of tokens per transaction achieve significant gas savings through batch operations. ERC 1155 adoption grows in projects prioritizing operational efficiency over standard simplicity.

Emit TransferSingle(operator, from, to, id, amount) for single transfers and TransferBatch(operator, from, to, ids, amounts) for batches. Indexers parse these events to reconstruct per ID balances for each address. Test edge cases: transferring zero amount, transferring to the zero address, batch arrays with zero length. Verify that uri(uint256 id) returns metadata correctly for both fungible and non fungible IDs. Token Standards for Real Estate Tokenization projects use ERC 1155 to represent fractional ownership, so metadata must distinguish property details from share quantities.

Production Integration Checklist for Ethereum Token Development

If tokens are interchangeable and divisible, ERC 20 is the baseline. Each token unique with distinct metadata? ERC 721 applies. Need both types or high volume batch operations? ERC 1155 reduces costs. Metadata complexity determines standard fit: simple name and symbol suit ERC 20, while rich attributes and images require ERC 721 or ERC 1155 with off chain storage. Batch operation frequency drives the choice between single token standards and ERC 1155. Ecosystem tooling maturity favors ERC 20 and ERC 721, which have broader wallet and exchange support, while ERC 1155 integration is growing but less universal.

ERC 20 audits verify reentrancy guards in approve and transferFrom, check for integer overflow in arithmetic operations, and confirm correct event emission. ERC 721 audits add safe transfer callback validation, metadata URI immutability checks, and enumeration logic if implemented. ERC 1155 audits focus on batch atomicity, operator approval correctness, and multi ID balance consistency. All standards require access control verification: only authorized addresses can mint, burn, or pause transfers. Use OpenZeppelin’s AccessControl or Ownable patterns and test that unauthorized calls revert. A production incident involved an ERC 721 contract where anyone could call mint because the onlyOwner modifier was missing.

Deploy to Goerli or Sepolia, mint tokens, execute transfers, and verify balances and events. Measure gas consumption for typical operations and confirm costs fit within budget. Run security tests: attempt reentrancy, overflow, unauthorized access. Fix issues and redeploy. Estimate mainnet gas by simulating transactions with current gas prices. Deploy to mainnet when validation passes. Submit the contract source code to Etherscan for verification so users can read the code and confirm it matches the deployed bytecode. Token Listing on wallets and exchanges requires verified contracts and correct metadata standards.

Checkpoint ERC 20 ERC 721 ERC 1155
Reentrancy Guard approve, transferFrom safeTransferFrom callback safeBatchTransferFrom callback
Overflow Protection balance arithmetic token ID generation balance updates per ID
Event Completeness Transfer, Approval Transfer, Approval, ApprovalForAll TransferSingle, TransferBatch, ApprovalForAll
Metadata Validation name, symbol, decimals tokenURI immutability, IPFS availability uri(id) per token metadata
Access Control mint, burn, pause mint, burn, setTokenURI mint, burn, setURI

Run a local or hosted indexer that subscribes to Transfer and other events, updating a database with current balances and ownership. Monitor gas prices and adjust transaction timing to avoid peak congestion. Set up alerts for failed transactions or unexpected state changes. Track total supply and verify it matches expected mint and burn operations. Cloud Engineers Services can deploy indexers and monitoring infrastructure as part of token launch support.

Integration with Ethereum Token development services ties these checkpoints to professional implementation. Teams without in house Solidity expertise benefit from audited contract templates, automated testing frameworks, and deployment scripts that handle testnet validation and mainnet gas estimation. Service providers implement standard specific optimizations: ERC 20 with SafeMath or Solidity 0.8.0 overflow checks, ERC 721 with gas efficient batch minting, ERC 1155 with batch operation limits to prevent block gas exhaustion. Post deployment support includes contract verification, metadata hosting, and indexer setup, ensuring the token integrates smoothly with wallets, exchanges, and dApps.

Your standard choice determines the technical debt you carry. ERC 20 is simple but inflexible: adding metadata or unique IDs later requires a new contract and token migration. ERC 721 locks you into per token gas costs that hurt high volume projects. ERC 1155 introduces complexity in batch logic and operator approval that increases audit scope. Select based on your current requirements and anticipated growth. If uncertainty exists, prototype with ERC 20 for fungible tokens and ERC 721 for NFTs separately, then migrate to ERC 1155 if batch operations become a bottleneck. Ethereum Token trends show increasing ERC 1155 adoption in gaming and DeFi as teams optimize for gas efficiency.

Frequently Asked Questions

Q1.What is the main difference between ERC-20 and ERC-721 token standards?

A1.

ERC-20 defines fungible tokens where each unit is identical and interchangeable, tracked by mapping addresses to balances. ERC-721 creates non-fungible tokens (NFTs) where each token has a unique identifier and distinct ownership, using a tokenId to owner mapping. ERC-20 uses transferFrom with amount parameters; ERC-721 transfers specific tokenIds. This architectural split means ERC-20 suits currencies or utility tokens, while ERC-721 handles unique assets like collectibles or property deeds.

Q2.When should I use ERC-1155 instead of ERC-20 or ERC-721 for my project?

A2.

Choose ERC-1155 when you need both fungible and non-fungible tokens in one contract, or when batch operations matter. Gaming projects benefit most: one contract manages currencies, consumables, and unique items. The standard’s safeBatchTransferFrom lets you move multiple token types in a single transaction, slashing gas costs by 60 to 80 percent versus separate ERC-20 and ERC-721 calls. If your use case involves only one token type with no batching, stick with simpler standards.

Q3.How do gas costs compare across ERC-20, ERC-721, and ERC-1155 token transfers?

A3.

ERC-20 transfers cost roughly 50,000 to 65,000 gas for basic implementations. ERC-721 transfers run 80,000 to 120,000 gas due to ownership mapping updates and approval checks. ERC-1155 single transfers use similar gas to ERC-721, but batch transfers achieve massive savings: transferring ten items costs around 150,000 gas total versus 800,000+ for ten separate ERC-721 calls. The safeBatchTransferFrom function amortizes fixed costs across multiple token IDs, making ERC-1155 superior for bulk operations.

Q4.What are the most common security vulnerabilities in ERC-20 token implementations?

A4.

Reentrancy during transfer hooks, missing return value checks (some tokens return false instead of reverting), and approve/transferFrom race conditions top the list. The approve frontrunning attack lets spenders exploit allowance changes by watching the mempool. Integer overflow bugs plagued pre-Solidity 0.8 contracts without SafeMath. Unchecked external calls to token contracts can fail silently. Always validate return values, use increaseAllowance instead of raw approve, implement Checks-Effects-Interactions pattern, and test against weird ERC-20 variants like USDT that omit return booleans.

Q5.Can I combine multiple token standards in a single Ethereum smart contract?

A5.

Yes, a contract can implement multiple interfaces simultaneously by inheriting from several standard contracts and managing separate state variables for each. You might track ERC-20 balances in one mapping while maintaining ERC-721 tokenId ownership in another. The contract must implement all required functions for each standard and emit corresponding events. Gas overhead increases with complexity. Ensure function selectors do not collide and consider using ERC-1155 instead, which natively supports multi-token types with better efficiency than manually combining standards.

Q6.How does metadata storage work differently in ERC-721 versus ERC-1155 tokens?

A6.

ERC-721 uses tokenURI(uint256 tokenId) returning a distinct URI per token, typically pointing to IPFS or centralized servers with JSON metadata. Each NFT can have completely unique metadata structures. ERC-1155 uses uri(uint256 id) with a template string containing {id} placeholder, expecting clients to substitute the token ID. This pattern assumes metadata follows a consistent schema across token types, reducing on-chain storage. ERC-1155 saves gas by storing one base URI, but sacrifices per-token flexibility unless you override uri per ID.

Explore Services

Reviewed by

Naman Singh profile photo

Naman Singh

Co-Founder & CEO, Nadcab Labs

Naman Singh is the Co-Founder and CEO of Nadcab Labs, where he drives the company’s vision, global growth, and strategic expansion in blockchain, fintech, and digital transformation. A serial entrepreneur, Naman brings deep hands-on experience in building, scaling, and commercializing technology-driven businesses. At Nadcab Labs, Naman works closely with enterprises, governments, and startups to design and implement secure, scalable, and business-ready Web3 and blockchain solutions. He specializes in transforming complex ideas into high-impact digital products aligned with real business objectives. Naman has led the development of end-to-end blockchain ecosystems, including token creation, smart contracts, DeFi and NFT platforms, payment infrastructures, and decentralized applications. His expertise extends to tokenomics design, regulatory alignment, compliance strategy, and go-to-market planning—helping projects become investor-ready and built for long-term sustainability. With a strong focus on real-world adoption, Naman believes in building blockchain solutions that deliver measurable value, solve practical problems, and unlock new growth opportunities for organizations worldwide.