Metis RPC endpoint: Difference between revisions
From Chainlink Community Wiki
No edit summary |
No edit summary |
||
(2 intermediate revisions by the same user not shown) | |||
Line 91: | Line 91: | ||
<code>docker-compose up -d l2geth</code> | <code>docker-compose up -d l2geth</code> | ||
You can check your local RPC node's sync status and latest block against the explorer with the following bash script: | <H3>Example docker-compose.yml:</H3> | ||
<pre style="white-space:pre-wrap; width:100%; border:1px solid lightgrey; background:black; color:white;">version: "3" | |||
services: | |||
dtl: | |||
image: metisdao/mvm-andromeda:dtl | |||
entrypoint: ./dtl.sh | |||
restart: unless-stopped | |||
stop_grace_period: 30s | |||
environment: | |||
URL: https://metis-us-east-2-mainnet-json.s3.us-east-2.amazonaws.com/addresses.json | |||
DATA_TRANSPORT_LAYER__L1_RPC_ENDPOINT: "http://10.10.100.42:8545" | |||
DATA_TRANSPORT_LAYER__L2_RPC_ENDPOINT: "https://andromeda.metis.io/?owner=1088" | |||
DATA_TRANSPORT_LAYER__SYNC_FROM_L1: "false" | |||
DATA_TRANSPORT_LAYER__SYNC_FROM_L2: "true" | |||
DATA_TRANSPORT_LAYER__L2_CHAIN_ID: "1088" | |||
DATA_TRANSPORT_LAYER__DB_PATH: /data/db | |||
DATA_TRANSPORT_LAYER__SERVER_PORT: "7878" | |||
DATA_TRANSPORT_LAYER__TRANSACTIONS_PER_POLLING_INTERVAL: "1000" | |||
DATA_TRANSPORT_LAYER__CONFIRMATIONS: "0" | |||
DATA_TRANSPORT_LAYER__POLLING_INTERVAL: "100" | |||
DATA_TRANSPORT_LAYER__LOGS_PER_POLLING_INTERVAL: "2000" | |||
DATA_TRANSPORT_LAYER__DANGEROUSLY_CATCH_ALL_ERRORS: "true" | |||
DATA_TRANSPORT_LAYER__SERVER_HOSTNAME: "0.0.0.0" | |||
expose: | |||
- 7878 | |||
volumes: | |||
- $PWD/chaindata/dtl:/data | |||
logging: | |||
driver: "json-file" | |||
options: | |||
max-size: "2m" | |||
max-file: "10" | |||
l2geth: | |||
image: metisdao/mvm-andromeda:l2geth-replica | |||
entrypoint: sh ./geth.sh | |||
restart: unless-stopped | |||
stop_grace_period: 2m | |||
env_file: | |||
- ./geth.env | |||
environment: | |||
ROLLUP_BACKEND: "l2" | |||
URL: https://metis-us-east-2-mainnet-json.s3.us-east-2.amazonaws.com/addresses.json | |||
L2GETH_GENESIS_URL: https://metis-us-east-2-mainnet-json.s3.us-east-2.amazonaws.com/state-dump.latest.json | |||
ROLLUP_CLIENT_HTTP: http://dtl:7878 | |||
L2_URL: https://andromeda.metis.io/?owner=1088 | |||
ETH1_CTC_DEPLOYMENT_HEIGHT: 13626959 | |||
EMERGENCY_FORK020222_NUMBER: 750000 | |||
volumes: | |||
- $PWD/chaindata/l2geth:/root/.ethereum | |||
- $PWD/geth.sh:/geth.sh | |||
expose: | |||
- 8545 | |||
- 8546 | |||
ports: | |||
- 8545:8545 | |||
- 8546:8546 | |||
logging: | |||
driver: "json-file" | |||
options: | |||
max-size: "2m" | |||
max-file: "10"</pre> | |||
<H2>You can check your local RPC node's sync status and latest block against the explorer with the following bash script:</H2> | |||
<pre style="white-space:pre-wrap; width:100%; border:1px solid lightgrey; background:black; color:white;">#!/bin/bash | <pre style="white-space:pre-wrap; width:100%; border:1px solid lightgrey; background:black; color:white;">#!/bin/bash | ||
# blue foreground | |||
blue_fg=$(tput setaf 6) | |||
# reset to default | |||
reset=$(tput sgr0) | |||
# SET VARS | |||
BLOCK_HEIGHT=$(curl -s -H "Content-Type: application/json" http://localhost:8545 -d '{"jsonrpc": "2.0", "id": 123, "method": "eth_blockNumber"}' | jq -r .result) | BLOCK_HEIGHT=$(curl -s -H "Content-Type: application/json" http://localhost:8545 -d '{"jsonrpc": "2.0", "id": 123, "method": "eth_blockNumber"}' | jq -r .result) | ||
ANDROMEDA_METIS_BLOCK_HEIGHT=$(curl -s -d "module=block&action=eth_block_number" -X POST https://andromeda-explorer.metis.io/api | jq -r .result) | ANDROMEDA_METIS_BLOCK_HEIGHT=$(curl -s -d "module=block&action=eth_block_number" -X POST https://andromeda-explorer.metis.io/api | jq -r .result) | ||
Line 117: | Line 185: | ||
fi</pre> | fi</pre> | ||
Example Output: | |||
<H3>Example Output:</H3> | |||
<pre style="white-space:pre-wrap; width:100%; border:1px solid lightgrey; background:black; color:white;">./checkState.sh | <pre style="white-space:pre-wrap; width:100%; border:1px solid lightgrey; background:black; color:white;">./checkState.sh |
Latest revision as of 17:03, 6 May 2022
Metis RPC endpoint detailsThis is a general guide on deploying an Metis RPC endpoint for your Chainlink Node(s).Official Metis Docs are available here |
NOTE
Metis RPC endpoints:
You Chainlink node has two connections methods. Websocket and HTTP.
As these can vary between networks, the default values for an Metis node are:
Websocket ws://<your_ip_address>:8546
HTTPhttp://<your_ip_address>:8545
Install Docker-CE
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
NOTE
$
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.
(The prevents us from having to run docker commands with elevated (root) permissions)
sudo usermod -aG docker $USER
Then, we will install docker-compose
sudo apt install -y docker-compose
Next, we'll get our Metis node deployed and synced.
Deploy Metis RPC Node
First, we'll need to create a new directory house the container volume.
mkdir ~/.metis-data
We'll need to clone the Metis repo
git clone https://github.com/ericlee42/metis-replica-node-guide
Navigate into the newly cloned directory.
cd metis-replica-node-guide
Then we'll copy the example docker-compose configuration to a used file.
cp docker-compose-mainnet.yml docker-compose.yml
Be sure to update DATA_TRANSPORT_LAYER__L1_RPC_ENDPOINT in the newly copied coker-compose file with either your local Ethereum RPC endpoint if you have one, or a reliably hosted option if you don't.
For example, if your local ETH Mainnet RPC endpoint was at http://10.10.10.111:8545, you'd update the file to
DATA_TRANSPORT_LAYER__L1_RPC_ENDPOINT=http://10.10.10.111:8545
.
With the file updated, we can start the container.
docker-compose up -d dtl
Once that has started successfully, we'll then want to start the L2 service
docker-compose up -d l2geth
Example docker-compose.yml:
version: "3" services: dtl: image: metisdao/mvm-andromeda:dtl entrypoint: ./dtl.sh restart: unless-stopped stop_grace_period: 30s environment: URL: https://metis-us-east-2-mainnet-json.s3.us-east-2.amazonaws.com/addresses.json DATA_TRANSPORT_LAYER__L1_RPC_ENDPOINT: "http://10.10.100.42:8545" DATA_TRANSPORT_LAYER__L2_RPC_ENDPOINT: "https://andromeda.metis.io/?owner=1088" DATA_TRANSPORT_LAYER__SYNC_FROM_L1: "false" DATA_TRANSPORT_LAYER__SYNC_FROM_L2: "true" DATA_TRANSPORT_LAYER__L2_CHAIN_ID: "1088" DATA_TRANSPORT_LAYER__DB_PATH: /data/db DATA_TRANSPORT_LAYER__SERVER_PORT: "7878" DATA_TRANSPORT_LAYER__TRANSACTIONS_PER_POLLING_INTERVAL: "1000" DATA_TRANSPORT_LAYER__CONFIRMATIONS: "0" DATA_TRANSPORT_LAYER__POLLING_INTERVAL: "100" DATA_TRANSPORT_LAYER__LOGS_PER_POLLING_INTERVAL: "2000" DATA_TRANSPORT_LAYER__DANGEROUSLY_CATCH_ALL_ERRORS: "true" DATA_TRANSPORT_LAYER__SERVER_HOSTNAME: "0.0.0.0" expose: - 7878 volumes: - $PWD/chaindata/dtl:/data logging: driver: "json-file" options: max-size: "2m" max-file: "10" l2geth: image: metisdao/mvm-andromeda:l2geth-replica entrypoint: sh ./geth.sh restart: unless-stopped stop_grace_period: 2m env_file: - ./geth.env environment: ROLLUP_BACKEND: "l2" URL: https://metis-us-east-2-mainnet-json.s3.us-east-2.amazonaws.com/addresses.json L2GETH_GENESIS_URL: https://metis-us-east-2-mainnet-json.s3.us-east-2.amazonaws.com/state-dump.latest.json ROLLUP_CLIENT_HTTP: http://dtl:7878 L2_URL: https://andromeda.metis.io/?owner=1088 ETH1_CTC_DEPLOYMENT_HEIGHT: 13626959 EMERGENCY_FORK020222_NUMBER: 750000 volumes: - $PWD/chaindata/l2geth:/root/.ethereum - $PWD/geth.sh:/geth.sh expose: - 8545 - 8546 ports: - 8545:8545 - 8546:8546 logging: driver: "json-file" options: max-size: "2m" max-file: "10"
You can check your local RPC node's sync status and latest block against the explorer with the following bash script:
#!/bin/bash # blue foreground blue_fg=$(tput setaf 6) # reset to default reset=$(tput sgr0) # SET VARS BLOCK_HEIGHT=$(curl -s -H "Content-Type: application/json" http://localhost:8545 -d '{"jsonrpc": "2.0", "id": 123, "method": "eth_blockNumber"}' | jq -r .result) ANDROMEDA_METIS_BLOCK_HEIGHT=$(curl -s -d "module=block&action=eth_block_number" -X POST https://andromeda-explorer.metis.io/api | jq -r .result) IS_SYNCING=$(curl -s -H "Content-Type: application/json" http://localhost:8545 -d '{"jsonrpc": "2.0", "id": 123, "method": "eth_syncing"}' | jq .) echo "----------------------" echo "RPC Node block height: ${blue_fg}$((BLOCK_HEIGHT))${reset}" echo "Metis Explorer block height: ${blue_fg}$((ANDROMEDA_METIS_BLOCK_HEIGHT))${reset}" VAR1=$(curl -s -H "Content-Type: application/json" http://localhost:8545 -d '{"jsonrpc": "2.0", "id": 123, "method": "eth_syncing"}' | jq .result) VAR2="false" if [ "$VAR1" = "$VAR2" ]; then echo "Sync Status: ${blue_fg}Node is synced.${reset}" else echo "${blue_fg}Node is ${yellow_fg}NOT${blue_fg} synced.${reset}" fi
Example Output:
./checkState.sh ---------------------- RPC Node block height: 2536042 Metis Explorer block height: 2536042 Sync Status: Node is synced.