Reputation: 346
I have done the iroha configuration and launched the iroha daemon. I created a new account using following command,
iroha-cli --new_account --account_name user1@test
I'm able to interface with iroha-cli but not able to create any transaction or query, even I'm not able to get the Account Information.
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
--------------------
I added the account public ID in genesis block and restarted the daemon but still getting same error, Please any one suggest me the correct approach, thanks in advance.
Upvotes: 2
Views: 712
Reputation: 346
I got the solution...
on restarting the iroha daemon I got the following warning.
[2019-02-21 04:54:25.009069450][th:108][warning] MAIN Passed genesis block will be ignored without --overwrite_ledger flag. Restoring existing state.
that mean if you edited the genesis block then you have to enable --overwrite_ledger flag at the time of starting daemon otherwise it will ignore the current genesis block and read the data from previous one.
Following is the another approach to add a new account
iroha-cli --new_account --account_name user1@test
Now your new account is added and you can perform the transactions with this account.
You can follow either first approach or second, but the second approach is the better solution to add new account because there is not required to overwrite the ledger.
I hope it will help to other..!
Upvotes: 2
Reputation: 346
@sara Thanks for your responce, I verified the public key in genesis block and it is correct.
Following is my genesis block code
{
"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"
}
}
}
Upvotes: 0
Reputation: 162
Please make sure that you used the public key in genesis block correctly (it must be a hex key). Stateful error usually occurs because of key issues.
If everything is ok, can you please share the genesis block and public key?
Upvotes: 0