Skip to content

stakewise/oracle

Repository files navigation

StakeWise Oracle

Oracle

Oracles are responsible for voting on the new rewards for the StakeWise staked tokens holders and calculating Merkle root and proofs for the additional token distributions through the Merkle Distributor contract.

Dependencies

IPFS Node

The IPFS Node is used for pinning Merkle proofs files with the reward allocations.

Graph Node

The Graph Node from the Graph Protocol is used for syncing smart contracts data and allows oracle to perform complex queries using GraphQL. Either self-hosted (preferred) or https://api.thegraph.com/subgraphs/name/stakewise/stakewise-<network> endpoint can be used.

Consensus Node

The consensus node is used to fetch StakeWise validators data (statuses, balances). Any consensus client that supports ETH2 Beacon Node API specification can be used:

Oracle Usage

  1. Move to deploy/<network> directory
cd deploy/mainnet
  1. Create an edit environment file
cp .env.example .env
  1. Create JWT
openssl rand -hex 32 > ../configs/jwtsecret
  1. Enable pushover alerts in deploy/configs/alertmanager.yml

    1. Register an account on pushover.
    2. Create an Application/API Token.
    3. Add User Key and API Token to deploy/configs/alertmanager.yml file.
  2. Run with docker-compose. The docker-compose version must be v1.27.0+.

COMPOSE_PROFILES=besu,lighthouse docker-compose up -d

Keeper

Keeper is an oracle that aggregates votes that were submitted by all the oracles and submits the update transaction. The keeper does not require any additional role, and can be executed by any of the oracles. It helps save the gas cost and stability as there is no need for every oracle to submit vote.

Dependencies

Execution Node

The execution node is used to submit the transactions on chain. Any of the execution clients can be used:

Keeper Usage

  1. Make sure keeper has enough balance to submit the transactions

  2. Go through the oracle usage steps above

  3. Configure keeper section in the deploy/<network>/.env file

  4. Uncomment keeper sections in the following files:

    • deploy/configs/prometheus.yml
    • deploy/configs/rules.yml
  5. Run with docker-compose. The docker-compose version must be v1.27.0+.

COMPOSE_PROFILES=besu,lighthouse,keeper docker-compose up -d