IROHA 新帐户已创建但无法从管理员帐户获取帐户信息
IROHA new account is created but not able to get account information from admin account
我已经完成了 iroha 配置并启动了 iroha 守护进程。我使用以下命令创建了一个新帐户,
iroha-cli --new_account --account_name user1@test
我可以与 iroha-cli 交互,但无法创建任何交易或查询,甚至无法获取帐户信息。
Choose what to do:
1. New transaction (tx)
2. New query (qry)
3. New transaction status request (st)
> : 2
Choose query:
1. Get all permissions related to role (get_role_perm)
2. Get Transactions by transactions' hashes (get_tx)
3. Get information about asset (get_ast_info)
4. Get Account's Transactions (get_acc_tx)
5. Get Account's Asset Transactions (get_acc_ast_tx)
6. Get all current roles in the system (get_roles)
7. Get Account's Signatories (get_acc_sign)
8. Get Account's Assets (get_acc_ast)
9. Get Account Information (get_acc)
0. Back (b)
> : 9
Requested account Id: user1@test
Query is formed. Choose what to do:
1. Send to Iroha peer (send)
2. Save as json file (save)
0. Back (b)
> : 1
Peer address (0.0.0.0):
Peer port (50051):
[2019-02-04 09:00:34.748141999][th:185][error] QueryResponseHandler Query is stateful invalid
--------------------
我在创世块中添加了帐户 public ID 并重新启动了守护程序,但仍然出现相同的错误,请任何人向我提供正确的方法,在此先感谢。
请确保您正确使用了创世块中的 public 密钥(必须是十六进制密钥)。 Stateful error 通常是因为关键问题而发生的。
如果一切正常,能否分享创世块和public密钥?
@sara 感谢您的回复,
我验证了创世块中的 public 密钥,它是正确的。
以下是我的创世区块代码
{
"block_v1":{
"payload":{
"transactions":[
{
"payload":{
"reducedPayload":{
"commands":[
{
"addPeer":{
"peer":{
"address":"127.0.0.1:10001",
"peerKey":"bddd58404d1315e0eb27902c5d7c8eb0602c16238f005773df406bc191308929"
}
}
},
{
"createRole":{
"roleName":"admin",
"permissions":[
"can_add_peer",
"can_add_signatory",
"can_create_account",
"can_create_domain",
"can_get_all_acc_ast",
"can_get_all_acc_ast_txs",
"can_get_all_acc_detail",
"can_get_all_acc_txs",
"can_get_all_accounts",
"can_get_all_signatories",
"can_get_all_txs",
"can_get_blocks",
"can_get_roles",
"can_read_assets",
"can_remove_signatory",
"can_set_quorum"
]
}
},
{
"createRole":{
"roleName":"user",
"permissions":[
"can_add_signatory",
"can_get_my_acc_ast",
"can_get_my_acc_ast_txs",
"can_get_my_acc_detail",
"can_get_my_acc_txs",
"can_get_my_account",
"can_get_my_signatories",
"can_get_my_txs",
"can_grant_can_add_my_signatory",
"can_grant_can_remove_my_signatory",
"can_grant_can_set_my_account_detail",
"can_grant_can_set_my_quorum",
"can_grant_can_transfer_my_assets",
"can_receive",
"can_remove_signatory",
"can_set_quorum",
"can_transfer"
]
}
},
{
"createRole":{
"roleName":"money_creator",
"permissions":[
"can_add_asset_qty",
"can_create_asset",
"can_receive",
"can_transfer"
]
}
},
{
"createDomain":{
"domainId":"test",
"defaultRole":"user"
}
},
{
"createAsset":{
"assetName":"coin",
"domainId":"test",
"precision":2
}
},
{
"createAccount":{
"accountName":"admin",
"domainId":"test",
"publicKey":"313a07e6384776ed95447710d15e59148473ccfc052a681317a72a69f2a49910"
}
},
{
"createAccount":{
"accountName":"test",
"domainId":"test",
"publicKey":"716fe505f69f18511a1b083915aa9ff73ef36e6688199f3959750db38b8f4bfc"
}
},
{
"createAccount":{
"accountName":"user1",
"domainId":"test",
"publicKey":"5a0ff31cebd82ebccb7952b5066c65748a72cfd31c05b95cd421b34eb747378c"
}
},
{
"appendRole":{
"accountId":"admin@test",
"roleName":"admin"
}
},
{
"appendRole":{
"accountId":"admin@test",
"roleName":"money_creator"
}
}
],
"quorum":1
}
}
}
],
"txNumber":1,
"height":"1",
"prevBlockHash":"0000000000000000000000000000000000000000000000000000000000000000"
}
}
}
我找到了解决方案...
重新启动 iroha 守护程序时,我收到以下警告。
[2019-02-21 04:54:25.009069450][th:108][warning] MAIN Passed genesis block will be ignored without --overwrite_ledger flag. Restoring existing state.
这意味着如果你编辑了创世块,那么你必须在启动守护进程时启用 --overwrite_ledger 标志,否则它将忽略当前的创世块并从前一个创世块读取数据。
下面是另一种添加新账号的方法
- 使用以下命令创建新帐户后,它将生成密钥对
iroha-cli --new_account --account_name user1@test
- 在 iroha-cli 中以管理员帐户身份登录
- select 新交易
- select 创建帐户
- 输入账户名、域ID和Public第一步生成的密钥
现在您的新账户已添加,您可以使用该账户进行交易。
您可以采用第一种方法或第二种方法,但第二种方法是添加新帐户的更好解决方案,因为不需要覆盖分类帐。
希望对其他人有所帮助!
我已经完成了 iroha 配置并启动了 iroha 守护进程。我使用以下命令创建了一个新帐户,
iroha-cli --new_account --account_name user1@test
我可以与 iroha-cli 交互,但无法创建任何交易或查询,甚至无法获取帐户信息。
Choose what to do:
1. New transaction (tx)
2. New query (qry)
3. New transaction status request (st)
> : 2
Choose query:
1. Get all permissions related to role (get_role_perm)
2. Get Transactions by transactions' hashes (get_tx)
3. Get information about asset (get_ast_info)
4. Get Account's Transactions (get_acc_tx)
5. Get Account's Asset Transactions (get_acc_ast_tx)
6. Get all current roles in the system (get_roles)
7. Get Account's Signatories (get_acc_sign)
8. Get Account's Assets (get_acc_ast)
9. Get Account Information (get_acc)
0. Back (b)
> : 9
Requested account Id: user1@test
Query is formed. Choose what to do:
1. Send to Iroha peer (send)
2. Save as json file (save)
0. Back (b)
> : 1
Peer address (0.0.0.0):
Peer port (50051):
[2019-02-04 09:00:34.748141999][th:185][error] QueryResponseHandler Query is stateful invalid
--------------------
我在创世块中添加了帐户 public ID 并重新启动了守护程序,但仍然出现相同的错误,请任何人向我提供正确的方法,在此先感谢。
请确保您正确使用了创世块中的 public 密钥(必须是十六进制密钥)。 Stateful error 通常是因为关键问题而发生的。
如果一切正常,能否分享创世块和public密钥?
@sara 感谢您的回复, 我验证了创世块中的 public 密钥,它是正确的。
以下是我的创世区块代码
{
"block_v1":{
"payload":{
"transactions":[
{
"payload":{
"reducedPayload":{
"commands":[
{
"addPeer":{
"peer":{
"address":"127.0.0.1:10001",
"peerKey":"bddd58404d1315e0eb27902c5d7c8eb0602c16238f005773df406bc191308929"
}
}
},
{
"createRole":{
"roleName":"admin",
"permissions":[
"can_add_peer",
"can_add_signatory",
"can_create_account",
"can_create_domain",
"can_get_all_acc_ast",
"can_get_all_acc_ast_txs",
"can_get_all_acc_detail",
"can_get_all_acc_txs",
"can_get_all_accounts",
"can_get_all_signatories",
"can_get_all_txs",
"can_get_blocks",
"can_get_roles",
"can_read_assets",
"can_remove_signatory",
"can_set_quorum"
]
}
},
{
"createRole":{
"roleName":"user",
"permissions":[
"can_add_signatory",
"can_get_my_acc_ast",
"can_get_my_acc_ast_txs",
"can_get_my_acc_detail",
"can_get_my_acc_txs",
"can_get_my_account",
"can_get_my_signatories",
"can_get_my_txs",
"can_grant_can_add_my_signatory",
"can_grant_can_remove_my_signatory",
"can_grant_can_set_my_account_detail",
"can_grant_can_set_my_quorum",
"can_grant_can_transfer_my_assets",
"can_receive",
"can_remove_signatory",
"can_set_quorum",
"can_transfer"
]
}
},
{
"createRole":{
"roleName":"money_creator",
"permissions":[
"can_add_asset_qty",
"can_create_asset",
"can_receive",
"can_transfer"
]
}
},
{
"createDomain":{
"domainId":"test",
"defaultRole":"user"
}
},
{
"createAsset":{
"assetName":"coin",
"domainId":"test",
"precision":2
}
},
{
"createAccount":{
"accountName":"admin",
"domainId":"test",
"publicKey":"313a07e6384776ed95447710d15e59148473ccfc052a681317a72a69f2a49910"
}
},
{
"createAccount":{
"accountName":"test",
"domainId":"test",
"publicKey":"716fe505f69f18511a1b083915aa9ff73ef36e6688199f3959750db38b8f4bfc"
}
},
{
"createAccount":{
"accountName":"user1",
"domainId":"test",
"publicKey":"5a0ff31cebd82ebccb7952b5066c65748a72cfd31c05b95cd421b34eb747378c"
}
},
{
"appendRole":{
"accountId":"admin@test",
"roleName":"admin"
}
},
{
"appendRole":{
"accountId":"admin@test",
"roleName":"money_creator"
}
}
],
"quorum":1
}
}
}
],
"txNumber":1,
"height":"1",
"prevBlockHash":"0000000000000000000000000000000000000000000000000000000000000000"
}
}
}
我找到了解决方案...
重新启动 iroha 守护程序时,我收到以下警告。
[2019-02-21 04:54:25.009069450][th:108][warning] MAIN Passed genesis block will be ignored without --overwrite_ledger flag. Restoring existing state.
这意味着如果你编辑了创世块,那么你必须在启动守护进程时启用 --overwrite_ledger 标志,否则它将忽略当前的创世块并从前一个创世块读取数据。
下面是另一种添加新账号的方法
- 使用以下命令创建新帐户后,它将生成密钥对
iroha-cli --new_account --account_name user1@test
- 在 iroha-cli 中以管理员帐户身份登录
- select 新交易
- select 创建帐户
- 输入账户名、域ID和Public第一步生成的密钥
现在您的新账户已添加,您可以使用该账户进行交易。
您可以采用第一种方法或第二种方法,但第二种方法是添加新帐户的更好解决方案,因为不需要覆盖分类帐。
希望对其他人有所帮助!