Getting trustworthy price feeds has always been a basic need in the exploding DeFi sector. This is because DeFi protocols that provide essential financial services like stablecoins, borrowing, lending, decentralized exchanges, and derivatives require a trusted oracle for reliable price feeds to function correctly.
Bearing in mind the need for reliable price feeds in DeFi since so much value depends on accurate price data, Blockscale, today announced the launch of a self-sustaining price oracle called Harbinger for DeFi apps on the Tezos blockchain.
The price oracle would serve as a connection between Tezos DeFi blockchain and external data while collecting market data from different exchanges and convey price signed feed based on collected data to the Tezos network.
Imitating the Compound Open Price Feed, the Harbinger oracle follows a series of steps or operations before delivering price feeds.
First, a Harbinger signer, which is a Serverless Framework application installed on Amazon Web Services, retrieves market data from multiple exchanges like Coinbase Pro, Binance, Gemini, and OKEx and signs it with a private key. And because the signer collects such data from different sources, it is more likely to be authentic and trusted, reducing the possibility of inaccurate data.
The hardware security module is made possible with the Amazon Key Management Service (KMS). It is used to store private key material, and sign price data making it impracticable for anyone apart from data providers to extract the private key material and provides vital management needs for any data provider.
Next, the poster whose job is to provide reliable and updated price data collects signed prices either from a signer or directly from an exchange and posts them on the storage contract where DeFi protocols can retrieve price data to their contract.
The Harbinger storage contract is a reference contract written in SmartPy and compiled to Michelson, the smart contracting language of Tezos. This storage contract stores the latest price candle and receives only data signed by a signer’s private key, ensuring that a single poster’s mistakes would not lead to stale prices.
However, a poster can also retrieve price data already posted on the storage contract and transfer it to a normalizer contract. The poster takes this action to assure consumers that the normalized price won’t be affected by low-volume price outliers since the normalizer contract calculates a volume-weighted average price.
Finally, any DeFi protocol may invoke a callback on the normalizer contract to have the latest price data from the normalizer contract transferred to their contract. Most Tezos smart contracts prefer to use callbacks to retrieve data instead of retrieving directly from the storage contracts to avoid reentrancy attacks. Besides, the Harbinger command-line interface is then used to easily deploy all the contracts and keep them continuously updated and analyzed.
Affiliate: Deposit 0.02 BTC, and get a 100% bonus to trade futures on Bexplus.