Tech Tuesday Development Update - 2019 Week 14: Decentralized Trustless Oracles For Market Feeds

Komodo Team
Komodo Team

Tech Tuesday Development Update - 2019 Week 14: Decentralized Trustless Oracles For Market Feeds
Table of Contents
Table of Contents

Things move fast at Komodo Platform. That’s why the Komodo team has decided to release a weekly briefing to cover all of the progress the Dev Team is making.

This series of posts is called the Tech Tuesday Updates.

In case you’ve missed a previous edition and want to catch up, you can find all the previous Tech Tuesday updates here.

Decentralized Oracle, Decentralized Feeds and Prediction Markets

Komodo Lead Developer jl777 thanks Zack from Amoveo for the inspiration & debate to create a second type of oracle for the Komodo ecosystem.

The first type of blockchain oracle that jl777 created was a simple feed to make off-chain data sources available for applications and the data became part of regular blockchain consensus. This new development is a decentralized oracle for trustless external data. The external data for development is the BTCUSD price. The module is called Prices.

Steve Ballmer exclaimed, “Developers, developers, developers, developers, developers” at a Microsoft conference nearly two decades ago.  What I am encouraging you to think about for any blockchain enabled application is:

“Validation! Validation!! Validation!!! Validation!!!! Validation!!!!!”

The Prices Custom Consensus Module is used by every node in the PRICES blockchain network.  This consensus module is used to validate. Each node validates to form network wide blockchain consensus. It is trustless - without relying on a single node to be the trusted entry point for off-chain data.  Every node retrieves its own data and does not trust or rely on any other node for the data point requiring validation. The number of price sources is irrelevant at this stage— the more the better otherwise relying on a single price source is no better than the trusted source oracle first introduced in 2018.

This is the first implementation of  decentralized oracle technology on Komodo.  The Prices Custom Consensus Module includes validation rules used by the network of participating nodes on the blockchains that implement it.  The technology is available to any project to create their own blockchains.

What can you do with blockchain oracles technology?

In Nick Szabo’s essay Formalizing and Securing Relationships on Public Networks, he derives some industries that were early to move to electronic records, and it is these industries that could likely benefit from decentralized oracle inputs for their operations, particularly in predictions. Pre-purchasing and purchasing, shipping, warehousing, income & expenditure can all benefit from the gathered data from numerous & validated sources.

How does a decentralized blockchain oracle work?

The Komodo Prices Custom Consensus Module (the decentralized oracle) for BTC price feeds starts like this:

  • Every miner on the network queries a source for data
  • When a block is found the miner, using the Prices Custom Consensus Module, will set the data for the op_return as the price retrieved from the data source. This is the op_return of the coinbase transaction— the block reward the miner receives.
  • The price feed value will be tolerated within an acceptable range from the previous accepted value, this is the tolerance.

The data source can vary, there could be 1000 miners on the network each querying a separate data source, say there is a group of 50 data sources as this is quite realistic for a BTCUSD price feed.

The price feed tolerance, can be set at 1%. What this means is the change in price from the last block (where the previous miner wrote the price in op_return) must be within a 1% range to be accepted.

Notice with this example it must fall within a range of one percent. This is a rule, to be accepted as part of the consensus. Let that sink in for a moment— a rule that creates a tolerance, for a price change from block to block needs to be followed. A rule.  What are rules used for? Validation. Remember “Validation! Validation!! Validation!!! Validation!!!! Validation!!!!!”

Let’s move onto what the rest of the network is doing with this new block the miner claims to have found. The normal consensus rules need validating. This price feed blockchain application’s consensus rules also need validating. This is why it is named the Prices Custom Consensus Module. It is a modular extension to the base blockchain consensus rules and peer to peer mechanics. A full node when receiving a new block will apply “Prices Custom Consensus Module”, the module’s rules like this:

  • Check that its transactions are valid as per normal network consensus rules
  • Receive the price feed data that was saved by the miner that found the block (in the op_return part of the coinbase transaction)
  • Query it’s own sources for the current BTCUSD price
  • Check that the price it has queried falls within the rules set for price discovery (the tolerance)

If the full node cannot validate the rules for this module by independently sourcing it’s own price feed data and then checking what the miner claims to be the current price, then the block is rejected by the node.

Once validated, however, this decentralized price discovery oracle will have saved the updated price in the op_return of the coinbase transaction (the block reward). Having been accepted by the network by all validating nodes, it is the new price available to all requests for the data point.

The tolerance of the price change for this example is set to one percent. Depending on how an application/network wants to use a decentralized oracle, they will set their own tolerance level. The tolerance follows a similar pattern used for the time of a block. Some nodes clocks drift, so there is some tolerance for block times. This technique is re-used for price feed changes from block to block.

So far we have described this process.

Decentralized Oracle HOWTO

Komodo’s Custom Consensus Framework introduced a new OP_CODE for Bitcoin script called OP_CHECKCRYPTOCONDITION. This is the same acceptable format for any bitcoin protocol coin and its existing infrastructure.

Using the Komodo blockchain innovation of Custom Consensus framework— a data format which is a multi-algorithm and multi-language data format, applications can utilize existing crypto-coin infrastructure that has been developed over the past 10 years. So, how?

The coinbase transaction is as old as bitcoin itself. The miner reward transaction. This is in every block mined. It follows the same protocol format as every other transaction, and every transaction is reachable in lite mode, or SPV mode. Your mobile wallet uses this mode. So, too, can Komodo blockchain applications just query the op_return data fetched from the coinbase transaction from your mobile application! Like this simple diagram illustrates

Scaling Oracles in Lite SPV Mode

The decentralized oracle code can be found in komodo_gateways.h. While still in its first 12 days of the development cycle, this new decentralized oracle CC module already works.

The power and developer efficiency of using an application framework that conforms to existing infrastructure and underlying consensus extends blockchain capabilities in ways that the newest blockchain projects are still conceptualizing and developing to take to testnet. Bitcoin protocol is a proven success.

Komodo’s innovations build on proven success and lower the barrier to developer adoption. This enables skilled developers to rapidly churn ideas into working prototypes within a week! Want to learn more? Ask us in the discord as we prepare for updated developer documentation.

Breaking:  10% BTC hourly volatility this morning tested even the latest test nodes that included some experimental correlation and smoothing layers.

Basically, the future of oracalized settlements does not rely only on raw data, but correlated and smoothed data over a period of time.  Other deterministic models can be used for different applications - all models can be applied as pluggable Consensus modules.

Thank you for the week of tech news! Good luck to all Notary Node Operators & Candidates in 2019.

To get all the latest updates from Komodo, join the monthly email list. On the first Friday of every month, you'll receive a newsletter with information about all of the most important developments from the previous month. You can also join the Komodo Community Portal to chat with other community members and the Komodo team.

Great! Next, complete checkout for full access to Komodo Platform Blog | En
Welcome back! You've successfully signed in
You've successfully subscribed to Komodo Platform Blog | En
Success! Your account is fully activated, you now have access to all content
Success! Your billing info has been updated
Your billing was not updated