-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNodeInstall
More file actions
129 lines (95 loc) · 6.44 KB
/
NodeInstall
File metadata and controls
129 lines (95 loc) · 6.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
Running a Chainlink Node
In this section, we'll explain the requirements and basics for running your own Chainlink node.
It's important to note that nodes can fulfill requests for open APIs out-of-the-box using our core Adapters without needing any additional configuration.
If you would like to provide data from an authenticated API, you can add an external adapter to enable connectivity through the Chainlink node.
Hardware requirements are light. The only heavy part is you'll need a blockchain node connection. If you use a 3rd party (defined below), you can use a machine with as little as 10GB of storage and 2GB of RAM.
The Chainlink node is middleware, operating between the blockchain and external data. More information on our architecture is available here.
Using Docker
It's recommended to run the Chainlink node with Docker. This is because we continuously build and deploy the code from our repository on Github, which means you don't need a complete development environment to run a node.
Requirements
Docker-CE. Quick instructions for setting up Docker is below:
Amazon Linux 2
CentOS
Debian
Fedora
Ubuntu
sudo amazon-linux-extras install -y docker
sudo systemctl start docker
sudo gpasswd -a $USER docker
exit
# log in again
A fully synced Ethereum client with websockets enabled. Client specific instructions can be found below:
Run Geth
Run Parity
Use an external service
Create a Directory
Once you have your Ethereum client running and fully synced, you're ready to run the Chainlink node.
Create a local directory to hold the Chainlink data:
Rinkeby
Kovan
Mainnet
mkdir ~/.chainlink-rinkeby
Create an Environment File
Run the following as a command to create an environment file and populate with variables specific to the network you're running on. For a full list of available configuration variables, click here.
Rinkeby
Kovan
Mainnet
echo "ROOT=/chainlink
LOG_LEVEL=debug
ETH_CHAIN_ID=4
MIN_OUTGOING_CONFIRMATIONS=2
LINK_CONTRACT_ADDRESS=0x01BE23585060835E02B77ef475b0Cc51aA1e0709
CHAINLINK_TLS_PORT=0
SECURE_COOKIES=false
GAS_UPDATER_ENABLED=true
ALLOW_ORIGINS=*" > ~/.chainlink-rinkeby/.env
Set your Ethereum Client URL
🚧
Using an external Ethereum client?
If you're using a 3rd party service to connect to the blockchain, skip to the External Provider section to set the ETH_URL environment variable. We provide general guidance, but you will need to obtain the websocket connection string to add to your environment file.
Ethereum Client on the Same Machine
Next you need to get the URL for the Ethereum client. The command below will help you obtain the IP address of the container that your Ethereum client is running on. This will only work if you have started an Ethereum client on the same machine as your Chainlink node.
Local Ethereum Client IP
ETH_CONTAINER_IP=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' $(docker ps -f name=eth -q))
Then run the following command to add the Ethereum client's URL to your environment file. If you are using an external Ethereum client, use the External tab below, and update $ETH_CONTAINER_IP to the websocket address used for connectivity.
Rinkeby
Kovan
Mainnet
echo "ETH_URL=ws://$ETH_CONTAINER_IP:8546" >> ~/.chainlink-rinkeby/.env
Ethereum Client as an External Provider
If you are using an external provider for connectivity to the Ethereum blockchain or you are running an Ethereum client on a separate instance, you may use the command below for your network. Be sure to update the value for CHANGEME to the value given by your provider or the address and port of your separate instance.
Rinkeby
Kovan
Mainnet
echo "ETH_URL=CHANGEME" >> ~/.chainlink-rinkeby/.env
Set the Remote DATABASE_URL Config
You will need to connect your Chainlink node with a remote PostgreSQL database. See the Connecting to a Remote Database page for more information. Use the example below to configure your DATABASE_URL setting in your environment file, replacing $VARIABLES with their actual values.
$USERNAME: The database username (must be owner)
$PASSWORD: The user's password
$SERVER: The server name or IP address of the database server
$PORT: The port that the database is listening on
$DATABASE: The database to use for the Chainlink node
🚧
If you're testing you can add ?sslmode=disable to the end of your DATABASE_URL. However you should never do this on a production node.
Rinkeby
Kovan
Mainnet
echo "DATABASE_URL=postgresql://$USERNAME:$PASSWORD@$SERVER:$PORT/$DATABASE" >> ~/.chainlink-rinkeby/.env
For a primary/secondary Chainlink node architecture, you may also want to set the DATABASE_TIMEOUT configuration as well. Setting DATABASE_TIMEOUT to 0 allows a secondary node to wait for the lock to be released on the database indefinitely.
Rinkeby
Kovan
Mainnet
echo "DATABASE_TIMEOUT=0" >> ~/.chainlink-rinkeby/.env
Start the Chainlink Node
Now you can run the Docker image. Replace <version> with your desired version (current suggestion, 0.9.4. Tag versions are available in the Chainlink docker hub. The latest version does not work.
Rinkeby
Kovan
Mainnet
cd ~/.chainlink-rinkeby && docker run -p 6688:6688 -v ~/.chainlink-rinkeby:/chainlink -it --env-file=.env smartcontract/chainlink:<version> local n
📘
Local Database
If you're running a local database you may need to add --network host to the end of the command above.
The first time running the image, it will ask you for a password and confirmation. This will be your wallet password that you can use to unlock the keystore file generated for you. Then, you'll be prompted to enter an API Email and Password. This will be used to expose the API for the GUI interface. When running the node again, you can supply the -p option with a path to a text file containing the wallet key password, and a -a option, pointing to a text file containing the API email and password. Instructions on how to do that are here.
📘
You will need to send some ETH to your node's address in order for it to fulfill requests. You can view your node's ETH address when the node starts up or on the Configuration page of the GUI.
You can now connect to your Chainlink node's UI interface by navigating to http://localhost:6688. If using a VPS, you can create a SSH tunnel to your node for 6688:localhost:6688 to enable connectivity to the GUI. Typically this is done with ssh -i $KEY $USER@$REMOTE-IP -L 6688:localhost:6688 -N. A SSH tunnel is recommended over opening up ports specific to the Chainlink node to be public facing. See our Best Security and Operating Practices page for more details on how to secure your node.