Configuring Truffle to use the Goerli testnet

Eliott Teissonniere
Coinmonks

--

INFURA recently announced it implemented supports for the new and awesome Ethereum Görli testnet. Let’s see how to configure the Truffle framework to support it too.

Deploying sample contracts on Goerli from truffle

First you will have to create a project on infura.io in order to get an API KEY, here is my configuration:

Infura project

We then init a new NPM project for tracking dependencies:

NPM init

We can install truffle locally via npm install — save-dev truffle.

Then, we init our project:

npx truffle init

We can add some dependency (truffle-hdwallet-provider)to handle mnemonic seeds:

npm i — save-dev truffle-hdwallet-provider

Awesome! Now all we have to do is to had the following to the truffle-config.js file in the networks section.

And then we are good to go! If you need to deploy to the Görli testnet, just use something like MNEMONIC=”your seed” INFURA_API_KEY=”infura key” npx truffle migrate — network goerli.

And now for the easiest way: I made a truffle box to help you bootstrap any solidity project, it supports all the existing main and test networks with some nice additions! Check it out at https://github.com/ETeissonniere/TruffleStarter.

Get Best Software Deals Directly In Your Inbox

--

--