Actions

Optimism RPC endpoint

From Chainlink Community Wiki

Revision as of 16:50, 22 April 2022 by Devtrace (talk | contribs)
OptimismLogo.png

Optimism RPC endpoint details

This is a general guide on deploying an Optimism RPC endpoint for your Chainlink Node(s).
Official Optimism Docs are available here

NOTE

This document assumes base operating system is Debian 10

Optimism RPC endpoints:

You Chainlink node has two connections methods. Websocket and HTTP.

As these can vary between networks, the default values for an Arbitrum node are:

Websocket ws://<your_ip_address>:8546

HTTPhttp://<your_ip_address>:8545

Install Docker-CE & docker-compose

Install dependencies first.

sudo apt update && sudo apt upgrade && sudo apt-get install -y apt-transport-https ca-certificates curl gnupg2 software-properties-common Now, we'll need to get our aptitude sources updated to include the Docker-CE repository.

Now, we'll need to get our aptitude sources updated to include the Docker-CE repository.

These commands must be run as root.

sudo su

curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -

add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"Once we have added the repo and the necessary key, we want to exit the root user. exit

Once we have added the repo and the necessary key, we want to exit the root user. exit

NOTE

You should see your shell prompt displaying a $ if you're a non-root user. If you're in an elevated (root) TTY session, your shell prompt will display a #


Since we've modified our aptitude sources, we'll need to update them before we can install docker-ce

sudo apt update && sudo apt install docker-ce Now that we have Docker-CE installed, we'll need to add our user to the docker group.

Now that we have Docker-CE installed, we'll need to add our user to the docker group.

(The prevents us from having to run docker commands with elevated (root) permissions)

sudo usermod -aG docker $USER


Lastly, we'll install docker-compose

sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose


Next, we'll get our Optimism node deployed and synced.

Deploy Optimism RPC Node

With docker and docker-compose installed, we're good to get our Optimism Node deployed.

First, we'll clone the Optimism repository.

git clone https://github.com/ethereum-optimism/optimism.git


Change directory into the optimism/infra/op-replica/docker-compose

cd optimism/infra/op-replica/docker-compose


Copy the example example environment file to one that we will use.

cp default-mainnet.env .env


With a copy of the default values, let's edit the new .env file to the desired values

nano .env


An example .env file is provided below:

Be sure to change <http://your_eth_rpc:8545> to your desired Ethereum Mainnet RPC endpoint.

For example, if you wanted to use a local RPC endpoint at IP address 10.10.10.111, you'd adjust that line from <http://your_eth_rpc:8545> to http://10.10.10.111:8545

COMPOSE_FILE=replica.yml:replica-shared.yml:replica-toml.yml
ETH_NETWORK=mainnet

DATA_TRANSPORT_LAYER__L1_RPC_ENDPOINT=<http://your_eth_rpc:8545>
DATA_TRANSPORT_LAYER__L2_RPC_ENDPOINT=https://mainnet.optimism.io
REPLICA_HEALTHCHECK__ETH_NETWORK_RPC_PROVIDER=https://mainnet.optimism.io
SEQUENCER_CLIENT_HTTP=https://mainnet.optimism.io
SHARED_ENV_PATH=./kustomize/replica/envs/mainnet

GCMODE=archive

L2GETH_IMAGE_TAG=0.5.12
L2GETH_HTTP_PORT=9991
L2GETH_WS_PORT=9992

DTL_IMAGE_TAG=0.5.18
DTL_PORT=7878

GETH_INIT_SCRIPT=check-for-chaindata-berlin.sh

RESTART=unless-stopped


Now that we've made the necessary changes to the environment file, we can go ahead and start the containers.

docker-compose up -d


Check Status of Optimism Node Service

We can check the status of our node by checking the logs in the replica-healthcheck container

docker-compose logs -f replica-healthcheck