Step by Step guide to deploy your first Ethereum contract in a private network

Andre Silva
Jun 6, 2017 · 2 min read

I’ve read alot about ethereum lately and finally decided to install and deploy my first smart contract. The Ethereum homepage is an excellent place to start with all the basic tutorials needed to get started.

Unfortunately my experience was not smooth, running into several different errors running my own private network as explained in those tutorials.

In the end what worked for me can be explained in a few simple steps that I will leave here. Hopefully it will be usefull to someone having the issues I had.

First you need to install and Ethereum Client, in this case Geth, running in your console:

brew tap ethereum/ethereum

brew install ethereum

Second we need to connect to a private testnet. The easiest way I found was to use ethereum option --dev pre-configured private network like this

geth --dev --datadir ~/EthereumTestNet

You can replace EthereumTestNet for any directory name you want. Leave this terminal running and in another terminal window connect to the network specifying the correct ipc path:

geth --dev attach ipc:/Users/<myaccount>/EthereumTestNet/geth.ipc

Again, replace <myaccount> and EthereumTestNet with the correct directory path. To test your private network, in the console on your new terminal window, you can simply create a new account like this

personal.newAccount(‘password’)

Now that you have your private network running you can use it to deploy your contract. The easiest way to build and deploy a smart contract is using the official Ethereum Wallet. Once installed you need to run it in a new terminal window (in applications folder) specifying again your private network ipc path

Ethereum\ Wallet.app/Contents/MacOS/Ethereum\ Wallet --rpc /Users/<myaccount>/EthereumTestNet/geth.ipc

The ethereum wallet application is launched with the PRIVATE-NET indication and the account created presented. In the section contracts you can deploy your first contract, for example creating your own crypto-currency.


Ever considered saving your coins safely in a hardware wallet? If you liked this story and don’t have it yet, please follow the link to buy the best one now -> shop trezor

Andre Silva

Written by

Full-time dad. Would like to have time to surf again.