dyne / zenswarm-oracle

Zenswarm Oracle implementation

Home Page:https://github.com/dyne/zenswarm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ZENSWARM ORACLE

A zenswarm oracle is a web API whose identity is registered to a DID controller and is able to run zencode smart contract (through restroom-mw).

This repository contains some utilities that allow a user to

  • generate a keyring (which defines the identity of the oracle)
  • announce (i.e. register) the oracle to the DID controller
  • run a express service which provides all of the restroom-mw middlewares
  • deannounce (aka goodbye) the oracle identity

Zenswarm oracle

Registered restroom-mw instance

🔨 Usage

Before using Zenswarm oracle you need:

The secrets directory will be shared with the zenswarm oracle container. For example, this will let the oracle read the keyring we are going to generate.

The first step is to generate the keyring of the oracle

  make keygen DESCRIPTION="test oracle"

This command will generate a file secrets/keys.json with the newly created keyring.

Then, one has to announce the oracle to the DID controller.

  make announce

This command will generate two files:

  • secrets/DID.json with the the DID;
  • secrets/DID_document.json with the the DID document and the DID document metadata;

At this point, one can run the oracle instance

  make build
  make run

That will be launched on localhost on port 3000. To see the available contracts visit http://localhost:3000/docs.

To stop the container simply run

  make kill

Finally, once the oracle is no more needed, one have to deannounce the oracle to the DID controller.

  make goodbye

Oracle Flow

Distributor

First of all, you have to start a distributor. It will keep a list of announced oracles, it will announce new oracles and dsitribute a request at random.

One can start a distributor oracle using

make run ORACLE_TYPE=distributor

It will expose and API that will let other oracle announce. During this phase it will have to:

  1. record its domain name in redis;
  2. authorize its public key (with a call to a smart contract);
  3. (TODO: record its DID).

Common

During startup it will have to announce to a distributor, by sending a JSON like

{
  "domain_name": "....",
  "address": "....",
  ....?
}

using the command

make announce

And can start the oracle with

make run ORACLE_TYPE=common

At this point, the node owner can submit the signature of its address to the Smart Contract

😍 Acknowledgements

Copyleft (ɔ) 2023 by Dyne.org foundation, Amsterdam

Designed, written and maintained by Denis Roio, Andrea D'Intino, Alberto Lerda and Matteo Cristino.

💼 License

Zenswarm oracle - Announced restroom-mw instance
Copyleft (ɔ) 2023 Dyne.org foundation

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

About

Zenswarm Oracle implementation

https://github.com/dyne/zenswarm


Languages

Language:JavaScript 61.3%Language:Makefile 27.5%Language:Dockerfile 10.1%Language:Shell 1.2%