SMT + DPOS Oracles = Smart Contracts

in #smt-oracles7 years ago (edited)

space.jpg

Steem recently announced the upcoming launch of Smart Media Tokens that will enable anyone to create their own version of Steem currency with built-in economics and integration with the Steem blockchain. Last week @ned also made a post introducing the idea of DPOS oracles and the opportunities they present. In this post I want to expand on these ideas and argue that when combined with a DPOS-like consensus protocol, oracles facilitate decentralised smart contract functionality for SMTs.

What are Oracles?

Oracles are generally considered to be entities that provide real-world data to a blockchain so that a smart contract can make decisions based on that data. There are various considerations to be made depending on the type of data one wants. Some data depends on a single centralized api, some is hard to access, some isn’t precise. This makes it hard for decentralized nodes to reach consensus about the data. But there is another type of oracle — the computational, or Smart Oracle. These oracles take blockchain data as the input, perform some computation, and update the state of the blockchain. Since the oracle’s computations can be deterministically derived from the parent chain, they are easy to verify and have fewer trust issues.

Smart Oracles

Oracles that only use blockchain data as inputs are very similar to smart contracts. The big difference is that instead of requiring the whole network to perform complex computations on-chain, the work is done by a small set of oracle nodes. This post by Vitalik Buterin is a great overview of this concept.

Generally, the main drawback of oracles is the low level of decentralisation. In the case of Smart oracles this issue is mitigated by the fact that all inputs are well-determined and anyone can verify whether their computations are done correctly. There are several mechanisms for determining consensus among oracles and challenging and verifying computations. One can force oracles to make a deposit and penalise those that don’t conform to the majority — SchellingCoin. Another approach is to utilize a mechanism that challenges oracle’s computation and verifies them on the main chain — TrueBit.

With Steem we already have a method for letting a small set of elected individuals to secure a trustless decentralized network — DPOS. We can extend this idea to Oracles and elect a certain set of public individuals to run and secure a set of oracles for any given SMT.

SMT + DPOS

When we add the DPOS consensus to smart oracles what we get is decentralized smart contracts. The SMT creator can publish the source-code for a full-node DPOS ‘oracle miner’ that anyone can campaign to compete for a witness position. The smart contract can take the form of a plugin to the main node code (Potentially one could even allow for the smart contracts to be written in different languages as long as the code can be executed by the oracle node). These SMT oracles can be thought of as mini-steem nodes. At each block (or a set time interval), they read the state of the main chain, and update the SMT-specific state. Each state update is then hashed into a Merkle Tree so that anyone can easily check the root hash against their own version in order to verify the computation.

DPOS smart oracles will thus facilitate secure trustless smart-contracts for any given SMT, just like DPOS witness facilitate the security of the main Steem blockchain. In fact you could even extract all of Steemit’s app business logic into a Steemit SMT. This would allow one to keep a separate code base for the main chain, and all the apps built on top of it.

The main difference between the oracle witness and blockchain witness is that oracles don’t need to determine the order of transactions — that work is left to the main chain. All the main trust assumptions about DPOS still apply to oracles.

Example: Trustless Reputation Feeds + Custom Reward Distribution

Suppose we want to implement an SMT token to support a social network that uses a complex algorithm that computes a reputation score for each user (like Relevant). For example, Eigen Trust++ can give us very reliable reputation scores resistant to fraud and Sybil attacks, but it is too costly to compute on the main chain. We want a decentralized way to compute this reputation score and use it to rank content and determine reward distributions.

We specify one smart oracle contract that will periodically compute the reputation score for each user on our platform based on the blockchain history up to a given block. We specify a second smart oracle contract that will compute the reward distribution for each new block based on the combination of user’s SP and Reputation. We can then use SMT (or SP) vests (and potentially even users reputations!) to elect witnesses to run these Oracles.

Once the oracles are running, they will continually compute and publish user reputation scores. Anyone can easily audit them by running the computations themselves and checking the results. At each block the oracles will also compute the reward distribution for that block and these can also be audited. The main chain will deposit all total rewards for that block into an account controlled by the oracles. Once M out of N oracles agree on the outcome of the reward distribution, the funds get distributed to the users.

Example workflow:

  1. Oracles compute reputations once an hour and cache the results
  2. Main chain sends rewards for a certain block into an M-of-N multisig address controlled by N out of M oracles.
  3. Oracles compute rewards for that block based on blockchain data + recent reputation scores
  4. Oracles send the funds to users based on reward computations, each keeping a small portion as their own reward.

If any of the oracles are found to perform fraudulent or inaccurate computations, they can be easily exposed and voted out of their position.

Additionally, deposit requirements and on-chain verification can also be considered, although it might be technically challenging to implement on-chain verification for a general case. These additional security measures could be implemented using a smart oracles themselves. Eventually we can see a hierarchy of protocols forming, each enforced by their own set of oracles and providing infrastructure for higher-level apps.

Implications

Smart contracts on Steem! Need I say more? Not only that, these smart contracts can be computationally complex and will cost practically nothing to execute! This opens up a myriad of use cases that are either impossible or impractical to accomplish using other blockchains, creating opportunities to experiment with a wide array of economic incentives and currency distribution dynamics. Smart oracles will also provide the necessary foundation to build an ecosystem of protocols that will facilitate a rich ecosystem of apps.

Sort:  

Very close my feelings on this. Look forward to collaborating on the spec/paper 👏

Very interesting. How is it that the Steem blockchain could allow smart contracts costing practically nothing whilst Ethereum / Neo require "gas" payments to cover their costs?

Every single Ethereum miner has to process every single smart contract transaction and they all have to do Proof of Work, which takes a huge amount of computation power. With oracles, you don't need the miners to do the heavy computation - instead, a small set of elected oracle nodes do all the work, once they agree on the result, they update the main chain. With Steem, you get the additional benefit that miners (witnesses) don't have to do POW - they they have already proved their trust by the fact that they were elected by the network. So even Steem on-chain transactions are fast and cheap.

Thank you @balasan. Very clear!

Resteem your post to 2000+ followers for only 0.5 SBD or Steem)

Just send 0.5 SBD or steem to @steemvote (URL as memo)

New Followers get 0.001 SBD$ and an upvote for free!!

Just follow @steemvote and...

  • we follow back
  • send you 0.001 SBD to your wallet

Congratulations @balasan! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

You published your First Post
You got a First Reply

Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here

If you no longer want to receive notifications, reply to this comment with the word STOP

By upvoting this notification, you can help all Steemit users. Learn how here!

Congratulations @balasan! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

You got your First payout

Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here

If you no longer want to receive notifications, reply to this comment with the word STOP

By upvoting this notification, you can help all Steemit users. Learn how here!

Congratulations @balasan! You have received a personal award!

1 Year on Steemit
Click on the badge to view your own Board of Honor on SteemitBoard.

Upvote this notificationto to help all Steemit users. Learn why here!

Congratulations @balasan! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 2 years!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Vote for @Steemitboard as a witness to get one more award and increased upvotes!

Coin Marketplace

STEEM 0.18
TRX 0.13
JST 0.028
BTC 64450.12
ETH 3153.87
USDT 1.00
SBD 2.52