2

我已经完成了 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
    --------------------

我在创世块中添加了帐户公共 ID 并重新启动了守护程序,但仍然出现相同的错误,请任何人建议我正确的方法,提前谢谢。

4

3 回答 3

2

我得到了解决方案...

在重新启动 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 标志,否则它将忽略当前的创世块并从前一个创世块读取数据。

以下是添加新帐户的另一种方法

  1. 使用以下命令创建新帐户后,它将生成密钥对

iroha-cli --new_account --account_name user1@test

  1. 在 iroha-cli 中以管理员帐户身份登录
  2. 选择新交易
  3. 选择创建帐户
  4. 输入第一步生成的Account Name、Domain ID和Public Key

现在您的新帐户已添加,您可以使用此帐户执行交易。

您可以采用第一种方法或第二种方法,但第二种方法是添加新帐户的更好解决方案,因为不需要覆盖分类帐。

我希望它会帮助其他人..!

于 2019-02-21T05:45:37.260 回答
0

请确保您在创世区块中正确使用了公钥(必须是十六进制密钥)。有状态错误通常是由于关键问题而发生的。

如果一切正常,你能分享创世块和公钥吗?

于 2019-02-11T16:18:09.253 回答
0

@sara 感谢您的回复,我验证了创世区块中的公钥,它是正确的。

以下是我的创世区块代码

{
   "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"
     }
   }
}
于 2019-02-12T06:25:20.333 回答