6.1. 利用可能なコマンド一覧¶
コマンドは、システム内のエンティティ(アセット、アカウント)に対する特定のアクションを実行することにより、システムの状態(World State Viewと呼ばれる)を変更させます。 アクションを実行するには、コマンドをトランザクションに含める必要があります。
6.1.1. 該当資産の量を追加する¶
6.1.1.1. 目的¶
資産量を追加するコマンド(add asset quantity)の目的は、取引作成者のアカウント内の資産量を増やすことです。 ユースケースのシナリオでは、システム内の変更可能な資産の数を増やすことであり、それらは商品(例えば、貨幣や金など)に対する権利として機能します。
6.1.1.2. スキーム¶
message AddAssetQuantity {
string asset_id = 1;
string amount = 2;
}
注釈
Please note that due to a known issue you would not get any exception if you pass invalid precision value. Valid range is: 0 <= precision <= 255
6.1.1.3. 構造¶
フィールド | 説明 | 制約 | 例 |
---|---|---|---|
資産ID | 資産のID | <asset_name>#<domain_id> | usd#morgan |
量 | 追加すべき資産量(正数) | >0 | 200.02 |
6.1.1.4. 検証¶
- 資産とアカウントがなければなりません
- 追加された数量の精度は、資産精度と同じである必要があります
- トランザクションの作成者は、資産を発行する権限を有している必要があります
6.1.1.5. Possible Stateful Validation Errors¶
Code | Error Name | 説明 | How to solve |
---|---|---|---|
1 | Could not add asset quantity | Internal error happened | Try again or contact developers |
2 | No such permissions | Command's creator does not have permission to add asset quantity | Grant the necessary permission |
3 | No such asset | Cannot find asset with such name or such precision | Make sure asset id and precision are correct |
4 | Summation overflow | Resulting amount of asset is greater than the system can support | Make sure that resulting amount is less than 2^256 |
6.1.2. ピア(ノード)を追加する¶
6.1.2.1. 目的¶
add peerコマンドの目的は、ピアネットワークに向けてピアが追加された事実を台帳に書き込むことです。 AddPeerが実行されたトランザクションがコミットされた後、コンセンサスおよび同期コンポーネントがそれらの事実を適用し始めます。
6.1.2.2. スキーム¶
message AddPeer {
Peer peer = 1;
}
message Peer {
string address = 1;
bytes peer_key = 2;
}
6.1.2.3. 構造¶
フィールド | 説明 | 制約 | 例 |
---|---|---|---|
アドレス | ネットワーク内の解決可能なアドレス(IPv4、IPv6、ドメイン名など) | 解決可能なはずです | 192.168.1.1:50541 |
ピアが保有する鍵 | ピアの公開鍵(投票時のサインオフ、コミット、メッセージの拒否といった合意形成アルゴリズムで使用されます) | ed25519 公開鍵 | 292a8714694095edce6be799398ed5d6244cd7be37eb813106b217d850d261f2 |
6.1.2.4. 検証¶
- Peer key is unique (there is no other peer with such public key)
- トランザクションの作成者にはCanAddPeerの権限を有する役割が与えられています
- そのようなネットワークアドレスはまだ追加されていません
6.1.2.5. Possible Stateful Validation Errors¶
Code | Error Name | 説明 | How to solve |
---|---|---|---|
1 | Could not add peer | Internal error happened | Try again or contact developers |
2 | No such permissions | Command's creator does not have permission to add peer | Grant the necessary permission |
6.1.3. 署名者を追加する¶
6.1.3.1. 目的¶
署名追加のためのコマンドの目的は、アカウントに識別子を与えることです。 それら識別子は、他の端末の公開鍵またはユーザの公開鍵が用いられます。
6.1.3.2. スキーム¶
message AddSignatory {
string account_id = 1;
bytes public_key = 2;
}
6.1.3.3. 構造¶
フィールド | 説明 | 制約 | 例 |
---|---|---|---|
アカウントID | 新たな署名者を追加するアカウント | <account_name>@<domain_id> | makoto@soramitsu |
公開鍵 | アカウントに追加する署名者 | ed25519 公開鍵 | 359f925e4eeecfdd6aa1abc0b79a6a121a5dd63bb612b603247ea4f8ad160156 |
6.1.3.4. 検証¶
2つの事例:
ケース1:CanAddSignatoryの権限を有する取引作成者が、署名を自分のアカウントに追加したいと考えています。
ケース2. CanAddSignatoryがトランザクション作成者に付与されました
6.1.3.5. Possible Stateful Validation Errors¶
Code | Error Name | 説明 | How to solve |
---|---|---|---|
1 | Could not add signatory | Internal error happened | Try again or contact developers |
2 | No such permissions | Command's creator does not have permission to add signatory | Grant the necessary permission |
3 | No such account | Cannot find account to add signatory to | Make sure account id is correct |
4 | Signatory already exists | Account already has such signatory attached | Choose another signatory |
6.1.4. 役割を追加する¶
6.1.4.1. 目的¶
AppendRole(役割の追加)コマンドの目的は、システム内で既に存在する役割をあるアカウントが担うことができるようにすることです。この役割(Role)とは、アカウントがシステム内での特定のアクション(コマンド又はクエリ)を実行するために必要な権限です。
6.1.4.2. スキーム¶
message AppendRole {
string account_id = 1;
string role_name = 2;
}
6.1.4.3. 構造¶
フィールド | 説明 | 制約 | 例 |
---|---|---|---|
アカウントID | 役割を追加するIDまたはアカウント | 既に存在する | makoto@soramitsu |
Role name (役割名) | システム内ですでに規定された役割名 | 既に存在する | 貨幣の発行者 |
6.1.4.4. 検証¶
- 役割はシステムに存在しているはずです
- 取引の作成者は役割を追加する権限が必要です(CanAppendRole)
- Account, which appends role, has set of permissions in his roles that is a superset of appended role (in other words no-one can append role that is more powerful than what transaction creator is)
6.1.4.5. Possible Stateful Validation Errors¶
Code | Error Name | 説明 | How to solve |
---|---|---|---|
1 | Could not append role | Internal error happened | Try again or contact developers |
2 | No such permissions | Command's creator does not have permission to append role | Grant the necessary permission |
3 | No such account | Cannot find account to append role to | Make sure account id is correct |
4 | No such role | Cannot find role with such name | Make sure role id is correct |
6.1.5. アカウントを新規作成する¶
6.1.5.1. 目的¶
CreateAccountコマンドの目的は、トランザクションやクエリの送信、署名者、個人情報および識別子を格納することができるエンティティをシステム内に作成することです。
6.1.5.2. スキーム¶
message CreateAccount {
string account_name = 1;
string domain_id = 2;
bytes public_key = 3;
}
6.1.5.3. 構造¶
フィールド | 説明 | 制約 | 例 |
---|---|---|---|
Account name(アカウント名) | ドメイン内で一意のアカウント名 | [a-z_0-9]{1,32} | morgan_stanley |
ドメインID | 関係するターゲットドメイン | アカウントの前に作成する必要があります | america |
公開鍵 | アカウントに追加する最初の公開鍵 | ed25519 公開鍵 | 407e57f50ca48969b08ba948171bb2435e035d82cec417e18e4a38f5fb113f83 |
6.1.5.4. 検証¶
- 取引作成者にはアカウントを作成する権限があります
- domain_idとして渡されたドメインは、すでにシステム内で作成されています
- そのような公開鍵は、アカウントの最初の公開鍵として追加されていないか、またはマルチ署名アカウントに追加されていません
6.1.5.5. Possible Stateful Validation Errors¶
Code | Error Name | 説明 | How to solve |
---|---|---|---|
1 | Could not create account | Internal error happened | Try again or contact developers |
2 | No such permissions | Command's creator either does not have permission to create account or tries to create account in a more privileged domain, than the one creator is in | Grant the necessary permission or choose another domain |
3 | No such domain | Cannot find domain with such name | Make sure domain id is correct |
4 | Account already exists | Account with such name already exists in that domain | Choose another name |
6.1.6. アセットを発行する¶
6.1.6.1. 目的¶
create assetコマンドの目的は、ドメイン内で一意の新規アセットを作成することです。 資産とは、商品の可算表現です。
6.1.6.2. スキーム¶
message CreateAsset {
string asset_name = 1;
string domain_id = 2;
uint32 precision = 3;
}
注釈
Please note that due to a known issue you would not get any exception if you pass invalid precision value. Valid range is: 0 <= precision <= 255
6.1.6.3. 構造¶
フィールド | 説明 | 制約 | 例 |
---|---|---|---|
Asset name (資産名) | ドメイン内で一意のアセット名 | [a-z_0-9]{1,32} | soracoin |
ドメインID | 関係するターゲットドメイン | RFC1035 [1], RFC1123 [2] | japan |
Precision (精度) | コンマ/ドットに後につづく桁数 | 0 <= precision <= 255 | 2 |
6.1.6.4. 検証¶
- トランザクション作成者にアセットを作成する権限があります
- アセット名はドメイン内で一意です
6.1.6.5. Possible Stateful Validation Errors¶
Code | Error Name | 説明 | How to solve |
---|---|---|---|
1 | Could not create asset | Internal error happened | Try again or contact developers |
2 | No such permissions | Command's creator does not have permission to create asset | Grant the necessary permission |
3 | No such domain | Cannot find domain with such name | Make sure domain id is correct |
4 | Asset already exists | Asset with such name already exists | Choose another name |
6.1.7. ドメインを作成する¶
6.1.7.1. 目的¶
CreateDomainコマンドの目的は、イロハネットワークに新しいドメインを作成することで、ドメインは複数のアカウントで構成されるひとつのグループです。
6.1.7.2. スキーム¶
message CreateDomain {
string domain_id = 1;
string default_role = 2;
}
6.1.7.3. 構造¶
フィールド | 説明 | 制約 | 例 |
---|---|---|---|
ドメインID | 作成されたドメインのID | 一意に区別される、RFC1035 [1], RFC1123 [2] | japan05 |
デフォルトでの役割 | ドメイン内で作成されたユーザーの役割 | 既にシステム内に存在する役割 | User |
6.1.7.4. 検証¶
- ドメインIDが一意
- トランザクションでこのコマンドを送信するアカウントは、ドメインの作成権限を有する役割を持っていること
- 既に作成されていたユーザーに割り当てられる役割が、システム内に存在すること
6.1.7.5. Possible Stateful Validation Errors¶
Code | Error Name | 説明 | How to solve |
---|---|---|---|
1 | Could not create domain | Internal error happened | Try again or contact developers |
2 | No such permissions | Command's creator does not have permission to create domain | Grant the necessary permission |
3 | Domain already exists | Domain with such name already exists | Choose another domain name |
4 | No default role found | Role, which is provided as a default one for the domain, is not found | Make sure the role you provided exists or create it |
6.1.8. 役割を作成する¶
6.1.8.1. 目的¶
CreateRoleコマンドの目的は、一連の権限の中から新しい役割をシステム内に追加することです。 イロハのピアネットワークの管理・運営担当者は、異なる権限を役割に組み合わせることで、カスタマイズされたセキュリティモデルを構築することができます。
6.1.8.2. スキーム¶
message CreateRole {
string role_name = 1;
repeated RolePermission permissions = 2;
}
6.1.8.3. 構造¶
フィールド | 説明 | 制約 | 例 |
---|---|---|---|
Role name (役割名) | 作成する役割の名称 | [a-z_0-9]{1,32} | User |
RolePermission | 既存の権限の配列 | 渡された一連のアクセス許可は、既存のアクセス許可に全て含まれていること | {can_receive, can_transfer} |
6.1.8.4. 検証¶
- 渡された一連のアクセス許可は、既存のアクセス許可に全て含まれていること
- ひとつ以上の権限が設定されていること
6.1.8.5. Possible Stateful Validation Errors¶
Code | Error Name | 説明 | How to solve |
---|---|---|---|
1 | Could not create role | Internal error happened | Try again or contact developers |
2 | No such permissions | Command's creator does not have permission to create role | Grant the necessary permission |
3 | Role already exists | Role with such name already exists | Choose another role name |
6.1.9. 役割を切り離す¶
6.1.9.1. 目的¶
DetachRoleコマンドの目的は、アカウントに付与された役割から特定の役割を切り離すことです。 このコマンドを実行することにより、ユーザのシステムで実行可能なアクションの数を減らすことができます。
6.1.9.2. スキーム¶
message DetachRole {
string account_id = 1;
string role_name = 2;
}
6.1.9.3. 構造¶
フィールド | 説明 | 制約 | 例 |
---|---|---|---|
アカウントID | 役割が削除されるアカウントのID | 既に存在する | makoto@soramitsu |
Role name (役割名) | 削除する役割の名称 | 既存の役割であること | User |
6.1.9.4. 検証¶
- 削除される役割がシステムに存在する
- アカウントが削除される役割を持っている
6.1.9.5. Possible Stateful Validation Errors¶
Code | Error Name | 説明 | How to solve |
---|---|---|---|
1 | Could not detach role | Internal error happened | Try again or contact developers |
2 | No such permissions | Command's creator does not have permission to detach role | Grant the necessary permission |
3 | No such account | Cannot find account to detach role from | Make sure account id is correct |
4 | No such role in account's roles | Account with such id does not have role with such name | Make sure account-role pair is correct |
5 | No such role | Role with such name does not exist | Make sure role id is correct |
6.1.10. 権限を与える¶
6.1.10.1. 目的¶
GrantPermissionコマンドの目的は、取引の送信者のアカウントに対して特定のアクションを実行する権限を別のアカウントに与えることです(自分のアカウントに対して何かを行う権限を他者に与える)。
6.1.10.2. スキーム¶
message GrantPermission {
string account_id = 1;
GrantablePermission permission = 2;
}
6.1.10.3. 構造¶
フィールド | 説明 | 制約 | 例 |
---|---|---|---|
アカウントID | id of the account to which the rights are granted | 既に存在する | makoto@soramitsu |
GrantablePermission name | name of grantable permission | 許可が拒否される | CanTransferAssets |
6.1.10.4. 検証¶
- アカウントが存在する
- トランザクションの作成者がその許可を与えることができる
6.1.10.5. Possible Stateful Validation Errors¶
Code | Error Name | 説明 | How to solve |
---|---|---|---|
1 | Could not grant permission | Internal error happened | Try again or contact developers |
2 | No such permissions | Command's creator does not have permission to grant permission | Grant the necessary permission |
3 | No such account | Cannot find account to grant permission to | Make sure account id is correct |
6.1.11. 署名者を削除する¶
6.1.11.1. 目的¶
RemoveSignatoryコマンドの目的は、特定のIDと関連付けられた公開鍵をそのアカウントから削除することです
6.1.11.2. スキーム¶
message RemoveSignatory {
string account_id = 1;
bytes public_key = 2;
}
6.1.11.3. 構造¶
フィールド | 説明 | 制約 | 例 |
---|---|---|---|
アカウントID | id of the account to which the rights are granted | 既に存在する | makoto@soramitsu |
公開鍵 | 削除する署名者 | ed25519 公開鍵 | 407e57f50ca48969b08ba948171bb2435e035d82cec417e18e4a38f5fb113f83 |
6.1.11.4. 検証¶
- 署名者の削除が実行された後に、** size(signatories)> = quorum **の不変式が成立するかどうかを調べる必要があります
- 署名者が削除される以前にアカウントに追加されていた必要があります
2つの事例:
ケース1:トランザクションの作成者が署名者をアカウントから削除したい場合、CanRemoveSignatoryの実行権限を得ていること
ケース2. CanRemoveSignatoryがトランザクション作成者に付与されていたこと
6.1.11.5. Possible Stateful Validation Errors¶
Code | Error Name | 説明 | How to solve |
---|---|---|---|
1 | Could not remove signatory | Internal error happened | Try again or contact developers |
2 | No such permissions | Command's creator does not have permission to remove signatory from his account | Grant the necessary permission |
3 | No such account | Cannot find account to remove signatory from | Make sure account id is correct |
4 | No such signatory | Cannot find signatory with such public key | Make sure public key is correct |
5 | Quorum does not allow to remove signatory | After removing the signatory account will be left with less signatories, than its quorum allows | Reduce the quorum |
6.1.12. 権限を取り消す¶
6.1.12.1. 目的¶
RevokePermissionコマンドの目的は、与えられていた権限をネットワーク内の別のアカウントから取り消すことです。
6.1.12.2. スキーム¶
message RevokePermission {
string account_id = 1;
GrantablePermission permission = 2;
}
6.1.12.3. 構造¶
フィールド | 説明 | 制約 | 例 |
---|---|---|---|
アカウントID | id of the account to which the rights are granted | 既に存在する | makoto@soramitsu |
GrantablePermission name | name of grantable permission | 実行権限が与えられていたこと | CanTransferAssets |
6.1.12.4. 検証¶
トランザクションの作成者は、以前にこの権限をターゲットアカウントに付与している必要があります
6.1.12.5. Possible Stateful Validation Errors¶
Code | Error Name | 説明 | How to solve |
---|---|---|---|
1 | Could not revoke permission | Internal error happened | Try again or contact developers |
2 | No such permissions | Command's creator does not have permission to revoke permission | Grant the necessary permission |
3 | No such account | Cannot find account to revoke permission from | Make sure account id is correct |
6.1.13. アカウントの詳細を設定する¶
6.1.13.1. 目的¶
SetAccountDetailコマンドの目的は、特定のアカウントのキーバリュー情報を設定することです
警告
If there was a value for a given key already in the storage then it will be replaced with the new value
6.1.13.2. スキーム¶
message SetAccountDetail{
string account_id = 1;
string key = 2;
string value = 3;
}
6.1.13.3. 構造¶
フィールド | 説明 | 制約 | 例 |
---|---|---|---|
アカウントID | id of the account to which the key-value information was set | 既に存在する | makoto@soramitsu |
Key | 設定されるキーに関する情報 | [A-Za-z0-9_]{1,64} | Name |
Value | 対応するキーの値 | ≤ 4096 | Makoto |
6.1.13.4. 検証¶
2つの事例:
ケース1.取引の作成者が口座の詳細情報を設定したい場合に、その作成者がCanSetAccountInfoの実行権限を得ている
ケース2. CanSetAccountInfoがトランザクション作成者に付与された場合
6.1.13.5. Possible Stateful Validation Errors¶
Code | Error Name | 説明 | How to solve |
---|---|---|---|
1 | Could not set account detail | Internal error happened | Try again or contact developers |
2 | No such permissions | Command's creator does not have permission to set account detail for another account | Grant the necessary permission |
3 | No such account | Cannot find account to set account detail to | Make sure account id is correct |
6.1.14. アカウントの定足数を設定する¶
6.1.14.1. 目的¶
SetAccountQuorumコマンドの目的は、トランザクションを作成するユーザーの身元を確認するために必要な署名者の定足数を設定することです。 ユース・ケース・シナリオにおいては、単一アカウントで異なるユーザー数を設定し、トランザクションをサインオフすることです。
6.1.14.2. スキーム¶
message SetAccountQuorum {
string account_id = 1;
uint32 quorum = 2;
}
6.1.14.3. 構造¶
フィールド | 説明 | 制約 | 例 |
---|---|---|---|
アカウントID | 定足数を設定するアカウントのID | 既に存在する | makoto@soramitsu |
Quorum | number of signatories needed to be included within a transaction from this account | 0 < quorum ≤ public-key set up to account ≤ 128 | 5 |
6.1.14.4. 検証¶
定足数が設定されると、**size(signatories) >= quorum**の不変式が成立するかどうかがチェックされます。
2つの事例:
ケース1.トランザクション作成者がアカウントの定足数を設定し、かつそのユーザーがCanRemoveSignatory権限を持っている場合
ケース2. CanRemoveSignatoryがトランザクション作成者に付与されていたこと
6.1.14.5. Possible Stateful Validation Errors¶
Code | Error Name | 説明 | How to solve |
---|---|---|---|
1 | Could not set quorum | Internal error happened | Try again or contact developers |
2 | No such permissions | Command's creator does not have permission to set quorum for his account | Grant the necessary permission |
3 | No such account | Cannot find account to set quorum to | Make sure account id is correct |
4 | No signatories on account | Cannot find any signatories attached to the account | Add some signatories before setting quorum |
5 | New quorum is incorrect | New quorum size is less than account's signatories amount | Choose another value or add more signatories |
6.1.15. 資産量を減らす¶
6.1.15.1. 目的¶
SubtractAssetQuantityコマンドの目的は、取引の作成者のアカウント内の資産量を減らすためです。AddAssetQuantityコマンドの逆の操作になります。
6.1.15.2. スキーム¶
message SubtractAssetQuantity {
string asset_id = 1;
string amount = 2;
}
注釈
Please note that due to a known issue you would not get any exception if you pass invalid precision value. Valid range is: 0 <= precision <= 255
6.1.15.3. 構造¶
フィールド | 説明 | 制約 | 例 |
---|---|---|---|
資産ID | 資産のID | <asset_name>#<domain_id> | usd#morgan |
量 | 差し引く資産量(正数) | >0 | 200 |
6.1.15.4. 検証¶
- 資産とアカウントがなければなりません
- 追加された数量の精度は、資産精度と同じである必要があります
- トランザクションの作成者は、資産を引き出す権限を持つ役割を持つ必要があります
6.1.15.5. Possible Stateful Validation Errors¶
Code | Error Name | 説明 | How to solve |
---|---|---|---|
1 | Could not subtract asset quantity | Internal error happened | Try again or contact developers |
2 | No such permissions | Command's creator does not have permission to subtract asset quantity | Grant the necessary permission |
3 | No such asset found | Cannot find asset with such name or precision in account's assets | Make sure asset name and precision are correct |
4 | Not enough balance | Account's balance is too low to perform the operation | Add asset to account or choose lower value to subtract |
6.1.16. 資産を移転させる¶
6.1.16.1. 目的¶
TransferAssetコマンドの目的は、ピアネットワーク内のアカウント間で資産を共有することです。移転元アカウントが資産を移転先ターゲットアカウントに転送する方法です。
6.1.16.2. スキーム¶
message TransferAsset {
string src_account_id = 1;
string dest_account_id = 2;
string asset_id = 3;
string description = 4;
string amount = 5;
}
6.1.16.3. 構造¶
フィールド | 説明 | 制約 | 例 |
---|---|---|---|
Source account ID (移転元口座) | ID of the account to withdraw the asset from | 既に存在する | makoto@soramitsu |
Destination account ID (移転先口座) | ID of the account to send the asset to | 既に存在する | alex@california |
資産ID | ID of the asset to transfer | 既に存在する | usd#usa |
説明 | Message to attach to the transfer | 最大64文字まで | here's my money take it |
量 | 移転する資産の量(金額など) | 0 <= precision <= 255 | 200.20 |
6.1.16.4. 検証¶
- 移転元アカウントのAccountHasAssetに当該アセットがあること
- 移転する量(金額など)が正数で、精度が資産定義項目と一致すること
- ソースアカウントに転送する資産が十分にあり、ゼロではないこと
- 送信元アカウントがお金を転送することができ、宛先アカウントもお金を受け取ることができる(それぞれにこれらの権限が付与されていること)
6.1.16.5. Possible Stateful Validation Errors¶
Code | Error Name | 説明 | How to solve |
---|---|---|---|
1 | Could not transfer asset | Internal error happened | Try again or contact developers |
2 | No such permissions | Command's creator does not have permission to transfer asset from his account | Grant the necessary permission |
3 | No such source account | Cannot find account with such id to transfer money from | Make sure source account id is correct |
4 | No such destination account | Cannot find account with such id to transfer money to | Make sure destination account id is correct |
5 | No such asset found | Cannot find such asset | Make sure asset name and precision are correct |
6 | Not enough balance | Source account's balance is too low to perform the operation | Add asset to account or choose lower value to subtract |
7 | Too much asset to transfer | Resulting value of asset amount overflows destination account's amount | Make sure final value is less than 2^256 |
[1] | (1, 2, 3) https://www.ietf.org/rfc/rfc1035.txt |
[2] | (1, 2) https://www.ietf.org/rfc/rfc1123.txt |