Folks Feed Oracle
  • Introduction
  • FOLKS FEED ORACLE
    • Overview
    • Server
    • Provider
    • Smart contract
  • Developers
    • Introduction
    • SDK
      • Python
      • PyTEAL
    • Contract
    • Feeds
  • OTHERS
    • Socials
    • Brand assets
    • Make a request
    • Glossary
Powered by GitBook
On this page
  • Architecture
  1. FOLKS FEED ORACLE

Server

PreviousOverviewNextProvider

Last updated 2 years ago

The FFO Server is a configurable Java application that will be started up in a Virtual Machine. It will process the feeds taken from multiple data sources and make them available on-chain via smart contract.

The configuration file, containing desired feeds and their update time, will be prepared by a FFO admin under requests of the server owner.

FFO achieves strong resistance to tampering through three methods:

  • Auto-generating (using randomness) the updater's wallet:

    The public key will be published while the private key will be kept secret; it won't be stored, but kept in RAM. The owner of the virtual machine will not be able to alter the state of the oracle smart contract.

  • Make the virtual machine inaccessible from the outside:

    The VM will be configured to allow only outbound connections while all inbound connections will be denied. Hence, there is no way to read and manipulate server data.

  • Many VMs will contribute to updating the price feed.

Architecture

We can see the Java application (Oracle), as divided into three main sections:

Price sources

These classes adapt the oracle to the different data sources' API. They implement the same interface allowing composability with new sources or deprecating old ones.

Each price source class will consist of:

  • Feeds that support;

  • Last feeds fetched;

  • Method to read the feeds from the source: this is an asynchronous operation so no sources can get stuck the server; it waits a fixed amount of time, then uses all received prices, ignoring sources that have not yet responded;

Example of price sources implementations are: CoinGecko, CoinMarketCap, Coinbase.

Price destinations

These classes send the feeds to different destinations. As price sources, they implement the same interface.

Example of implementations are:

  • FolksFeedOracleSC: a class that shares prices to the oracle smart-contract; using the Updater wallet, it generates a transaction for each batch of data to update.

  • CloudWatch: used to monitor prices on a Cloud Watch dashboard;

  • Database

Middle classes

These classes aggregate the feeds to compute a more robust price estimation. At the moment the prices aggregation is computed using the median function to prevent outliers from heavily influencing the data:

Example:

Source1: $42.10

Source2: $42.22

Source3: $32.05

Source4: $42.15

Source5: $42.17

The median is $42.15, so the price feed written on the blockchain will be: $42.15