---
# System prepended metadata

title: Chainbridge Setup Guide

---

# Chainbridge Setup Guide

To setup a production chainbridge for zero.exchange we will need to setup:

1) an Avalanche node
2) an Ethereum node (optional)
3) a Chainbridge relayer

Skip sections 1 and 2 for now and just go to step 3

## 1) Setup Avalanche Node

The full guide can be found here: https://docs.avax.network/build/get-started

Once you have it running on your server, create a systemctl script with the following:

`vi /etc/systemd/system/`

and save the following script as avalanche.service:

```
[Unit]
Description=Avalanche node
After=network.target

[Service]
Type=simple
Restart=always
RestartSec=1
ExecStart=/root/avalanchego --public-ip=167.99.178.42 --http-port=9650

[Install]
WantedBy=default.target
```

This should ensure the avalanche node is always running, even after crashes or system reboots.

## 2) Optional: Run an Ethereum node

Currently, the setup uses infura.io or other ethereum node hosting providers for reliability.

## 3) Setup ChainBridge Relayer

Clone the repo and install dependencies

```
git clone https://github.com/zeroexchange/gondola
sudo apt update
sudo apt install make
sudo apt install build-essential
wget -c https://dl.google.com/go/go1.14.2.linux-amd64.tar.gz -O - | sudo tar -xz -C /usr/local
vi ~/.profile
export PATH=$PATH:/usr/local/go/bin
source ~/.profile
```

Configure chainbridge with the following commands:

```
make build
# Generate a new public/private key and make a note of the public address
cd build && ./chainbridge accounts import --privateKey <your ethereum private key here>
vi /build/config.json
```

Change the "from" field on both chains to the public key you just imported, and note the KEYSTORE_PASSWORD you just entered for the next step.

```
./build/chainbridge
```

then create a systemctl script with the following:

```
vi /etc/systemd/system/chainbridge.service
```

and save the following script as chainbridge.service: 

```
[Unit]
Description=Chainbridge Relayer

[Service]
User=root
TimeoutStartSec=0
Type=simple
KillMode=process
WorkingDirectory=/root/gondola/build
ExecStart=/root/gondola/build/chainbridge
Restart=always
RestartSec=2
Environment="KEYSTORE_PASSWORD=<your keystore password here>"

[Install]
WantedBy=multi-user.target
```

This should ensure the avalanche node is always running, even after crashes or system reboots.

```
systemctl enable chainbridge
systemctl start chainbridge
```

You can check if it is running properly with

```
journalctl -u chainbridge.service -b
```

## Run the services and confirm it is operating correctly

Run the Avalanche service:

```
systemctl enable avalanche
systemctl start avalanche
```

Test avalanche is running correctly with

```
curl -X POST --data '{
    "jsonrpc":"2.0",
    "id"     :1,
    "method" :"info.isBootstrapped",
    "params": {
        "chain":"X"
    }
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/info
```

this should return isBootstrapped: true in the json response (might take some time to get synced). Once this is true, run the chainbridge service:

