Search code examples
pythonpermissionshyperledger-iroha

How to add permission can_get_all_acc_detail to an account of existing blockchain network on hyperledger-iroha?


I want to add account, which has some information readable by all users. According to documentation the user needs to have permissions can_get_all_acc_detail. So I'm trying to add those with creating new role:

tx = self.iroha.transaction([
    self.iroha.command('CreateRole', role_name='info', permissions=[primitive_pb2.can_get_all_acc_detail])
])
tx = IrohaCrypto.sign_transaction(tx, account_private_key)
net.send_tx(tx)

Unfortunately after sending transaction I see status:

status_name:ENOUGH_SIGNATURES_COLLECTED, status_code:9, error_code:0(OK)

But then it is taking 5 minutes until timeout.

I've notices that transaction json has different way of embedding permissions than in generic block:

payload {
  reduced_payload {
    commands {
      create_role {
        role_name: "info_account"
        permissions: can_get_all_acc_detail
      }
    }
    creator_account_id: "admin@example"
    created_time: 1589408498074
    quorum: 1
  }
}
signatures {
  public_key: "92f9f9e10ce34905636faff41404913802dfce9cd8c00e7879e8a72085309f4f"
  signature: "568b69348aa0e9360ea1293efd895233cb5a211409067776a36e6647b973280d2d0d97a9146144b9894faeca572d240988976f0ed224c858664e76416a138901"
}

In compare in genesis.block it is:

{
    "createRole": {
        "roleName": "money_creator",
        "permissions": [
            "can_add_asset_qty",
            "can_create_asset",
            "can_receive",
            "can_transfer"
        ]
    }
},

I'm using iroha version 1.1.3 (but also tested on 1.1.1), python iroha sdh version is 0.0.5.5.


Solution

  • does the account you used to execute the 'Create Role' command have the "can_create_role" permission?