-
Notifications
You must be signed in to change notification settings - Fork 2k
Development Tips
We have a repo of example apps, Hello ChainLink, that you may find useful when developing apps that use ChainLink.
In order to make it easy to develop locally with Ethereum, we have packaged up an Ethereum development network in a docker node, and pre-funded an account for your development ChainLink node.
In order to use devnet:
- Install Docker
- Add
internal/binto your path via direnv (Optional, alternatively prefix all{devnet,cldev}commands with./internal/bin) - Open a new window and start the network:
$ ./devnet- Deploy the related contracts:
$ cd solidity && truffle migrate --network devnet- Run your local version of ChainLink against devnet:
./cldev node- Open a new window and explore devnet via a truffle console:
$ cd solidity && truffle console --network devnetGeth needs to be invoked with websockets enabled. An example of how to do this is:
geth --light --ws --wsaddr 127.0.0.1 --wsport 8546 --wsorigins "*"This would make Geth listen on ws://127.0.0.1:8546 and accept all incoming connections. Alternatively, you could change the --wsorigins parameter to 127.0.0.1 as well to only accept local connections.
We use direnv to set up PATH and aliases
for a friendlier developer experience. Here is an example .envrc that we use:
$ cat .envrc
export ROOT=tmp/.chainlink
PATH_add internal/bin
PATH_add solidity/node_modules/.bin
PATH_add tmpDirenv can be installed by running
$ go get -u github.com/direnv/direnvEnvironment variables that can be set in .envrc, along with default values that get used if no corresponding enviornment 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
CLIENT_NODE_URL Default: http://localhost:6688
ETH_MIN_CONFIRMATIONS Default: 12
ETH_GAS_BUMP_THRESHOLD Default: 12
ETH_GAS_BUMP_WEI Default: 5000000000 (5 gwei)
ETH_GAS_PRICE_DEFAULT Default: 20000000000 (20 gwei)
Use grc to colorize your test output and make it more readable.
The following is a list of dependencies that need to be installed on the host machine, categorized by role.
- Go
- gcc (for secp256k1 in go-ethereum)
- Docker
- Node.js & npm
- Yarn
- Truffle