How to install and execute Truffle on an Ubuntu 16.04

ABHISHEK KUMAR
2 min readAug 2, 2018

--

Truffle is a development environment, testing framework and asset pipeline for Ethereum, aiming to make life as an Ethereum developer easier.
See details on truffle website: http://truffle.readthedocs.io/en/latest/

This was made on an Ubuntu 16.04

Installation

Install packages

First, update and install packages

sudo apt-get update && sudo apt-get -y upgrade
sudo apt-get -y install curl git vim build-essential

Install NodeJs

Install NodeJs to execute the DAPP

sudo apt-get install curl software-properties-common
curl -sL https://deb.nodesource.com/setup_10.x | sudo bash -
sudo apt-get install nodejs

Install Truffle

Install Truffle packages

sudo npm install -g truffle

Install testrpc

Testprc uses ethereumjs to simulate full client behavior and make developing Ethereum
Install testrpc

#  sudo npm install -g  ganache-cli
# ganache-cli

Create a project

Init Truffle project

# mkdir myproject
# cd myprojet/
# truffle init
# truffle compile

Deploy contracts

testrpc should be launched
Deploy contracts on local chain

# truffle migrate

It should launch transaction on testrpc process output

Listening on localhost:8545
eth_accounts
eth_sendTransaction
Transaction: 0xc1cbc63cd0644604bc41ebbd9bd9998ce14f5ae2b27cb2e2d3fc5ce823574e62
Contract created: 0xbbdef31b721512c7c9bc05a00e8c24fa4e15e1f6
Gas usage: 139321
Block Number: 0x01

And run migration
Running migration: 1_initial_migration.js
Deploying Migrations...
Migrations: 0xbbdef31b721512c7c9bc05a00e8c24fa4e15e1f6

Create DAPP

To build your frontend, run:

# truffle build

Launch server for DAPP testing

# truffle serve

Output should display

Serving app on port 8080...
Rebuilding...
Completed without errors

Optional: add -p option to change port

Go to http://localhost:8080 to see the Dapp
You can send Metacoin to an address (ex: 0x2742c08e81208d01ff48a8c0f7d7c738625f92f5 as see above from testrpc)
Each transactions are displayed on the testrpc process output

--

--

ABHISHEK KUMAR

DevOps/Cloud | 2x AWS Certified | 1x Terraform Certified | 1x CKAD Certified | Gitlab