Crypto Smart-Contract

Create Your Own Ethereum Token

In this short tutorial, we will be creating a crypto (ERC-20) token. This is similar to any token on the Ethereum network such as USDC, USDT, Shiba-Inu, etc. We will be deploying the token on Mumbai — a polygon’s test network — but can be deployed on any Ethereum (EVM) compatible network.

To fast-track the development we will be using a Linux Docker that contains a truffle environment ready to use. The token that we will be deploying is named CoffeeToken (CTK), feel free to rename it.

Finally, we will only show how to add the token to Metamask and send or receive it. In the following article, we will cover deploying the token on a decentralized exchange, meanwhile, feel free to google “deploying ERC-20 token” if needed.

Copyright Ivan Radic


cd <to your workspace>
docker run -it -v$(pwd):$(pwd) amine2029/truffle
git clone
npm install openzeppelin-solidity@2.5
npm install @truffle/hdwallet-provider
truffle compile
# put mnemonic in “.secret”
truffle deploy --network=mumbai

Detailed Steps

1. Create a folder as a workspace


2. Run truffle Docker

docker run -it -v$(pwd):$(pwd) amine2029/truffle

This command will run a docker containing a working Truffle environment. Note: The “-v” option will make the current directory (WORKSPACE_PATH) accessible from both inside the docker and outside.

3. Get the source code (and edit it if needed):

git clone

The code source contains a token name CoffeToken (CTK), to rename it edit the file under ./contracts/ and ./migrations/

4. Install dependencies

npm install openzeppelin-solidity@2.5npm install @truffle/hdwallet-provider

5. Create an address

To create an address, we will use Metamask. Just download the extension and create an account while writing down the mnemonic. This mnemonic is to be put in the “.secret” file under the folder pointed by WORKSPACE_PATH.

6. Load the address with some Matic tokens

We will be using Mumbai, one of Polygon’s most popular test networks. So the first thing to do is to connect your Metamask to Mumbai. We will use Chainlist to establish the connection. Toggle “Tesnets” at the top and search for “mumbai”.

Once connected to the network, request some tokens from the faucet. The faucet should give you 0.5 Matic. This should cover the deployment of the token’s contract which is around ~0.004 Matic.

7. Compile and deploy

Now we will compile and deploy our token.

truffle compile

For the next step please put the mnemonic in “.secret”. See step 5.

truffle deploy --network=mumbai
truffle-deploy output example

Please note the “contract address” as we will use it in the next step.

To deploy the token on other Ethereum (EVM) compatible networks, feel free to configure the truffle.js file and re-run the truffle-deploy command.

8. Load the token references into Metamask

To be able to send and receive the created token, we must add its references in Metamask first. Follow these three steps to configure Metamask:

Open Metamask and click on “import token”
Fill in the token’s contract address

Once the token is added, you can send some tokens to other Metamask accounts (or any address) as long as they are on the Mumbai test network! The receiver will also need to add the token’s contract address to see the received token.


There may be multiple scenarios where such a token can be useful. One of them may be to have a self-service coffee machine that is run with this created “virtual” token instead of real physical tokens. Another more popular scenario is to use such tokens to power a game such as Monopoly.

That’s it for today, feel free to clap and/or comment if you enjoyed the content. For further similar articles please do follow ;)



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store



Big fan of technology with a recent interest in finance following the rise of cryptocurrencies.