Skip to content

miohtama/stakewise-oracle-docker-compose

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Docker Compose for setting up Oracle for Stakewise pooled Ethereum 2 staking.

We have three services that communicate with each other

  • Ethereum 1: Get a hosted node from QuikNode

  • Ethereum 2: Runs Prysm instance through Docker Compose and have all data in local data folder

  • Oracle: Runs stakewise/oracle image through Docker Compose

Prerequisites

  • Ubuntu Linux or macOS

  • Docker

Setup

Tools

wscat - needed for testing if Websocket connections work:

npm install -g wscat

Setting up Telegram bot

Telegram group chat with an oracle specific bot is used to receive notifications on low balance and other errors.

You need a bot id and and a chat id. You can get there from Telegram botfather.

  • Create a bot - you get NOTIFIERS_TELEGRAM_TOKEN

  • Create a groupt chat and invite your bot there

  • Type /hello in the group chat

  • Run curl https://api.telegram.org/bot$NOTIFIERS_TELEGRAM_TOKEN/getUpdates | jq to get a chat id

  • Save chat id as NOTIFIERS_TELEGRAM_CHAT_ID

Setting up secrets file

Generate a private key for Ethereum 1.

Send 0.1 ETH to the address of your private key. You can do this later, as oracle will print out the address matching the private key on the startup.

Create secrets.env

export ORACLE_PRIVATE_KEY=111111111111...
export BEACON_WEB3_WS_ENDPOINT=
export NOTIFIERS_TELEGRAM_TOKEN=
export NOTIFIERS_TELEGRAM_CHAT_ID=

# For Prysm to sync with eth1
export BEACON_WEB3_WS_ENDPOINT=

# Either or for the oracle
export WEB3_WS_ENDPOINT=
export WEB3_HTTP_ENDPOINT=

Test ETH1 node connection

Load configuration:

source secrets.env && source oracle-settings.env

Test ETH1 webocket

Use wscat:

wscat -c ${WEB3_WS_ENDPOINT}

After it is connected, test with a gas price RPC call:

{"jsonrpc":  "2.0", "id": 0, "method":  "eth_gasPrice"}

You should get a response:

{"jsonrpc":"2.0","result":"0x33ebd5f600","id":0}

Test Beacon node

Test that Beacon node starts:

docker-compose up --build -V beacon

After a while you should see the beacon syncing:

eth2-beacon | time="2021-02-03 15:28:15" level=info msg="Processing deposits from Ethereum 1 chain" deposits=7680 genesisValidators=7675 prefix=powchain

Test oracle

docker-compose up stakewise

Run

Start everything:

docker-compose up -d

Check oracle is running:

docker logs oracle

Check ETH2 beacon is running:

docker logs eth2-beacon

Notes

Testing ETH2 over HTTPS

In the case, you are unsure if Webdsockets sork correctly, test your ETH1 node HTTPS endpoint with curl:

curl --location --request POST ${HTTP_WEB3_PROVIDER} \
  --header 'Content-Type: application/json' \
  --data-raw '{
    "jsonrpc":"2.0",
    "method":"eth_blockNumber",
    "params":[],
    "id":1
  }'

You get a block number as hex in the reply:

{"jsonrpc":"2.0","id":1,"result":"0xb3cf53"}%

About

Docker compose for setting up Stakewise Oracle

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages