Deploy your own ERC-20

As of now, you can find more than 350,000 tokens circulating on Ethereum. The ERC-20 standard was created by Fabian Vogelsteller and Vitalik Buterin in 2015. It allows you to create your own currency in a few lines of code.

Julien Béranger
2 min readJan 20, 2021

My Stupid Token (MyStupidToken.sol) is a template of a basic ERC-20 token. It uses the set of Solidity contracts provided by OpenZeppelin (here).

It’s one of the safest existing way to create a digital asset that can’t be counterfeited. Once the contract is deployed, all the supply is sent to your own address. We will deploy this contract on the Goerli network, which is an Ethereum testnet.

MyStupidToken.sol:

// SPDX-License-Identifier: GPL-3.0pragma solidity >=0.6.0 <0.8.0;import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol";contract MyStupidToken is ERC20
{
constructor() ERC20("My Stupid Token", "MST")
{
_mint(msg.sender, 10000*10**18);
}
}

Here’s how to deploy it using Remix IDE:

  • Copy the piece of code above, and go to Remix, click on ‘New File’ (you’ll rename it later), paste your code here, change the name (‘My Stupid Token’) and the 3 letters (‘MST’), and change the supply (10000).
  • Then in the file explorer (on the left), do a right click on your file and select ‘rename’. Make sure each word of your ‘.sol’ file name starts with a capital letter.
  • In the left menu, click on ‘Solidity Compiler’ (you can use the version 0.7.4), then click on the big ‘Compile’ button.
  • In the left menu again, click on ‘Deploy & run transactions’ and select ‘Injected Web3’ as ‘environment’.
  • In Metamask (Chrome extension), make sure you’ve selected the Goerli Network.
  • Click on ‘Deploy’. Copy the address of this contract.

The token contract is now deployed on Goerli network, which also means that you currently have 100% of the supply in your wallet. You can check what’s happening on the (Goerli) blockchain thanks to Etherscan:

https://goerli.etherscan.io/

Add a custom token in Metamask

Let’s add your token in Metamask:

  • In Metamask, click on the left menu.
  • At the bottom of the window, click on ‘Add a token’.
  • Select ‘Custom token’, in ‘Token contract address’, paste the address of your contract, fill the ‘Symbol’ field with the three letters, and put ‘18’ in the ‘Decimals’ field.
  • Click on ‘Next’.

--

--

Julien Béranger

DevRel at Arthera | Member of the W3HC | Co-founder of Āto | Founder of Strat | Volunteer at Emmaüs Connect