6.1. 커맨드

커맨드는 시스템 내부의 객체(에셋, 계정)에 대한 일련의 작업들을 수행하면서 World State View라고 하는 상태를 변화시킵니다. 어떤 커맨드들이 작업을 수행하려면 반드시 트랜젝션에 포함되어야 합니다.

6.1.1. Add asset quantity

6.1.1.1. 목적

에셋 수량

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. 구조

필드명 설명 조건 Example
에셋 ID 에셋의 ID <asset_name>#<domain_id> usd#morgan
수량 추가할 에셋의 수량(양수) >0 200.02

6.1.1.4. 검증

  1. 에셋과 계정은 존재해야 합니다.
  2. Added quantity precision should be equal to asset precision
  3. 트랜젝션 생성자는 에셋을 발행할 수 있는 권한을 가지고 있는 역할(role)이어야 합니다.

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. 목적

피어 추가하기 커맨드는

6.1.2.2. 스키마

message AddPeer {
    Peer peer = 1;
}

message Peer {
    string address = 1;
    bytes peer_key = 2;
}

6.1.2.3. 구조

필드명 설명 조건 Example
주소 resolvable address in network (IPv4, IPv6, domain name, etc.) resolvable해야 한다. 192.168.1.1:50541
피어 키(Peer Key) 합의 알고리즘에서 vote에 사인하고 커밋하고 메시지를 거부하기 위해 사용되는 피어 공개키 ed25519 공개키 292a8714694095edce6be799398ed5d6244cd7be37eb813106b217d850d261f2

6.1.2.4. 검증

  1. Peer key is unique (there is no other peer with such public key)
  2. 트랜젝션의 생성자가 CanAddPeer 권한이 있는 역할(role)을 가져야 합니다.
  3. 네트워크의 주소가 이전에 추가된 적이 없어야 합니다.

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. 목적

서명 추가하기 커맨드는 계정에 identifier를 더하는 것을 목적으로 합니다. Identifier란 다른 디바이스의 공개키 또는 다른 유저의 공개키를 의미합니다.

6.1.3.2. 스키마

message AddSignatory {
    string account_id = 1;
    bytes public_key = 2;
}

6.1.3.3. 구조

필드명 설명 조건 Example
계정 ID 서명을 추가할 계정 <account_name>@<domain_id> makoto@soramitsu
공개키 계정에 추가할 서명 ed25519 공개키 359f925e4eeecfdd6aa1abc0b79a6a121a5dd63bb612b603247ea4f8ad160156

6.1.3.4. 검증

두 가지 케이스:

케이스 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. 목적

역할 추가하기(Append Role) 커맨드는 특정 계정(Account)에 시스템에 정의된 역할(Role)을 부여하기 위해 사용합니다. 역할이란 시스템 내에서 어떤 행동을 할 때 필요한 권한의 집합을 의미합니다.

6.1.4.2. 스키마

message AppendRole {
   string account_id = 1;
   string role_name = 2;
}

6.1.4.3. 구조

필드명 설명 조건 Example
계정 ID 역할에 추가할 ID 또는 계정 이미 존재해야 합니다. makoto@soramitsu
Role name(역할 이름) 이미 정의된 역할의 이름 이미 존재해야 합니다. MoneyCreator

6.1.4.4. 검증

  1. 역할이 이미 시스템 내부에 정의되어 있어야 합니다.
  2. 트잰섹션 생성자는 역할을 추가할 수 있는 권한을 가지고 있어야 합니다. (CanAppendRole)
  3. 역할을 추가하는 계정은 계정에 추가할 역할을 포함(superset)하는 역할을 가져야 합니다. 다시 말해, 누구도 트랜젝션 생성자 만큼이나 강력한 역할을 추가할 수 없다는 것을 의미합니다.

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. 목적

계정 생성하기 커맨든는 시스템에 트랜젝션이나 쿼리를 보낼 수 있고 서명과 개인정보 및 ID를 저장할 수 있는 객체를 만들 때 사용합니다.

6.1.5.2. 스키마

message CreateAccount {
    string account_name = 1;
    string domain_id = 2;
    bytes public_key = 3;
}

6.1.5.3. 구조

필드명 설명 조건 Example
계정 이름(Account Name) 계정의 이름(도메인 내부의 다른 계정과 이름이 겹치지 않아야 함) [a-z_0-9]{1,32} morgan_stanley
도메인 ID target domain to make relation with should be created before the account america
공개키 계정에 추가할 첫 공개키 ed25519 공개키 407e57f50ca48969b08ba948171bb2435e035d82cec417e18e4a38f5fb113f83

6.1.5.4. 검증

  1. 트랜젝션의 생성자는 계정을 생성할 수 있는 권한이 있어야 합니다.
  2. domain_id로 넘겨지는 도메인은 이미 시스템에 만들어져 있어야 합니다.
  3. Such public key has not been added before as first public key of account or added to a multi-signature account

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. 목적

에셋 생성 커맨드는 새로운 타입의 에셋을 만들 때 사용합니다. 각 에셋은 같은 도메인 내에서 중복되지 않아야 합니다. 에셋은 상품을 셀 수 있는 형식(Countable Representation)으로 표현한 것으로 볼 수 있습니다.

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. 구조

필드명 설명 조건 Example
에셋 이름(Asset name) 에셍의 이름(같은 도메인 내부에 중복되는 이름이 없어야 합니다.) [a-z_0-9]{1,32} soracoin
도메인 ID target domain to make relation with RFC1035 [1], RFC1123 [2] japan
정밀도(Precision) ,(콤마) 이나 .(마침표) 다음에 오는 숫자의 수(소수 부분) 0 <= precision <= 255 2

6.1.6.4. 검증

  1. 트랜젝션 생성자가 에셋을 생성할 수 있는 권한을 가지고 있어야 합니다.
  2. 도메인 내부에서 고유한 에셋 이름을 가져야 합니다.

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. 목적

도메인 생성하기 커맨드는 Iroha 네트워크에 새로운 도메인을 만들기 위해 사용됩니다. 도메인은 계정들로 구성된 하나의 그룹을 의미합니다.

6.1.7.2. 스키마

message CreateDomain {
    string domain_id = 1;
    string default_role = 2;
}

6.1.7.3. 구조

필드명 설명 조건 Example
도메인 ID 생성된 도메인의 ID 고유해야 합니다., RFC1035 [1], RFC1123 [2] japan05
디폴트 역할(Role) 도메인에 생성된 유저들이 기본적으로 갖게 되는 역할 이미 존재하는 역할 중 하나여야 합니다. User

6.1.7.4. 검증

  1. 도메인 ID는 중복되지 않아야 합니다.
  2. 이 커맨드를 트랜젝션에 보내는 계정은 도메인을 생성할 수 있는 권한을 가지고 있어야 합니다.
  3. 디폴트 역할은 시스템 내부에 이미 존재하는 역할이어야 합니다.

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. 목적

The purpose of create role command is to create a new role in the system from the set of permissions. Combining different permissions into roles, maintainers of Iroha peer network can create customized security model.

6.1.8.2. 스키마

message CreateRole {
    string role_name = 1;
    repeated RolePermission permissions = 2;
}

6.1.8.3. 구조

필드명 설명 조건 Example
Role name(역할 이름) 생성되는 역할의 이름 [a-z_0-9]{1,32} User
RolePermission 이미 존재하는 관한들의 배열 인수로 넘기는 권한들이 이미 존재하는 권한들이어야 합니다. {can_receive, can_transfer}

6.1.8.4. 검증

  1. 인수로 넘기는 권한들이 이미 존재하는 권한들이어야 합니다.
  2. 인수로 넘기는 권한의 배열이 비어있지 않아야 합니다.

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. 목적

The purpose of detach role command is to detach a role from the set of roles of an account. By executing this command it is possible to decrease the number of possible actions in the system for the user.

6.1.9.2. 스키마

message DetachRole {
    string account_id = 1;
    string role_name = 2;
}

6.1.9.3. 구조

필드명 설명 조건 Example
계정 ID 역할을 제거할 계정의 ID 이미 존재해야 합니다. makoto@soramitsu
Role name(역할 이름) 제거할 역할의 이름 존재하는 역할 User

6.1.9.4. 검증

  1. 시스템에 이미 존재하는 역할이어야 합니다.
  2. 계정이 그러한 역할을 가지고 있어야 합니다.

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. 권한(Permission) 부여하기

6.1.10.1. 목적

계정 부여하기 커맨드는 다른 계정에게

6.1.10.2. 스키마

message GrantPermission {
    string account_id = 1;
    GrantablePermission permission = 2;
}

6.1.10.3. 구조

필드명 설명 조건 Example
계정 ID id of the account to which the rights are granted 이미 존재해야 합니다. makoto@soramitsu
GrantablePermission name name of grantable permission 권한이 이미 정의되어 있어야 합니다. CanTransferAssets

6.1.10.4. 검증

  1. 계정이 존재해야 합니다.
  2. 트랜젝션의 생성자가 권한을 부여할 수 있어야 합니다.

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. 목적

서명 제거하기 커맨드는 계정에서 공개키를 제거할 때 사용됩니다.

6.1.11.2. 스키마

message RemoveSignatory {
    string account_id = 1;
    bytes public_key = 2;
}

6.1.11.3. 구조

필드명 설명 조건 Example
계정 ID id of the account to which the rights are granted 이미 존재해야 합니다. makoto@soramitsu
공개키 제거할 서명 ed25519 공개키 407e57f50ca48969b08ba948171bb2435e035d82cec417e18e4a38f5fb113f83

6.1.11.4. 검증

  1. 서명이 제거되면 size(signatories) >= quorum 조건을 만족하는지 반드시 확인해야 합니다.
  2. 서명은 이전에 계정에 추가된 적이 있어야 합니다.

두 가지 케이스:

케이스 1: 트랜젝션 생성자가 자신 아닌 다른 계정에서 서명을 제거하려고 하고 자신이 CanRemoveSignatory 권한을 가진 경우

Case 2. CanRemoveSignatory was granted to transaction creator

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. 권한(Permission) 제거하기

6.1.12.1. 목적

권한 제거하기 커맨드는 네트워크 내의 다른 계정의 권한을 제거할 때 사용됩니다.

6.1.12.2. 스키마

message RevokePermission {
    string account_id = 1;
    GrantablePermission permission = 2;
}

6.1.12.3. 구조

필드명 설명 조건 Example
계정 ID id of the account to which the rights are granted 이미 존재해야 합니다. makoto@soramitsu
GrantablePermission name name of grantable permission 이전에 부여받은 권한이어야 합니다. CanTransferAssets

6.1.12.4. 검증

Transaction creator should have previously granted this permission to a target account

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. 목적

계정 정보 설정하기 커맨드는 계정의 키-값(key-value) 형태의 정보를 설정하기 위해 사용됩니다.

경고

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. 구조

필드명 설명 조건 Example
계정 ID id of the account to which the key-value information was set 이미 존재해야 합니다. makoto@soramitsu
설정된 [A-Za-z0-9_]{1,64} Name
Value 키에 대응하는 값 ≤ 4096 Makoto

6.1.13.4. 검증

두 가지 케이스:

케이스 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. Set account quorum

6.1.14.1. 목적

The purpose of set account quorum command is to set the number of signatories required to confirm the identity of a user, who creates the transaction. Use case scenario is to set the number of different users, utilizing single account, to sign off the transaction.

6.1.14.2. 스키마

message SetAccountQuorum {
    string account_id = 1;
    uint32 quorum = 2;
}

6.1.14.3. 구조

필드명 설명 조건 Example
계정 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 조건을 만족해야 합니다.

두 가지 케이스:

케이스 1: 트랜젝션 생성자가 자신의 계정의 정족수를 설정하기 원하고 자신이 CanRemoveSignatory 권한을 가진 경우

Case 2. CanRemoveSignatory was granted to transaction creator

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. Subtract asset quantity

6.1.15.1. 목적

에셋 수량 줄이기 커맨드는 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. 구조

필드명 설명 조건 Example
에셋 ID 에셋의 ID <asset_name>#<domain_id> usd#morgan
수량 줄일 수량은 양수여야 합니다. >0 200

6.1.15.4. 검증

  1. 에셋과 계정은 존재해야 합니다.
  2. Added quantity precision should be equal to asset precision
  3. 트랜젝션의 생성자는 에셋의 수량을 줄일 수 있는 권한을 가진 역할이어야 합니다.

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. 목적

에셋 보내기 커맨드는 피어 네트워크에 있는 한 계정에서 다른 계정으로 에셋을 전달할 때 사용됩니다.

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. 구조

필드명 설명 조건 Example
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. 검증

  1. 보내는 계정은 AccountHasAsset 관계를 가진 에셋을 소유하고 있어야 합니다. [1]
  2. 수량은 0보다 커야 하며 에셋의 정밀도는 에셋에 정의된 정밀도와 일치해야 합니다.
  3. 보내는 계정은 전달할 에셋의 수량보다 많은 에셋을 소유하고 있어야 하며 0이 아니어야 합니다.
  4. Source account can transfer money, and destination account can receive money (their roles have these permissions)

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