Deploy your Truffle smart contracts to the Live Network

You finished building your contract using the Truffle Framework and are done testing it on the test RPC and are ready to put it on the Ethereum main net to share it to the world? In this tutorial, we’ll cover what you need to deploy a contract to the Ethereum blockchain.

Setting Up Your Ethereum client

There are many Ethereum clients to choose from. The most popular are go-ethereum and cpp-ethereum. We’ll not cover how to install and configure the client as lot of documentation is available on the clients project page.

To deploy your contract to the blockchain you need that:

  • Your client is completely downloaded the blockchain data.
  • Your client is hosting an RPC server on localhost and is accessible by a port, for example: 8546
  • Your client has at least one account registered and have the rights to sign transactions for that account
  • The registered account contains enough Ethereum to deploy your contracts

Setting up your Truffle project

The next step is to tell Truffle how to communicate with our client. For this we will open and edit the truffle.js file at the root of your project. In the network array, we will add the information of our live configuration which specifies the name of the network, the port and the address used to communicate with the client.

Save the file and we are now ready to deploy our project to the blockchain.

Deploying your smart contract

To deploy your smart contract, just open your terminal and type:

Truffle will run the command and will use your client registered address to publish the smart contract to the Ethereum blockchain.

Once your contract will be compiled and deployed, the address of the deployed contracts will be printed on your console. You can also find the address in the json files located in the build/contracts/YOUR_CONTRACT_NAME.json .


If you’re looking for people to thrust your contracts, it might be important to share and verify your contract code on Etherscan webiste.




Leave a Comment