Key Differences
Learn the key differences between native tokens and ERC20 tokens on Avalanche L1s
Before moving forward, and now that we have seen both, it's crucial to understand the fundamental differences between native tokens and ERC20 tokens. Each has distinct characteristics that affect how they function within your blockchain ecosystem.
Key Differences
Feature | ERC20 | Native |
---|---|---|
Defined By | Smart Contract Deployer | Protocol Level |
Balance Storage | Mapping in contract storagemapping(address => balance) | EVM Account stateaccount.balance |
Transfer Logic | Handled by contract functionstransfer() , transferFrom() | Handled by EVM opcodesCALL , SELFDESTRUCT |
Smart Contract Awareness | Built-in hooks for DeFi compatibility Allows programmatic approvals (e.g., Uniswap, Aave) | Can't call functionsapprove() , transferFrom() |
Receiving in Functions | No special modifier neededfunction deposit(token, amount) | Requires payable modifierfunction deposit() payable |
The Protocol Limitation
One critical limitation of native tokens is that protocols cannot "pull" native tokens from your wallet using transferFrom()
. This fundamental difference impacts how DeFi protocols interact with native tokens.
Real-World Example: Aave Lending
Let's look at how supplying ETH (a native token) to Aave works:
- Wrap it into WETH - Convert native ETH to ERC20 WETH
- Call
approve()
- Give Aave permission to spend your WETH - Aave calls
transferFrom()
- Aave pulls the WETH from your wallet - You receive aTokens - Start earning interest and can borrow against your deposit
Why ERC20 Standardization Matters
The main advantage of ERC20 tokens is standardization. Without it:
- You could build a
deposit()
payable function for native tokens - But then you'd have two different logics for depositing tokens
- This creates complexity and potential security issues
Is this guide helpful?