Skip to content

Truffle box configured to create an ERC20 token using Open Zeppelin smart contracts library and deploy on Goerli network.

License

Notifications You must be signed in to change notification settings

solangegueiros/sol-token-box

Repository files navigation

Ethereum Truffle Token Box

Truffle box configured to create an ERC20 token using Open Zeppelin smart contracts library and deploy on Görli or Kovan Ethereum testnet network.

Tutorials

Requirements

There are a few technical requirements before we start. To use Truffle boxes, you need to have installed in your computer:

  • Git
  • a POSIX compliant shell
  • cURL
  • Node.js and NPM
  • a code editor

Truffle framework

Once you have those requirements installed, you only need one command to install Truffle. It is better to do it globally:

npm install -g truffle

Installation

  1. Create a new folder. For example, create the folder mytoken. Navigate to the folder in the terminal.
mkdir mytoken
cd mytoken
  1. Run the unbox command. This also takes care of installing the necessary dependencies and it can take some time.
truffle unbox solangegueiros/eth-token-box

Compile

Compile the smart contract.

truffle compile

Test

This Truffle box also comes with the file TestToken.js which include some examples for testing the smart contract. You can check it out in the test folder.

There are many other tests which can be done to check an ERC20 token.

Run this command on terminal:

truffle test

Requirements to deploy on a network

Before you deploy on a network, you need:

  • A wallet with enought ETH to deploy
  • An account at infura

Setup an account

  1. Create a wallet

The easy way to setup an account is using a web3 wallet injected in the browser

Copy your mnemonic (seed phrase or backup words)

  1. Create an account at infura
    • Create a project, selecting Ethereum network.
    • Copy the project ID

Create .env

Make a copy of .env.example and named .env, located in the folder project.

Update your MNEMONIC and RPC_URL in .env

Save .env file.

Deploy on Görli - Ethereum testnet network

Görli Testnet

Get ETH on Görli

Select the Goerli Network in the web wallet.

  1. Get some ETHs - Faucets

Connect to Görli

Run the Truffle development console

truffle console --network goerli

Test the connection to Görli network

Run this commands in the Truffle console:

Block number

Shows the last block number.

(await web3.eth.getBlockNumber()).toString()

Network ID

To get the network ID, run this command:

(await web3.eth.net.getId()).toString()

The Görli network ID is 5.

Exit the Truffle console:

.exit

Deploy / migrate the smart contract.

truffle migrate --network goerli

The migrate process in a real blockchain takes more time, because Truffle creates some transactions which need to be mined on the blockchain.

About

Truffle box configured to create an ERC20 token using Open Zeppelin smart contracts library and deploy on Goerli network.

Topics

Resources

License

Stars

Watchers

Forks