Erodotos / HELLO-ERC-20-TOKEN

A simple project on how to create an ERC-20 token using openzeppelin smart contracts

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A very basic ERC-20 Token

Table of contents

About

In this elementary stage project, we will be using OpenZeppelin, an open-source blockchain security product, to implement a very basic ERC-20 Token. OpenZeppelin provides developers a set of smart contracts that enables them to create and deploy secure and efficient code on a wide range of blockchains using Solidity.

My goal for this project is to deploy a functional ERC-20 token on Ethereum's test network "Ropsten" and use Metamask to send and receive tokens. You can have a complete code walkthrough on the related post on my website.

Technologies




Deployment

To deploy this project locally, we need to have installed on our local environment NodeJS and Truffle. Subsequently, we can proceed with applying the following commands.

$ git clone https://github.com/Erodotos/HELLO-ERC-20-TOKEN
$ cd HELLO-ERC-20-TOKEN
$ npm install

Additionally, we need to generate a new file with the name .env. In this file, we will be introducing some local variables that are required. For the moment, name a variable for the total supply of our token as shown below.

TOTAL_SUPPLY = 100000

After that, we need to get into the Truffle development console and deploy our smart contracts. The following commands shall do the work.

$ truffle develop
$ truffle(develop)> migrate
$ truffle(develop)> test

After running the last command, all code tests shall be passed, and we should receive the following result.

Contract: Token Test
    ✓ All tokens should be in the deployer's account (84ms)
    ✓ I can send tokens between accounts (203ms)
    ✓ It's not possible to send more tokens than account 1 has (537ms)
3 passing (1s)

Now we are ready to send and receive our token via Metamask wallet in the browser.

BONUS

To deploy the token on Ethereum's test network "Ropsten" you need to import your Metamask wallet in Truffle to deploy our smart contracts on "Ropsten."

Find your wallet's Secret Recovery Phrase as shown below and then copy it.

Afterward, go to our .env file, create a new variable with the name MNEMONIC, and paste your secret phrase. Furthermore, we need to access the network via an Ethereum Node. To do so you have to create an account into INFURA, create a project and get its ID into our .env file.

MNEMONIC = <secret phrase>
INFURA_PROJECT_ID = <infura project id>

Finally, execute the following command to deploy our smart contract on Ethereum's test network "Ropsten".

$ truffle(develop)> migrate --network ropsten

Demonstration\

Click on the Image/Link below to view the demonstration video.

Demo Video

About

A simple project on how to create an ERC-20 token using openzeppelin smart contracts


Languages

Language:JavaScript 80.5%Language:Solidity 19.5%