The first part of a new big article about Blockchain Oracles published on
stealthex.io. A prologue to this piece about DeFi can be found
here. Your feedback is greatly appreciated, as always
Blockchain Oracles: Connecting the WorldsMany blockchain-based cryptocurrencies, and most importantly, Bitcoin and Ether, have become notorious for transaction failures, primarily due to scalability issues. And that’s pretty much all when we talk about plain-vanilla Bitcoin and its copycats like Litecoin or its clones like Bitcoin Cash. But with blockchains like Ethereum or EOS, which expand into the far reaches of a new territory known as smart contracts and decentralized applications (dApps), this is only the tip of the iceberg. In other words, only a beginning.
What hides below the surface, and thus rarely emerges in public discussions about cryptocurrencies, is the closed-off nature of smart contract-enabled blockchains. To be ever so slightly useful, smart contracts and dApps running on top of them must have access to real-world data which is immensely off-chain, while they are permanently stuck within the constraints of their tiny on-chain world. So how do they escape out of the straitjackets put on them by their restrictive environments? That’s where blockchain oracles come into play.
And what role do they play, exactly?Enabling smart contracts and dApps to interact with the outside world opens both endless possibilities and a big can of worms. Now that the entire world is made available to a smart contract, it can take an input from an external source of information, make some calculations that require this data or arrive at a decision based on it, and then get down to some work like moving contractually-locked funds from Alice to Bob. Or from Bob to Alice, depending on the verdict. Sounds cool, huh?
But here's the catch. As transactions on a smart contract blockchain are supposed to be irreversible (while the blockchain itself immutable), it can lead to catastrophic consequences if the input has been tampered with or just happens to be incorrect for some arbitrary reason, not necessarily ill in intent. This fundamental problem of internalizing the outside world for on-chain execution of contractual agreements on smart contract blockchains has become most apparent with the advent of
Decentralized Finance (or simply DeFi) a few years ago.
DeFi is a promising new kid on the blockchain arena. It hinges on the idea of decentralizing most financial services that we use today, but without a bank or other financial institution in the middle. It is envisioned that with the help of smart contracts and dApps using them we will be able to lend money and borrow with collateralized digital assets, offer and receive banking services including mortgages and insurance, buy and sell digital assets safely on decentralized marketplaces, as well as issue stablecoins and user tokens. Pretty impressive list, isn’t it?
However, for all of this to work properly we need trustless and reliable sources of information outside the blockchain that provide inputs to dApps running on that blockchain. DeFi requires trustless data feeds about the state of the world to ensure correct on-chain execution of smart contracts powering dApps. But how do we get these and manage to retrieve external data that cannot be verified through cryptography but that we can still trust and rely on? Entities that provide off-chain data for on-chain consumption are called blockchain oracles. Technically, an oracle is an interface through which a smart contract queries and retrieves information from an external source of truth.
As it turns out, DeFi is not the only field of application where blockchain oracles turn up quite handy, but since their use is most indispensable there, it makes sense to delve deeper into this area.
Oracles of DeFiToday, the space is crowded with a plethora of players that aim at providing DeFi with so much needed real-time market information, for example, digital asset prices. There are many forms of oracles, but the most important distinction is drawn between centralized and decentralized ones. As DeFi is supposed to be a trustless, decentralized environment, the decentralized oracles are the flesh and blood of this ecosystem, so we are mostly concerned here with this type of blockchain oracles (just in case, there are centralized oracles too).
DeFi platforms deploy various oracle solutions in their pursuit of retrieving real-time information about the market price of digital assets. The most well known among these is the MakerDAO lending platform which uses an oracle module called the Medianizer to obtain the real-time exchange prices. Technically, it is a smart contract that accepts price updates from independent data feeds, discards false ones along with outliers, and calculates the median price (hence the name) to be used as a reference for other smart contracts.
Another blockchain-based borrowing and lending platform, Compound, uses administrators who are holders of the platform’s native COMP token. They manage and control price feeds through aggregator contracts they create. Authorized sources of information called reporters are then queried for reference prices by aggregators which verify the data and calculate median values to be used internally. A somewhat similar approach is utilized by AmpleForth, a developer of a stablecoin with elastic supply, and Synthetix, a platform for creating crypto-backed synthetic versions of assets like commodities, stocks, indices, cryptocurrencies, and fiat.
On the other hand, there are a few blockchain projects that provide decentralized oracle services to other platforms and blockchains, mostly Ethereum and EOS. Such projects as Provable (formerly Oraclize), ChainLink, Band Protocol, Tellor aim at providing blockchain-agnostic protocols that allow query and retrieval of virtually any type of reference data in a standardized manner. As authenticity and veracity of the information retrieved is of crucial importance to its consumers, these projects run their own decentralized blockchains whose primary task is to validate data feeds and check that the information received is authentic and has not been tampered with.
Realistically, these special-purpose blockchains come closest to the implementation of a blockchain oracle idea in a truly decentralized and trustless way.
To be continuedIn the second part of this two-part article we will look into other uses of blockchain oracles beyond DeFi, and talk about potential problems and pitfalls of this nascent technology, as well as approaches used to deal with them. Stay with us and remain in the know!