Skip to content

node of the decentralized oracle network, bridging on and off-chain computation

License

Notifications You must be signed in to change notification settings

Jeiwan/chainlink

 
 

Repository files navigation

ChainLink Maintainability Travis-CI Join the chat at https://gitter.im/smartcontractkit-chainlink/Lobby GoDoc

ChainLink is middleware to simplify communication with blockchains. Here you'll find the ChainLink Golang node, currently in alpha. This initial implementation is intended for use and review by developers, and will go on to form the basis for ChainLink's decentralized oracle network. Further development of the ChainLink Node and ChainLink Network will happen here, if you are interested in contributing please see our contribution guidelines. The current node supports:

  • easy connectivity of on-chain contracts to any off-chain computation or API
  • multiple methods for scheduling both on-chain and off-chain computation for a user's smart contract
  • automatic gas price bumping to prevent stuck transactions, assuring your data is delivered in a timely manner
  • push notification of smart contract state changes to off-chain systems, by tracking Ethereum logs
  • translation of various off-chain data types into EVM consumable types and transactions
  • easy to implement smart contract libraries for connecting smart contracts directly to their preferred oracles
  • easy to install node, which runs natively across operating systems, blazingly fast, and with a low memory footprint

Examples of how to utilize and integrate Chainlinks can be found in our Hello Chainlink repository.

Install

  1. Install Go 1.9+, and add your GOPATH's bin directory to your PATH
  2. Install dep: $ brew install dep
    or $ go get -u github.com/golang/dep/cmd/dep
  3. Download ChainLink: $ go get -d github.com/smartcontractkit/chainlink && cd $GOPATH/src/github.com/smartcontractkit/chainlink
  4. Install: $ make install
  5. Run the node: $ chainlink help

Ethereum Node Requirements

In order to run the ChainLink node you must have access to a running Ethereum node with an open websocket connection. Any Ethereum based network will work once you've configured the chain ID. Ethereum node versions currently tested and supported:

Run

To start your ChainLink node, simply run:

$ chainlink node

By default this will start on port 6688, where it exposes a REST API.

Once your node has started, you can view your current jobs with:

$ chainlink jobs

View details of a specific job with:

$ chainlink show $JOB_ID

To find out more about the ChainLink CLI, you can always run chainlink help.

Check out the wiki's pages on Adapters and Initiators to learn more about how to create Jobs and Runs.

Configure

You can configure your node's behavior by setting environment variables which can be, along with default values that get used if no corresponding environment variable is found:

LOG_LEVEL                Default: info
ROOT                     Default: ~/.chainlink
PORT                     Default: 6688
USERNAME                 Default: chainlink
PASSWORD                 Default: twochains
ETH_URL                  Default: ws://localhost:8546
ETH_CHAIN_ID             Default: 0
ETH_GAS_BUMP_THRESHOLD   Default: 12
ETH_MIN_CONFIRMATIONS    Default: 12
ETH_GAS_BUMP_WEI         Default: 5000000000  (5 gwei)
ETH_GAS_PRICE_DEFAULT    Default: 20000000000 (20 gwei)

When running the CLI to talk to a ChainLink node on another machine, you can change the following environment variables:

CLIENT_NODE_URL          Default: http://localhost:6688
USERNAME                 Default: chainlink
PASSWORD                 Default: twochains

External Adapters

External adapters are what make ChainLink easily extensible, providing simple integration of custom computations and specialized APIs. A ChainLink node communicates with external adapters via a simple REST API.

For more information on creating and using external adapters, please see our external adapters page.

Development Setup

  • Install Go 1.10+
  • Set up a Go workspace(~/go given as an example directory) and add go binaries to your path:
$ mkdir ~/go && cd ~/go
$ export GOPATH=$(pwd)
$ export PATH=$PATH:$GOPATH/bin
$ go get -u github.com/golang/dep/cmd/dep
  • Clone the repo:
$ git clone https://github.com/smartcontractkit/chainlink.git $GOPATH/src/github.com/smartcontractkit/chainlink
  • Install dependencies:
$ cd $GOPATH/src/github.com/smartcontractkit/chainlink
$ dep ensure
  • Run:
$ go run main.go

Build your current version

$ go build -o chainlink
  • Run the binary:
$ ./chainlink

Test

$ cd $GOPATH/src/github.com/smartcontractkit/chainlink
$ go test ./...

Solidity Development

  1. Install Yarn
  2. Install the dependencies:
$ cd $GOPATH/src/github.com/smartcontractkit/chainlink/solidity
$ yarn install
  1. Run tests:
$ truffle test

Development Tips

For more tips on how to build and test ChainLink, see our development tips page.

Contributing

ChainLink's source code is licensed under the MIT License, and contributions are welcome.

Please check out our contributing guidelines for more details.

Thank you!

About

node of the decentralized oracle network, bridging on and off-chain computation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 93.5%
  • JavaScript 6.0%
  • Other 0.5%