Skip to content

Development Setup Guide

Thomas edited this page Jun 27, 2018 · 43 revisions

The Complete Setup Guide for a Chainlink Development Environment

Install Go, Git, developer tools, Python (2.7), curl

Debian-based Linux (Ubuntu, Mint, etc.)

$ sudo apt install -y git build-essential python curl golang-go

Red Hat-based Linux (CentOS, Fedora, etc.)

$ sudo yum groupinstall -y 'C Development Tools and Libraries' 
$ sudo yum install -y git python curl golang-go

Mac OSX

$ brew install git curl golang

Windows-based environments can follow the instructions here.

After this point, instructions should be general for any *nix flavored operating system.

Install Node.JS

Install Yarn & Truffle with npm

$ npm install -g truffle
$ npm install -g yarn

Install Docker for Mac or Docker CE (follow instructions on site)

Linux: Add your $USER to the docker group
$ sudo gpasswd -a $USER docker
$ su $USER # Or log out and log back in

Ensure you have the latest Go

Setup paths
$ mkdir ~/go
$ export GOPATH=~/go
$ export PATH=$PATH:/usr/local/go/bin:~/go/bin
Optionally save these paths to your profile
$ echo "GOPATH=$GOPATH" >> ~/.bashrc
$ echo "PATH=$PATH" >> ~/.bashrc

Install Dep

$ go get -u github.com/golang/dep/cmd/dep

Download Chainlink and enter the directory

$ go get -d github.com/smartcontractkit/chainlink
$ cd $GOPATH/src/github.com/smartcontractkit/chainlink

Install

$ make install

At this point, you can import a keystore file if you need.

Run the DevNet image (in a new window)

$ ./internal/bin/devnet

Deploy the contracts

$ yarn install
$ cd solidity
$ truffle migrate --network development

(Optional) Connect to the local Devnet blockchain

$ truffle console --network development

You can use the Truffle Console to interact with the deployed contracts:

truffle(Development)> GetterSetter.deployed().then(con => con.getUint256())
truffle(Development)> GetterSetter.deployed().then(con => con.setUint256(45))
truffle(Development)> GetterSetter.deployed().then(con => con.getUint256())

Start the Chainlink node for development (in a new window)

$ ./internal/bin/cldev

When interacting with the running node, you will need to have your USERNAME and PASSWORD environment variables set. We use direnv to automatically set these per-directory.

You can manually set them by running

$ export USERNAME=chainlink
$ export PASSWORD=twochains

You can now add JobSpecs

$ chainlink c internal/fixtures/web/hello_world_job.json

View JobSpecs

$ chainlink s $JOBID

Start JobRuns

$ chainlink r $JOBID
Clone this wiki locally