Creating Oracle

We created many tools to help creating Oracle as simple as possible. This section will walk you through creating your Oracle and endpoint through examples of each tool

ZAP-ORACLE-TEMPLATE

This example uses zap-oracle-template that utilizes zapjs packages, for using zapjs packages to create oracle from scratch, check out section {link ZAPJS packages tutorial here}

Set up oracle dir

$ git clone https://github.com/zapproject/zap-oracle-template.git
$ cd zap-oracle-template
$ yarn

Layout :

  1. Config : data about your wallet , ethereum node and your provider's pubkey and title

  2. Schema : Your oracle's endpoint list with their params and pre-defined query/response schema

  3. Oracle : Template for Create/Manage flow

  4. Responder : Stub callback function when receive query event and return result

If your address doesnt have oracle initiated, a new oracle and endpoint will be created when you run yarn start

RUNNING ORACLE

Change config.ts with your oracle's information and Implement respond method

yarn start

Congrats, you have successfully created an oracle and start listening to query as well as providing responses to subscribers