Truffle Configuration for the Ropsten Test Network

Truffle Configuration for the Ropsten Test Network#

Now that we have the Ropsten Ether in an account that we control and the Infura endpoint, let's continue updating our Truffle configuration to work with this new information. Recall that we had the following in place:

Let's update our .env file to add our blockchain private key. We will keep it a secret here so that we can use it later to send our smart contracts to the blockchain.

Now that our .env file is updated, we can start focusing on our truffle-config.js file. We will install the hdwallet-provider library from Truffle to import the private key securely into our truffle config file. It allows us to sign transactions with addresses that are derived from a 12 or 24 word mnemonic (or the private key that we have).

Run npm install @truffle/hdwallet-provider from the command line in your erc-20-token folder.

After installing, we can import the library into truffle-config.js.

const HDWalletProvider = require('@truffle/hdwallet-provider');

Our file now looks like this:


This page is a preview of Creating an ERC20 Token on Ethereum

No discussions yet