bp-ventures / lightecho-stellar-oracle

A Stellar Soroban Oracle contract implemented by BP Ventures
MIT License
4 stars 1 forks source link

Lightecho Oracle - Oracle smart contract for Soroban

Lightecho is a Stellar Oracle for emerging markets data and XLM volatility feeds. Oracles are bridge technologies that connect blockchain systems with the outside world, enabling smart contracts to securely access external data. In the realm of Stellar, a platform designed for the fast and cost-efficient transfer of value across the globe, Lightecho Oracle emerges as a critical tool, especially for Soroban — Stellar's smart contracts platform.

Lightecho is dedicated to delivering real-time, reliable market data and XLM volatility feeds, addressing a significant gap in emerging markets. These markets often face challenges such as limited access to traditional banking services and financial volatility.

PRODUCTION Official Contracts:

TESTNET Official Contracts:

Roadmap

This repository contains:

In this README

FAQ

Infrastructure

flowchart TD
    deploy[Deploy Oracle to blockchain]-->initialize[Initialize Oracle with admin, base, decimals, etc]
    initialize-->blockchain_contract
    price_aggregator["Price aggregator (not open-source)"]-->post_prices["POST /db/add-prices"]
    subgraph database [Price Database]
        db[SQLite database file]
    end
    subgraph oracle_api ["Oracle API (see oracle-onchain/api)"]
      post_prices-->save_to_db[Save prices to database]
      save_to_db-->db
    end
    subgraph oracle_background_scripts ["Oracle background scripts (see oracle-onchain/sep40/cli/scripts)"]
      db-->read_prices_from_db[Read prices from API database]
      read_prices_from_db-->check_timestamps[Check price timestamps]
      check_timestamps-->add_prices["Add prices to blockchain Contract via add_prices()"]
    end
    subgraph soroban_blockchain [Soroban Blockchain]
      add_prices-->blockchain_contract[Contract inside blockchain]
    end

Price Sources

Each source is represented by an integer in the blockchain contract. To fetch the last price of USD from Coinbase for example, you can use the CLI:

./cli oracle lastprice_by_source 1 other USD

TESTNET Official Sources for prices:

0 - BPV aggregator
1 - Coinbase

A brief timeline of the Lightecho Oracle

(For BPV developer) Install the price feed script

The price feed is a script that puts the prices into the blockchain contract.

[!IMPORTANT] CLI must be already setup and configured via local_settings.py. See instructions.

Start by installing the systemd container:

sudo apt install systemd-container

Now, login into the systemd container and copy the systemd service unit files:

sudo machinectl shell myusername@  # replace myusername with your Linux username
mkdir -p ~/.config/systemd/user/
cp -v init/systemd/* ~/.config/systemd/user/

Go to ~/.config/systemd/user/ and update the .service files (that you copied) with the correct paths:

...

[Service]
# replace /path/to/ with the correct path
ExecStart=/path/to/lightecho-stellar-oracle/oracle-onchain/sep40/cli/scripts/bump_instance.sh

...

Enable and start the services:

./run deploy

Additional commands:

./run status  # check status of API and Feed
./run restart  # restart API and Feed

# systemd helper
./systemd-status.sh

# to see logs
journalctl --user -u feed_bulk_from_db
journalctl --user -u bump_instance

Featured projects

Have a project that uses our Oracle? Feel free to share with us and we'll be happy to list it here!


https://lightecho.io

Made by BP Ventures