Smart Contract Utilities with ZeppelinOS: Deploying to Mainnet

In previous tutorials, we used our local development environment for testing. This tutorial describes how to change your code so that you can deploy to the Etehreum mainnet.

The first step is to install the truffle hdwallet provider. The wallet allows you to sign (authenticate) transactions.

Note: You must install the wallet in every project.

npm install truffle-hdwallet-provider

Next use Infura to gain access to a network node, you need to register for an account. Infura allows the user to remotely attach to a node on the network and run their application. Otherwise the user has to run the node on their computer.

Once signed in, create a new project and from the Endpoint drop down select mainnet or one of the test networks depending on where you want to deploy. Write down the project ID because we need it in a couple of steps.

Now we have a node and a wallet but we need an account to join the two together. Install Metamask, which allows you to create an account where you can store funds, run dApps, and sign transactions. Upon creation of your account you are given a mnemonic, aka secret phrase associated with your account. We will use this mnemonic later.

Now that you have your mnemonic, project ID, and account we can make changes to the configuration file. In the truffle-config.js file add the following: