Giter Site home page Giter Site logo

oracle-server's Introduction

oracle-server

Prerequisite

Install Node.js and Yarn.

  • Ensure that you have a LTS Node.js installed, with version 12.x.

Build and run

To start an oracle server

  1. Run yarn to install dependencies.
  2. Use yarn build to build the project.
  3. Use yarn start, with environment variables explained in the following section.

Environment variables

DOTENV is supported, and variables could be configured in a .ENV file.

Common

Common environment variables are needed no matter feeding for Ethereum smart contracts or Substrate based networks.

  • ALPHA_VANTAGE_API_KEY: the api key of Alpha Vantage.
  • PRICE_FEED_INTERVAL_MS: price feed intervals, by milliseconds.

By default, logs would be saved in error.log and combined.log. To enable logging in console, set environment variable CONSOLE_LOG as true.

Ethereum

For mainnet or Ethereum testnets like Kovan, contract addresses would be fetched from laminar-protocol/flow-protocol-ethereum package. The following environment variables would be needed:

  • WEB3_PROVIDER: web3 provider.
  • ETH_PRIVATE_KEY: feeder's private key.
  • CHAIN: mainnet, kovan etc.
  • GAS_LIMIT: gas limit.

For local testnet, additional environment variables would be needed:

  • LOCAL_TESTNET_ORACLE_CONTRACT_ADDR: the oracle contract address in local testnet.
  • FJPY: fJPY contract address.
  • FEUR: fEUR contract address.

Substrate

  • SUB_KEY_SEED: key seed.
  • SUB_ENDPOINT: node endpoint, could be http/https or ws/wss.

For Laminar Chain, set FEED_LAMINAR as true; For Acala Network, set FEED_ACALA as true.

API Server

With API_KEY set, an API server would be spinned up for querying and modifying oracle server states.

The default port number would be 3000, to use a different one, set the PORT env variable.

oracle-server's People

Contributors

shaunxw avatar xlc avatar gorgos avatar dependabot[bot] avatar

Stargazers

 avatar 0xThreeBody avatar  avatar Will Remor avatar

Watchers

Ruitao Su avatar James Cloos avatar  avatar  avatar

oracle-server's Issues

Improve `PriceFeeder` poll

Substasks

  • Interval. In the current impl, the price feed interval is not guaranteed, as PriceFeeder would sleep for PRICE_FEED_INTERVAL_MS before executing next round of tasks. It should be improved to maintain a guaranteed interval.

  • Concurrency. In each round, price feed tasks should be executed concurrently, instead of waiting for one another.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.