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
Category | Function | Input | Output | Description |
---|---|---|---|---|
Accounts | Register | domain:String, name:String | Account | |
UnRegister | Account | None | ||
AddSignatory | ||||
RemoveSignatory | ||||
SetSignatoryQuorum | ||||
Assets | Register | domain:String, name:String, quantity:Number, fees:Fees, permissions:Permissions | Asset | |
UnRegister | Asset | None | 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 | |
GroupAssets | Asset... | AssetGroup | ||
UngroupAssets | AssetGroup | Asset... | ||
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:Asset | Automatically does pathfinding through the XYKExchangePairs to find the optimal path from input asset to output asset, potentially with multiple trades in between. | |
Batches | Batch | 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. | |||
Domains | Register | name:String | Domain | |
Math | Add | Number... | Number | Takes 2 or more numbers and adds them together |
Subtract | Number1, Number2 | Number | Subtracts a number from another | |
Multiply | Number... | Number | Multiplies 2 or more numbers together | |
Divide | Number1, Number2 | Number | Divides one number by another one | |
RaisedTo | NumberBase, NumberPow | Number | Raises one number to another number | |
Mod | Number1, Number2 | Number | Takes the modulo of one number by another one | |
Conditionals | If | |||
IfNot | ||||
ElseIf | ||||
ElseIfNot | ||||
Else | ||||
Data | StoreBlob | name:String, data:Bytes | Stores arbitrary data | |
Events | OnBlockHeight | |||
OnTime | ||||
OnCondition | ||||
Peers | AddValidatingPeer | |||
RemoveValidatingPeer | ||||
Permissions | ||||
Queries | ||||
Resources
Code blocks visualization: