Skip to content

Windows Development Setup

Thomas edited this page May 8, 2018 · 5 revisions

This guide is meant to give developers on Windows a starting point for Chainlink development.

Install Chocolatey

Chocolatey allows for simple package management on Windows (similar to apt and yum for Linux). In an elevated PowerShell prompt, run:

C:\> choco install -y mingw make git python2 curl nodejs golang yarn

After this point, Windows commands should be ran from a normal (non-administrative) PowerShell prompt.

Install and Configure Docker

Setting up Docker on Windows is out of scope for this guide. Docker requires Windows 10 Pro or Enterprise to install.

Alternatively, you can run Parity directly in an elevated PowerShell prompt, but you will need to invoke it as parity.exe --config miner.toml, and you will need the required DevNet files.

Setup Paths

C:\> mkdir $env:USERPROFILE\go\bin
C:\> [Environment]::SetEnvironmentVariable("GOPATH", "$env:USERPROFILE\go", "User")
C:\> [Environment]::SetEnvironmentVariable("PATH", "C:\tools\mingw64\bin;$env:ProgramFiles\Docker\Docker\Resources\bin;$env:USERPROFILE\go\bin;$env:APPDATA\npm;$env:Path", "User")

Close and re-open Powershell.

Install Truffle

C:\> npm install -g truffle

Install Dep

C:\> go get -u github.com/golang/dep/cmd/dep

Download Chainlink and enter the directory

C:\> go get -d github.com/smartcontractkit/chainlink
C:\> cd $env:GOPATH\src\github.com\smartcontractkit\chainlink

Install

C:\> dep ensure
C:\> go install

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

Run the DevNet image (in a new window)

C:\> docker run -p 18545:8545 -p 18546:8546 smartcontract/devnet:latest

Deploy the contracts

C:\> cd solidity
C:\> yarn install
C:\> truffle migrate --network devnet

(Optional) Connect to the local Devnet blockchain

C:\> truffle console --network devnet

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

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

Save environment variables

Go to System > Advanced system settings > Environment Variables

Add the following variables under System Variables

Variable name Variable value
LOG_LEVEL debug
ROOT $env:GOPATH\src\github.com\smartcontractkit\chainlink\internal\devnet
ETH_URL ws://localhost:18546
ETH_CHAIN_ID 17
TX_MIN_CONFIRMATIONS 2
USERNAME chainlink
PASSWORD twochains

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

C:\> chainlink node -d -p "T.tLHkcmwePT/p,]sYuntjwHKAsrhm#4eRs4LuKHwvHejWYAC2JP4M8HimwgmbaZ"

You can now add JobSpecs (after setting the $USERNAME and $PASSWORD variables in the other window)

C:\> chainlink c internal/fixtures/web/hello_world_job.json

View JobSpecs

C:\> chainlink s $JOBID

Start JobRuns

C:\> chainlink r $JOBID
Clone this wiki locally