Adding the Declarative Non-Turing Complete Smart Contract System from Byteball to SteemsteemCreated with Sketch.

in #steemdev7 years ago (edited)

In my opinion Byteball is one of the most interesting and innovative cryptocurrencies and doesn't get enough love! It's builtin smart contract system is great for these reasons:

  1. It's easier to write contracts and understand how they work ( even for those with limited programming knowledge ) because contracts are written by describing what the contract needs to execute and not exactly how it should execute like Ethereum's imperative Solidity language. All you do is declare the variables and conditions required instead of step by step telling the system what to do.
    Wikipedia describes Declarative Programming like this:
    In computer science, declarative programming is a programming paradigm—a style of building the structure and elements of computer programs—that expresses the logic of a computation without describing its control flow.

  2. Smart contracts end up being a lot more secure if they are non-Turing complete because you can be 100% sure a contract is going to operate in the way it's expected. There's plenty of examples of complex Ethereum contracts having bugs that ended up causing the loss of millions of dollars (Anyone remember The DAO?). The most popular and practical use cases for smart contracts like conditional payments, escrow, prediction markets, insurance and gambling don't require the potential dangerous complexities introduced by turning completeness.

  3. Contracts are defined using JSON which is extensively used on the internet as well as on the Steem blockchain already. Let's look at a simple prediction market contract:

["or", [
  ["and", [
    ["address", "ADDRESS 1"],
    ["in data feed", [["EXCHANGE ADDRESS"], "EURUSD", ">", "1.1500"]]
  ]],
  ["and", [
    ["address", "ADDRESS 2"],
    ["in data feed", [["TIMESTAMPER ADDRESS"], "datetime", ">", "2017-10-01 00:00:00"]]
  ]]
]]

How it works is simple: funds stored in the contract's address can be redeemed by ADDRESS 1 if the oracle reports the price of 1 Euro to be greater than $1.15 OR if that doesn't happen before Oct 1, 2017 then ADDRESS 2 can claim the funds stored in this contract.

If this contract was adopted for use with Steem blockchain it could look like this:

["or", [
  ["and", [
    ["account", "@adept"],
    ["in price_feed", "STEEM", ">", "2.1500"]]
  ]],
  ["and", [
    ["address", "@birdinc"],
    ["in current_block",  "time", ">", "2017-10-01 00:00:00"]]
  ]]
]]

In this example, @adept is betting the price of STEEM as reported by the witness price_feed will be greater than $2.15 by Oct 1, 2017 or @birdinc can take all of the funds stored in the contract.

This expressed in pseudocode could look like this:

if STEEM_price > $2.15
  @adept is allowed to take funds
else if the current time is past midnight October 1st
  @birdinc is allowed to take the funds
end

I am not sure how technically challenging this type of functionality would be to add to the Steem blockchain however I believe it's addition could lead to the development of many "killer apps" built on top of Steem. The addition of user issued assets and tokens on Steemit, like Byteball has already would make this type of system even more powerful.

I urge the core-devs of Steem to strongly consider implementing a smart contract system like Byteball's and would love to get feedback on the feasibility of such a request!

I also recommend reading the Byteball Whitepaper for more in depth examples. https://byteball.org/Byteball.pdf

Thanks for reading!

Sort:  

This is really cool ! The possibilities would be endless if steemit had this.

Great to see you after a very long time and yeah byteball is good and smart system

I really don't understand all this but I think it is neat and you did a nice job of this post!!!

Thumbs Up!!

Definitely something to explore. I'll be curious to see what others with way more crypto knowledge have to say! 😀

i don't have very good programming language understanding but you wrote this post in a very simply language even a noob like me can understand thanks you so much buddy :)

I just look at the byteball website https://byteball.org/
and yes they have some pretty cool stufs in there and it is worth to look at it
anyway nice to see you back into action.
thanks for sharing . honestly i do not understand the codes . lol

Nicely explained buddy as for it seems it would be pretty good news for steem to go up $2. Let's hope for the best.

I will not to analyze this 200 times more to actualy understand it completly. But in essence this looks allright.

keep up the good work !!

really excellent work.

Coin Marketplace

STEEM 0.18
TRX 0.16
JST 0.031
BTC 63619.61
ETH 2698.75
USDT 1.00
SBD 2.59