Skip to content

gsu-protocol/oracles

 
 

Repository files navigation

oracles

Summary

Oracle client written in bash that utilizes secure scuttlebutt for offchain message passing along with signed price data to validate identity and authenticity on-chain.

Design Goals

Goals of this new architecture are:

  1. Scalability,
  2. Reduce costs by minimizing number of ethereum transactions and operations performed on-chain,
  3. Increase reliability during periods of network congestion,
  4. Reduce latency to react to price changes,
  5. Make it easy to on-board price feeds for new collateral types, and
  6. Make it easy to on-board new Oracles.

Architecture

There are currently two main modules:

Feed

Each Feed runs a Feed client which pulls prices redundantly with Setzer and Oracle Suite/Gofer, signs them with an ethereum private key, and broadcasts them as a message to the redundant p2p networks (e.g. scuttlebutt and libp2p).

Relay

Relays monitor the broadcast messages, check for liveness, and homogenize the pricing data and signatures into a single ethereum transaction to be posted to the on-chain oracles.

Install with Nix

Tested on this enviroment:

Ubuntu 22.04

nix-build (Nix) 2.13.2

To build from inside this repo, clone and run:

nix-build

The setup scripts can also be used configure Omnia as a feed running with systemd:


sudo ./setup/run_feed.sh --gofer <PATH_OF_CONFIG> --omnia <PATH_OF_CONFIG> --spire <PATH_OF_CONFIG>

for example:

sudo ./setup/run_feed.sh --gofer /home/oracles/gofer.json --omnia /home/oracles/omnia_feed.json --spire /home/oracles/spire1.json

The setup scripts can also be used configure Omnia as a relay running with systemd but first make sure spire is running:


sudo ./setup/run_it_relay.sh --gofer <PATH_OF_CONFIG> --omnia <PATH_OF_CONFIG> --spire <PATH_OF_CONFIG>

for example:

sudo ./setup/run_it_relay.sh --gofer /home/oracles/gofer.json --omnia /home/oracles/omnia_relay.json --spire /home/oracles/spire1.json

If you want to run multiple omnia's feed instances then you have to change the name of the systemd files(omnia.service, spire-agent.service) which are generated by ./setup/run_feed.sh or ./setup/run_it_relay.sh and change the config files path for shell script for example: sudo ./setup/run_it_relay.sh --omnia /home/oracles/omnia2.json --spire /home/oracles/spire.json and run the shell script again.

you can run the omnia, spire and gofer with systemd by these command:

systemctl start omnia.service
systemctl start gofer-agent.service
systemctl start spire-agent.service

Configuring Spire

spire is installed through nix.

This is based on libp2p which is a peer-to-peer networking protocol designed to enable decentralized communication and file sharing over the internet. It is a modular, open-source networking protocol that allows nodes to communicate with each other directly, without the need for a central server or infrastructure.

spire have config file which consists of different attributes

"transport":{
      "libp2p": {
        "directPeersAddrs":[]}}

this attribute is reponsible for the making the peers, So we have to give the info for example /ip4/192.168.18.109/tcp/37705/p2p/12D3KooWPFpaE13gph8p6jdNGJv1M6fwDro8kdst53MUzVpuSJUL i.e "<ip-version>/<host>/<protocol>/<port>/<type>/<peer_id>" w.r.t the quorum of median. You can get the peer address from the logs of spire, As we are running systemd services, So we have to use journalctl for getting the logs.

sudo journalctl -u <spire-agent.service> -n 100 -b -f

command to run spire

spire agent -c <CONFIG_PATH> --log.verbosity debug

command to run spire systemd

systemctl start <spire-agent.service>

how it will work

we should run the 3 feeds with the 3 spires every feed should have their own omnia means the config file have the right omnia addr pasted in feed object of spire's config

The installed Scuttlebot config can be found in ~/.ssb.config, more details about the Scuttlebot config.

Relay Gas Price configuration

Adding a new configuration parameter to ethereum relay config section: gasPrice. It consist of 3 available options:

source - source of gas price. Default value: node

There is currently only a single value available.

  • node - Getting Gas Price from node (using cast gas-price).

multiplier - A number the gas pice will be multiplied by after fetching. Default value: 1

Example configuration:

{
  "mode": "relay",
  "ethereum": {
    "from": "0x",
    "keystore": "",
    "password": "",
    "network": "goerli",
    "gasPrice": {
      "source": "node",
      "multiplier": 1
		}
  },
  "transports":["ssb"],
  "feeds": [
    "0xdeadbeef123"
  ],
  ...
}

About

Modular Open Oracle Network

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Nix 85.9%
  • Shell 13.9%
  • Python 0.2%