Unlocking the Web3 Universe: Orochi Network's Orocle Service

Imagine building a Web3 application that thrives on real-world data, free from centralized control. This is the vision behind Orochi Network's Orocle service, a powerful tool poised to revolutionize the way DApps interact with the external world.

Traditionally, DApps have struggled to access external data sources, relying on centralized oracles – single points of failure susceptible to manipulation and bias. Orochi's Orocle shatters these limitations, offering a decentralized, secure, and versatile solution for feeding accurate and verifiable data into your DApps.

Deployed Platform

Orocle V2 was deployed on following smart contract platform.

Mainnet

Testnet

Network NameAddress
Ancient8 Testnet0xd26Ea014930305B498C5826cF0712F877CCAF93f
Unicorn Ultra Nebulas0x70523434ee6a9870410960E2615406f8F9850676
Sei Devnet0x2cC3DF2fC577237A3Fa00634c3d90910211bdAc7
Saakuru Testnet0xA346Ed72C477F5007866D6B9edCb1563af8cC23d
Zircuit Testnet0x9eF4E958A94375436bA4071599BDF47f81E1d96f
ZKFair Testnet0x4A9f4f5acF2E11eb4795f228805c6577876559e1
X Layer Testnet0x471434636bE5da937d401971267Dd56C1696C073
ZKLink Nova0xb0b5fFeF72c6ea620689CF947C0458fAD5cF58da
BNB Chain Testnet0xbC792147B026F2B998A97d6BC9718569Df79ec65
Arbitrum Sepolia Testnet0x4ec4C6E856d0ce4D4bc57b50B9234DcD7c6c31BE
Moonbase Alpha Testnet0xCe4defA26b1820026136D71F2e00e291C479D656
Manta Pacific Sepolia Testnet0xc069da03509222325f9d51239E9F8E6F8cB953Eb
Kroma Sepolia Testnet0x8519243FaeDcC4292c0b0ebB63b84020158bBE68
Fantom Testnet0xf20f36FBec4C592367D807112ddBd44275a1B2df
Base Sepolia Testnet0xC6b292b2c1bBDbFfbb0c415D3880DEd376dAd672
Optimism Sepolia Testnet0xCc00d46197FBee69d7C79661e2F89c17b12FFFf3
Wanchain Testnet0x5ad07a162a56E8e4621544fA5D9243CA83264053
Scroll Sepolia Testnet0xC385AbA69909502B439670Bc2d81FF6B4b30AD6e
Morph Holesky Testnet0xa43Df8eE133946f4f9e455722D7Ec9cb29A08740
LightLink Pegasus Testnet0x9CB1bDc8D01841F1887f62a8F61813472B0cf1e4
Metis Sepolia Testnet0xc02C419c3416484E088A8A96B59859D0Ea9d7e89
B² Testnet0xD1159958Fb9d174230dD4B9Ae506AC2F518FD4Cf
StratoVM Sepolia Testnet0xf48537f499c9bE20D5D261d765bECb4c20110bd2
Core Blockchain Testnet0x08f5A19CAE906E6851E38e6A1f1848464548D9ff
Linea Testnet0x08f5A19CAE906E6851E38e6A1f1848464548D9ff
Lumia Testnet0x4231579Bb5DB91d9ACB5A54482A1FA7Bbc08132a
Etherlink Testnet0x6Fc8fcE9061977131A87D95458De69b9b4e36B1e
IoTeX Testnet0xF49c2DFb6789C8643B772F8dd039E6cF5fdaF6CE
Chiado Testnet0xf40931591640833969ee404F1FFfc2C722eE402F
Minato Testnet0x544FE7b51EF279c15f82B2037e524eeCa1E610C3
AILayer Testnet0x4995936C82D23c682DB5a6C811E06d8526914d45
Polygon Amoy Testnet0xE4d4A21d13d55a8d3c2E2A90672ECb96557f1b6a
Boba Sepolia Testnet0x595Dc78B75c58EE62335C787ceBf9B6791123126
NERO Testnet0x702D504980A4cE8dd468ae68d5090A2022415bd2
Camp Network Testnet V20xE4d4A21d13d55a8d3c2E2A90672ECb96557f1b6a
5ireChain Testnet0x3E36123bAE1d9EB392C32849324D093a45CEDd7F
Matchain Testnet0x146a21217749E2Caf89dC8d558A604ED0556811A

So, what exactly can the Orochi Orocle (Oracle) do?

  • Gather Diverse Data: Access a vast pool of information, from financial markets and weather updates to social media sentiment and IoT sensor readings. The possibilities are endless, empowering DApps with real-time, relevant data.
  • Decentralized & Trustworthy: Eliminate the risk of manipulation with a distributed network of nodes verifying and securing data integrity. No single entity controls the flow of information, fostering trust and transparency.
  • Highly Scalable & Efficient: Designed to handle high volumes of data requests efficiently, ensuring your DApp performs smoothly even with complex data integrations.
  • Chain Agnostic: Integrate seamlessly with various blockchain platforms, offering flexibility and wider reach for your DApp. But why is this important?

The potential applications are vast:

  • Decentralized finance (DeFi): Integrate real-world market data for dynamic pricing and risk management in DeFi protocols.
  • Prediction markets: Enable accurate and trustworthy predictions based on real-time events and data.
  • Supply chain management: Track goods movement and environmental conditions transparently across complex supply chains.
  • Gaming & Entertainment: Create immersive experiences that react to real-world events and user behavior.

Orochi's Orocle is more than just a data feed; it's a gateway to a truly decentralized and data-driven future for Web3. By unlocking the power of real-world data, it empowers developers to build DApps that are not only innovative but also robust, secure, and truly impactful.

Ready to explore the possibilities? Dive into the world of Orochi Network and unleash the full potential of your Web3 vision.

Installation

Installing @orochi-network/contracts will help you interactive with Orochi Network Orocle and VRF (Orand) much more easier.

npm i --save-dev @orochi-network/contracts

Orocle Aggregator Overview

This section describes all methods of Orocle V2 that facilitate interaction from external smart contracts. To familiarize yourself with Orocle V2, the following terminology definitions may be helpful.

appId: Application ID on Orocle, our oracle support multiple applications there are two of them listed here:

Application IDDescription
1Asset Price
2Cross Chain Data

round: Each application will have different round number, every time a new dataset submitted the round number will be increased by 1

identifier: Data identifier, it's a bytes20 used to index data on smart contract, for asset price application identifier is token's symbol

Note:

  • Only 255 latest rounds will be cached on smart contract, you can not get more than 255 rounds from the current round by using getData() method
  • Round is uint64, so 2^64 is the limit of number of round

Summary:

  • This contract defines an interface for interacting with an oracle aggregator.
  • It provides functions to retrieve application metadata, data, and round information.
  • It's designed for read-only access, as all functions are marked as view.

Key Points:

The IOrocleAggregatorV2 interface defines several methods:

  • request(uint256 identifier, bytes calldata data): This function is used to create a new request. It takes an identifier and data as parameters and returns a boolean indicating whether the request was successful.
  • fulfill(uint256 identifier, bytes calldata data): This function is used to fulfill a request. It also takes an identifier and data as parameters and returns a boolean indicating whether the fulfillment was successful.
  • getMetadata(uint32 appId, bytes20 identifier): This function is used to get the metadata of a given application. It takes an application ID and an identifier as parameters and returns the round and the last update time.
  • getData(uint32 appId, uint64 round, bytes20 identifier): This function is used to get the data of an application for a specific round. It takes an application ID, a round number, and an identifier as parameters and returns the data.
  • getLatestData(uint32 appId, bytes20 identifier): This function is used to get the latest data of an application. It takes an application ID and an identifier as parameters and returns the data.
  • getLatestRound(uint32 appId, bytes20 identifier): This function is used to get the latest round of an application. It takes an application ID and an identifier as parameters and returns the round number, the last update time, and the data.

Example

Here is an example of AssetPrice consumer:

// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

import '@openzeppelin/contracts/access/Ownable.sol';
import '@orochi-network/contracts/IOrocleAggregatorV2.sol';

contract ConsumerAssetPrice is Ownable {
  IOrocleAggregatorV2 private orocle;

  event SetOrocle(address indexed oldOrocle, address indexed newOrocle);

  constructor(address orocleAddress) {
    _setOrocle(orocleAddress);
  }

  function _setOrocle(address newOrocle) internal {
    emit SetOrocle(address(orocle), newOrocle);
    orocle = IOrocleAggregatorV2(newOrocle);
  }

  /**
   * Get price of an asset based USD
   * @dev Token price will use 18 decimal for all token
   * @param identifier Asset identifier (e.g. BTC, ETH, USDT)
   * @return price
   */
  function _getPrice(bytes20 identifier) internal view returns (uint256) {
    return uint256(orocle.getLatestData(1, identifier));
  }

  /**
   * Get price of a pair
   * @dev Token price will use 18 decimal for all token
   * (e.g. BTC/ETH => srcToken='BTC' dstToken='ETH')
   * @param srcToken Asset identifier of source
   * @param dstToken Asset identifier of destination
   * @return price
   */
  function _getPriceOfPair(bytes20 srcToken, bytes20 dstToken) internal view returns (uint256) {
    return (_getPrice(srcToken) * 10 ** 9) / (_getPrice(dstToken));
  }

  /**
   * Allow owner to set new Orocle address
   * @param newOrocle new Orocle address
   * @return success
   */
  function setOrocle(address newOrocle) external onlyOwner returns (bool) {
    _setOrocle(newOrocle);
    return true;
  }
}

Here is an example of BitcoinSeller that used ConsumerAssetPrice:

// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

import './ConsumerAssetPrice.sol';

contract BitcoinSeller is ConsumerAssetPrice {
  constructor(address provider) ConsumerAssetPrice(provider) {}

  function estimate(uint256 amount) external view returns (uint256 total) {
    total = _getPrice('BTC') * amount;
  }

  function ethOverBtc() external view returns (uint256 price) {
    price = _getPriceOfPair('ETH', 'BTC');
  }
}