Chains
BNB Beacon Chain
BNB ecosystem’s staking & governance layer
Developers
Solutions
Tokenization
Get Your Business Into Web3
Ecosystem
Community
Binance Smart Chain has partnered with Band Protocol, a cross-chain data oracle platform that aggregates and connects real-world data and APIs to smart contracts, to bring Band Protocol’s decentralized and customizable oracles to Binance Smart Chain’s ecosystem and open a gateway for truly scalable DeFi applications.
Developers, enterprises, and other Binance Smart Chain ecosystem participants can now utilize Band Protocol’s oracle to connect to any external data source or API using Band Protocol’s solution that is built for flexibility, modularity, and scalability. With the completion of the integration, Band Protocol has been added to the official Binance Chain documentation that provides the following secure price feeds to begin with: BTC/USD, ETH/USD, BNB/USD, BUSD/USD, BAND/USD, XAU/USD, XAG/USD, EUR/USD, CNY/USD, JPY/USD, GBP/USD and KRW/USD.
Band Protocol’s cryptoasset price feeds automatically update once every 5 minutes with the commodity and foreign exchange feeds updating once every hour. Developers can now use Band Protocol’s native price feeds on Binance Smart Chain or build custom decentralized oracles on BandChain, leveraging the short blocktime on Binance Smart Chain and streamlined data request process on BandChain to power all types of decentralized applications including DeFi, prediction, betting and gaming.
Band Protocol is a cross-chain data oracle platform that aggregates and connects real-world data and APIs to smart contracts on-demand and in real-time. Band Protocol enables smart contract applications such as decentralized finance, prediction markets, and games to be built on-chain without relying on a centralized oracle which has a single point of failure. The project is backed by a strong network of stakeholders including Sequoia Capital, one of the top venture capital firms in the world, and Binance Labs.
Using Band Protocol’s oracle platform, developers are able to create their own custom oracle scripts which have end-to-end flexibility in specifying the data type, data sources, aggregation methods, and security parameters.
Developers will have complete access to Band Protocol’s tools to reliably connect smart contracts to any external data source or API and leverage real-world data within their decentralized applications. This will bring end-to-end flexibility and customizability alongside security for developers to bridge external data sources without onboarding data providers for each feed, high-costs, limited creativity, restricted expansion of product offerings or limitations from various scalability issues common in existing oracle solutions.
Major features of Band Protocol:
In the past two years, DeFi has grown from a relatively small sector into one with 6 billion dollars in locked value. And while this certainly speaks volume about the sector’s potential, it does come with a cost.
As DeFi and blockchain in general starts to gain greater adoption and usage, Ethereum has started to experience network congestion and high transaction fees. This has led many users to start looking for an alternative in scalability solutions - this is where Binance Smart Chain comes in.
Binance Smart Chain offers a fully Ethereum Virtual Machine (EVM)-compatible platform that many developers are already familiar with, with additional benefits of connecting to Binance Chain’s growing ecosystem of tools and products such as Binance DEX, lending and payment services, and more.
The addition of Band Protocol’s oracle infrastructure allows developers to access frequently updated price data, and customization of a decentralized oracle to their specific needs and is suitable for all DeFi applications, including lending & synthetic assets. This greatly increases the possibilities and flexibilities in what developers can create, leading to an increasingly vibrant ecosystem and benefiting everyone in the process.
Before diving into a step-by-step guide on how to build a synthetic asset platform on Binance Smart Chain using a custom oracle script on BandChain - here’s a list of the ways Band Protocol’s secure oracles can be leveraged on Binance Smart Chain:
Further applications of conditional payments are international remittance, cross-border payments, payment for services or recurring payments that rely on an accurate exchange rate. Band Protocol can provide a spot market exchange rate for any crypto asset against any fiat currencies based on price information retrieved from various external sources such as data aggregators, centralized and decentralized exchanges.
Note that this tutorial aims to provide a guide to advance users who aim to utilize Band Protocol oracle to the fullest and uses any oracle script available on BandChain. This tutorial is only for the demo purpose not for the production. For a reference price feed usages, you may check out the Guide to Using Band Oracle Data on BSC (Official Doc).
The example below shows how to build a decentralized application on Binance Smart Chain using Band Protocol’s oracle solution.
In the demonstration, a decentralized synthetic asset platform is built, which allows users to seamlessly access traditional stock, commodities, precious metals, ETFs, and more for exposure, store of value or hedge against hyper-inflation.
A Collateralized Debt Position (CDP) smart contract is built that issues synthetic tokens using the BUSD token as collateral, as well as using a price feed from Band Protocol’s oracle. The diagram below shows how each of the components works together to create a fast, responsive UX suitable for mobile usage.
An important aspect to note is that the price feed from Band Protocol utilizes “batched” transactions that allow the price feed to be attached with the smart contract parameter in the same transaction. This allows Band oracle to operate securely and accurately even in highly congested networks.
All the functions that need price oracle data will take an extra oracle_data parameter. This parameter is the payload from BandChain that packs the oracle request parameters (oracleScriptId) and the request results in one bytes package. Check out Band Protocol’s developer documentation for more details.
The code is hosted here: https://github.com/bandprotocol/band-integration-binance-smart-chain. The contracts themselves consist of 5 functions that will enable trading of the synthetic asset.
In addition to the 5 main functions, the smart contract additionally allows the onlyOwner function to set the parameters via the setConfig function. This will allow the contract owner to set the ID of the oracle script and the symbol of the stock to be used when validating the oracle data sent from BandChain.
A simple web application to demonstrate the functionality of synthetic token issuance on the Binance Smart Chain testnet has been built.
The app can be accessed at https://bsc-synth-stock.bandchain.org/
If you’re creating a new account, you’ll need to get some BNB and BUSD tokens first by copying your newly created address and requesting for the two tokens from https://testnet.binance.org/faucet-smart.
Once you have some BNB to pay for transactions and BUSD to act as the collateral token, you can proceed by clicking the “Login” button.
In this minimal dashboard, you can see the status of your CDP as well as your BUSD balance.
Lock up 12 BUSD as collateral in your CDP.
Afterwards, you’ll see that the amount of collateral will be 12 BUSD.
At the time of writing, the Macy stock is worth approximately 6.73 USD.
Borrow (mint) 1 Macy token.
If the collateral amount entered is sufficient (i.e. more than 150% of the Macy token you want to borrow in value), the transaction will proceed and you will now own 1 Macy token, which you can spend or use on any decentralized exchanges or other DeFi applications that support it.
If you want to get your 12 BUSD collateral back, simply initiate “return debt”, which will transfer back the Macy token(s) you’ve borrowed.
Click “unlock” to get back the BUSD collateral you put in.
You can also inspect the data requests in real-time from the CosmoScan block explorer: https://guanyu-devnet.cosmoscan.io/requests
In each request, you can also inspect further to see how BandChain validators report and aggregate the data for your request.
The code repository is available here for you to examine further. Please note, the code and contracts are only intended to serve as a demonstration and have not been audited nor are intended to be used in a production environment.
That’s it! You’ve built a decentralized synthetic asset platform on Binance Smart Chain that will allow anyone with a mobile phone to have exposure to traditional financial assets such as stock, commodity, ETFs and more.
Combining the scalability of both Binance Smart Chain and Band Protocol’s oracle, you’ve enabled permissionless trading of money instruments for anyone that owns a mobile phone.
If you have any feedback or questions about Binance Smart Chain or Band Protocol integration, engineers from both teams will be happy to help. You can reach the Binance Smart Chain team on the Binance Chain Developer Telegram Group , and the Band Protocol team on Discord.
Happy Hacking!
About Binance Smart Chain
Binance Smart Chain is a sovereign smart contract blockchain delivering Ethereum Virtual Machine (EVM) compatible programmability. Designed to run in parallel with Binance Chain, Binance Smart Chain retains the former’s fast execution times and low transaction fees while adding Smart Contracts functionality to support compatible dApps.
For more information on Binance Smart Chain, visit:
www.binance.org/#smartChain
About Band Protocol
Band Protocol is a cross-chain data oracle platform that aggregates and connects real-world data and APIs to smart contracts. Blockchains are great at immutable storage and deterministic, verifiable computations — however, they cannot securely access data available outside the blockchain networks. Band Protocol enables smart contract applications such as DeFi, prediction markets, and games to be built on-chain without relying on the single point of failure of a centralized oracle. Band Protocol is backed by a strong network of stakeholders including Sequoia Capital, one of the top venture capital firms in the world, and the leading cryptocurrency exchange, Binance.
Website | Whitepaper | Telegram | Medium | Twitter | Reddit | Github