You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 21 Next »

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.

In Iroha v1 a finite set of commands was provided, but they were inflexible and Turing complete computation was not possible. To increase the usefulness of Iroha, in v2 we allow full, Turing complete computation, while still making common tasks easy by providing Iroha Special Instructions (ISI).

In other blockchain platforms, complex smart contract features exist, for example Ethereum Solidity. However, the style of creating a contract, deploying it, and then sending tokens, etc., to the contract to interact with it seems to not only have a lot of overhead, but is itself quite prone to mistakes and attacks. In Iroha we take the approach where we use a simple data model consisting of domains, accounts, and assets, which then can go through various interactions to change their properties. In this way, if someone wants to create some logic involving an asset, for example, an Event trigger can be put on transactions for the asset that matches certain parameters and instructions can be executed on the asset. In this way, ISI works more like database triggers than deployed smart contracts, as in Ethereum.

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

ActionsDomainAccountAsset
RegisterAccount, Asset

UnregisterAccount, Asset

Add
SignatoryQuantity
Remove
Signatory
Transfer


Event


CategoryFunctionInputOutputDescription
AccountsRegister

domain:String,

name:String

Account

UnRegisterAccountNone

AddSignatory



RemoveSignatory



SetSignatoryQuorum


AssetsRegister

domain:String,

name:String,

quantity:Number,

fees:Fees,

permissions:Permissions

Asset

UnRegisterAssetNone

Removes registration of an asset.


Mint

Asset,

Account,

Quantity

Asset

Adds Quantity newly minted units of Asset to an Account.

Note: Permissions must allow this.


Demint

Asset,

Account,

Quantity

Asset

Deletes Quantity of Asset from an Account.

Note: Permissions must allow this


GroupAssetsAsset...AssetGroup

UngroupAssetsAssetGroupAsset...

Transfer



SwapAssets

asset1:Asset,

asset2:Asset

asset2:Asset,

asset1:Asset



CreateXYKExchange

name:Domain,

name:Exchange,

fees:Fees,

permissions:Permissions





RegisterXYKExchangePair





AddXYKExchangeLiquidity





XYKExchangeTrade





AddOraclizedExchangePair





ChainedXYKExchangeTrade

input:Asset,

target:Asset

tradeOutput:AssetAutomatically does pathfinding through the XYKExchangePairs to find the optimal path from input asset to output asset, potentially with multiple trades in between.
BatchesBatch

Batches commands with the constraint that within the batch, no new assets are created and units of an asset are not added.

BatchUnconserved

Batches commands, allowing new assets and units of an asset to be added.
DomainsRegistername:StringDomain
MathAddNumber...NumberTakes 2 or more numbers and adds them together

SubtractNumber1, Number2NumberSubtracts a number from another

MultiplyNumber...NumberMultiplies 2 or more numbers together

DivideNumber1, Number2NumberDivides one number by another one

RaisedToNumberBase, NumberPowNumberRaises one number to another number

ModNumber1, Number2NumberTakes the modulo of one number by another one
ConditionalsIf



IfNot



ElseIf



ElseIfNot



Else


DataStoreBlob

name:String,

data:Bytes


Stores arbitrary data
EventsOnBlockHeight



OnTime



OnCondition


PeersAddValidatingPeer



RemoveValidatingPeer


Permissions



Queries








Resources

Code blocks visualization:

  • No labels