Plus: The Difference Between Coins and Tokens
In this article, I’ll explain:
- The difference between a coin (ETH, BTC, etc.) and a token (ERC721, ERC1155, ERC20, etc.)
- What it means to “send a token”
- Why you might not be receiving any USDC
1. Coins vs Tokens: Know The Difference
Coins and tokens are used interchangeably in crypto. But they’re fundamentally different.
Coins, such as Ether (ETH) or Bitcoin (BTC), are built directly into their unique blockchains (Ethereum and Bitcoin respectively). ETH facilitates actions and transactions on Ethereum; BTC facilitates actions and transactions on Bitcoin.
Tokens, on the other hand, are built on top of existing blockchains like Ethereum, and represent assets or utilities within a specific ecosystem. They abide by certain standards, which allow them to interact smoothly within the ecosystem. Importantly, tokens require smart contracts for transacting with specific tokens.
Here are some examples of token standards:
- ERC20: Standard for fungible tokens. Each token is identical to the next. A good example is the USDC (USD Coin), a stablecoin pegged to the US dollar.
- ERC721: Standard for non-fungible tokens (NFTs). Each token is unique and holds different value. Azuki digital collectibles are great examples of ERC721 tokens.
- ERC1155: A more advanced type of token, which can represent both fungible and non-fungible tokens within a single smart contract.
Section 2: The Process of Receiving a Token
Receiving a token like USDC isn't quite as simple as someone sending it over to you. Due to the smart contract's rules, the you play a crucial role in this process too.
Here's a simplified view of the process
- Paper - Sender sets your allowance: The sender calls the
approve()function on the USDC smart contract, specifying the number of tokens they want to send you.
- Your Smart Contract - You receive the tokens: You (the contract) calls the
transferFrom()function on the USDC (or any ERC20) smart contract, specifying the
msg.senderas the address to receive the tokens from.
- Token Contract - The USDC smart contract checks the allowance set by the sender, transfers the tokens from the sender's balance to your balance, and updates the allowance.
Remember, just as the post office wouldn't hand over a package to someone else, the smart contract ensures that only the specified recipient can claim the tokens.
What to do if you’re not receiving USDC
If you're facing issues with receiving USDC tokens, here are some actionable checks you can perform:
- Contract Interaction: Are you interacting with the right functions on the smart contract? Ensure you're calling the
transferFrom()function correctly in your mint method.
- Allowance: Have you checked if the sender (Paper) has set an allowance for the correct address? This address that is set by the sender must be the one receiving the USDC, and also the address with the function that calls the
transferFrom()method. Before you attempt to transfer (withdraw) the tokens, confirm that this has been done (you can see it by looking at recent transactions for the wallet calling your contract on the block explorer).
- Address Verification: Also, ensure that the allowance is set for the right receiving address. If the address you intend to receive the USDC from isn't the same as the one you registered on the contracts dashboard, this will cause a problem. A common example of this mismatch is if you registered a proxy contract in the dashboard or if the USDC receiving address is a safe wallet address. If this is the case, you can specify the receiving address in
mintMethod.payment.spenderas found here.
Distinguishing between coins and tokens and understanding the token transaction process is like leveling up in the crypto game. Tokens, like USDC, call for a bit more legwork—interacting with smart contracts—unlike their coin counterparts (think ETH or BTC). If USDC seems to be playing hard to get, consider giving contract interaction, allowance, and address verification a good once-over.