/ETHUSDT-price-Oracle

Understand the mechanisms behind an oracle and how to maintain a high level of decentralization.

Primary LanguageSolidity

ETHUSDT Price Oracle

Ethereum-Dollar price oracle that calls upon Binance's public API.

What is an oracle?

Blockchain oracles are third-party services that provide smart contracts with external information. Oracles provide a link between off-chain and on-chain data and are vital within the blockchain ecosystem because they broaden the scope in which smart contracts can operate.

Getting Started

Deploy smart contract

  • Make sure caller and oracle smart contracts are already deployed on the chain.

Environment variables

  • Configure .env for ./client
cp .env-sample .env
  • Configure .env in ./server
cd ./server
cp .env-sample .env

Server

  • Compile server binary
cd ./server
cargo build --release
  • run the oracle service
cd ./server
RUST_LOG=info ./target/release/oracle-service

Client

  • install dependency
yarn
  • Call updateEthPrice function and listen PriceUpdatedEvent event
yarn start client/src/caller-core.ts