The crypto universe is quickly expanding with the rise of decentralized finance (DeFi) and Web3 ecosystems. At the core, many of these technologies rely on the Ethereum network and ERC-20 tokens. And as a result, entrepreneurs or businesses looking to get involved with crypto should learn how to create and deploy their own ERC-20 tokens.
Let’s take a high-level look at how ERC-20 smart contracts and tokens work and different options to consider for launching your project.
What is an ERC-20 Token?
Ethereum’s ERC-20 standard enables developers to build interoperable token applications. These tokens can represent nearly anything in Ethereum, from physical assets to reputation points. But, unlike non-fungible tokens (NFTs), ERC-20 tokens have a property that makes them the same as another token in both type and value.
Under the hood, the ERC-20 standard implements an API for tokens within smart contracts, including specific methods and events. These methods and events help define the token (e.g., the name and symbol) and provide methods for tasks like determining the total supply, transferring between addresses, or looking up a wallet’s balance.
There are countless examples of ERC-20 tokens:
- Stablecoins – Tether USD (USDT) and other stablecoins offer a stable source of value on the blockchain.
- Utility Tokens – Binance Coin (BNB) and other utility tokens pay for transactions or other benefits to the user.
- DeFi Tokens – Uniswap (UNI) and other DeFi tokens facilitate trading or lending activities.
Creating Tokens from Scratch
You can build ERC-20 smart contracts in Solidity using the Ethereum Remix IDE. Under the “contracts” directory, simply create a new file called “token.sol” and write your Solidity script. The file’s contents will depend on your ERC-20 token’s purpose and goals, but every ERC-20 token requires at least a base set of constants, methods, and events.
- string public constant name;
- string public constant symbol;
- uint8 public constant decimals;
- function totalSupply() public view returns (uint256);
- function balanceOf(address tokenOwner) public view returns (uint);
- function allowance(address tokenOwner, address spender) public view returns (uint);
- function transfer(address to, uint tokens) public returns (bool);
- function approve(address spender, uint tokens) public returns (bool);
- function transferFrom(address from, address to, uint tokens) public returns (bool);
- event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
- event Transfer(address indexed from, address indexed to, uint tokens);
Once you’ve written the script, you click on the “compiler” tab on the left and then click the “compile” button. If there aren’t any errors, you can deploy the smart contract by clicking on the “deploy” tab and then clicking the “deploy” button. Finally, you’ll see the contract address after a successful deployment, showing where you can interact with it.
Note: Most professional smart contract developers use tools like Truffle rather than the Remix IDE to build and deploy smart contracts.
Using Third-Party Platforms
Non-technical or front-end-focused individuals may prefer to use done-for-you tools to create and deploy ERC-20 smart contracts.
Non-technical individuals looking for a simple token can use simple services to build them at a relatively low cost. For example, Create My Token makes it easy to connect your crypto wallet and create customizable ERC-20 smart contracts in minutes. But, of course, these solutions are less flexible regarding business logic.
If you’re an application developer that wants to incorporate token economics, consider a Blockchain Backend as a Service platform like Bunzz. They provide ready-made ERC-20 contracts for ICOs, tokens, and DeFi projects. Once deployed, you can connect a front-end application using a simple SDK to interact with the contract.
If you have a more complex use case, many enterprise software development companies specialize in developing smart contracts in Solidity using platforms like Truffle. They can handle building a back-end smart contract, while you can use open-source tools, like the Web3JS library, to interact with the smart contract.
ERC-20 tokens are subject to the same tax rules and regulations as other cryptocurrencies, like Bitcoin or Ethereum.
Anyone creating ERC-20 smart contracts must pay gas fees (usually around 30,000 gas) when adding them to the blockchain. You may also have to pay gas fees for contract storage and execution. And when you sell ETH to pay gas fees, you will owe capital gains taxes on any appreciation in the ETH over your cost basis.
If you sell ERC-20 tokens as part of a crowdfunding effort or as a utility token, you will also owe capital gains or ordinary income taxes on the sale, depending on the situation. For instance, if you sell a utility token and provide a service in exchange, you may owe ordinary income taxes since you’re providing a service to a customer.
If you transact in ERC-20 tokens, ZenLedger can help you aggregate transactions across exchanges, compute your capital gain or loss, and complete the IRS forms you need each year. Get started for free!
The Bottom Line
ERC-20 smart contracts and tokens are a central part of the crypto ecosystem, supporting everything from stablecoins to DeFi protocols. If you’re interested in creating your own tokens, you have several options depending on your business use case, technical skill sets, and other criteria.