Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Status
IN PROGRESS
Stakeholders
Outcome
Due date
Owner

Background

Smart contracts have the potential to automate business processes and create logic that can be executed without human interaction. This can be useful for minimizing trust and creating truly decentralized applications.

...

https://github.com/hyperledger/iroha/blob/iroha2-dev/iroha_2_whitepaper.md

...

MathOps

(+/-, etc)

...

domain:String,

name:String

...

domain:String,

name:String,

quantity:Number,

fees:Fees,

permissions:Permissions

...

Removes registration of an asset.

...

Asset,

Account,

Quantity

...

Adds Quantity newly minted units of Asset to an Account.

Note: Permissions must allow this.

...

Asset,

Account,

Quantity

...

Deletes Quantity of Asset from an Account.

Note: Permissions must allow this

...

asset1:Asset,

asset2:Asset

...

asset2:Asset,

asset1:Asset

...

name:Domain,

name:Exchange,

fees:Fees,

permissions:Permissions

...

RegisterXYKExchangePair

...

AddXYKExchangeLiquidity

...

XYKExchangeTrade

...

AddOraclizedExchangePair

...

input:Asset,

target:Asset

...

Problem

Iroha Special Instructions should provide safe, fast and user-friendly way to make development of custom and basic smart contracts easier with Turing complete computations supported in it.

  • Simple usage
  • Compile time safety and checks if possible 
  • Turing Completeness

Solution

Iroha 2.0 will provide Iroha Special Instructions and Domain Specific Language for their description.

Iroha Special Instructions with all legal actions provided out-of-the-box with an ability to compose them and combine them with Triggers to create "custom" Iroha Special Instructions.

Good example of simple to use yet powerful DSL is Scratch. It has events (start, key_pressed, etc.), control (repeat, if, etc.),  actions (move, sound, etc.) types of blocks with possibility to combine them.

We can give several types of out-of-the-box Iroha Special Instructions and gave an ability to combine them.

Decisions

Iroha Special Instructions will have actions which can be applied to different domain entities:

  • Register/Unregister (account or asset definition in a domain)
  • Add/Remove (signatory to or from an account, trigger to the peer, domain to the peer, trusted peer to the peer)
  • Transfer (asset from one account to another)
  • Mint/Demint (asset quantity)

Iroha Special Instructions placed as triggers can listen to changes in the system:

  • OnBlockCreated
  • OnBlockchainHeight
  • OnWorldStateViewChange
  • OnTimestamp

Computational operations:

  • Sum
  • Subsctract
  • Multiply
  • Divide
  • RaiseTo
  • Mod

Permissions checks:

  • Can...

Composable types:

  • Pair(Instruction1, Instruction2)
  • Sequence(Vec<Instruction>)
  • If(Condition<Instruction>, Then<Instruction>, Else<Instruction>)

Custom Iroha Special Instructions can be build using composition of out-of-the-box Instructions:

  • Swap - `Pair(Transfer(A→B), Transfer(B→A)) 
  • Exchange

...

name:String,

data:Bytes

...


Resources

Code blocks visualization:

...