EOSIO / eos

An open source smart contract platform
https://developers.eos.io/manuals/eos
MIT License
11.27k stars 3.6k forks source link

cleos get currency balance isn't working #3162

Closed cijujohn closed 6 years ago

cijujohn commented 6 years ago

cleos get currency balance receives error:

Error 3060003: Contract Table Query Exception Most likely, the given table doesn't' exist in the blockchain. Error Details: Table accounts is not specified in the ABI

To reproduce:

  1. Run cleos test: tests/nodeos_run_test.py -v --dont-kill
  2. run get currency balance command: programs/cleos/cleos --url http://localhost:8888 --wallet-url http://localhost:8899 get currency balance currency1111 currency1111 CUR
bytemaster commented 6 years ago

Works for me...

[dlarimer@danpro ~/eos/programs/cleos]$ ./cleos create account eosio eosio.token EOS5GkXthK6TiYLHyi4zDd5Leix8oFkdUUxgkHoEgsUUZzaQypkgM
executed transaction: 391fc43d942658a60af06f344c3106423062a980379cdba3e402d42d6a4130b0  288 bytes  206 us
#         eosio <= eosio::newaccount            {"creator":"eosio","name":"eosio.token","owner":{"threshold":1,"keys":[{"key":"EOS5GkXthK6TiYLHyi4zD...
warning: transaction executed locally, but may not be confirmed by the network yet
[dlarimer@danpro ~/eos/programs/cleos]$ ./cleos set contract eosio.token ../../contracts/eosio.token
Reading WAST/WASM from ../../contracts/eosio.token/eosio.token.wasm...
Using already assembled WASM...
Publishing contract...
executed transaction: e94223d8dcf6568c041ca85450585d01d3a46111e180f12c72b31d861c79cd26  8112 bytes  968 us
#         eosio <= eosio::setcode               {"account":"eosio.token","vmtype":0,"vmversion":0,"code":"0061736d01000000017f1560037f7e7f0060057f7e...
#         eosio <= eosio::setabi                {"account":"eosio.token","abi":{"types":[],"structs":[{"name":"transfer","base":"","fields":[{"name"...
warning: transaction executed locally, but may not be confirmed by the network yet
(reverse-i-search)`push act': ./cleos push action eosio buyrambytes '[eosio, eosio, 10000000]' -p eosio
[dlarimer@danpro ~/eos/programs/cleos]$ ./cleos push action eosio.token create '[eosio, "10000000000.0000 EOS"]' -p eosio.token
executed transaction: 0db03e41ea7deb87ac4c38161812b7e4d3785479d76a6d592084786a4c862aab  208 bytes  294 us
#   eosio.token <= eosio.token::create          {"issuer":"eosio","maximum_supply":"10000000000.0000 EOS"}
warning: transaction executed locally, but may not be confirmed by the network yet
[dlarimer@danpro ~/eos/programs/cleos]$ ./cleos push action eosio.token issue '[eosio, "1000000000.0000 EOS"]' -p eosio
executed transaction: 9b50de5dd1f962b81bfe5f0a73d40f0f9e4f7e9ad49d9c4f2276f27036148b44  208 bytes  381 us
#   eosio.token <= eosio.token::issue           {"to":"eosio","quantity":"1000000000.0000 EOS","memo":""}
warning: transaction executed locally, but may not be confirmed by the network yet
[dlarimer@danpro ~/eos/programs/cleos]$ ./cleos get currency
ERROR: RequiredError: Subcommand required
Retrieve information related to standard currencies
Usage: ./cleos get currency [OPTIONS] SUBCOMMAND

Options:
  -h,--help                   Print this help message and exit

Subcommands:
  balance                     Retrieve the balance of an account for a given currency
  stats                       Retrieve the stats of for a given currency
[dlarimer@danpro ~/eos/programs/cleos]$ ./cleos get currency balance
ERROR: RequiredError: contract
Retrieve the balance of an account for a given currency
Usage: ./cleos get currency balance contract account [symbol]

Positionals:
  contract TEXT               The contract that operates the currency
  account TEXT                The account to query balances for
  symbol TEXT                 The symbol for the currency if the contract operates multiple currencies

[dlarimer@danpro ~/eos/programs/cleos]$ ./cleos get currency balance eosio.token eosio EOS
1000000000.0000 EOS
cijujohn commented 6 years ago

Yes confirming it works now. Closing issue.

sztwiorok commented 6 years ago

I think I have the same issue

cleos push action eosio.token create '[ "eosio", "1000000000.0000 SYS"]'  -p eosio.token@active
cleos push action eosio.token issue '[ "kopytko", "100.0000 SYS", "memo" ]'   -p eosio@active
cleos push action eosio.token transfer '[ "kopytko", "tajwan", "1.0000 SYS", "m" ]' -p kopytko@active

cleos get currency balance eosio.token kopytko SYS
Error 3060003: Contract Table Query Exception
Most likely, the given table doesnt' exist in the blockchain.

I also can't get stats

cleos get currency stats eosio.token SYS
Error 3060003: Contract Table Query Exception
Most likely, the given table doesnt' exist in the blockchain.
sztwiorok commented 6 years ago

One important thing. I have built this contract myself.

To reproduce:

  1. download the code from GitHub https://github.com/EOSIO/eos/tree/master/contracts/eosio.token
  2. build:
    eosiocpp -o eosio.token.wast eosio.token.cpp
    eosiocpp -g eosio.token.abi eosio.token.cpp
  3. deploy

when I deploy the contract already compiled in the docker image eos-dev:v1.0.10 /contracts/eosio.token everything works as it should

I have the same issue with the tic.tac.toe contract. When I build it from the source code it doesn't work, but when I deploy this contract using binaries compiled in the docker image it works OK.

sebastianmontero commented 6 years ago

Hi sztwiorok,

I'm having the same issue as you, did you manage to solve it?

Thanks,

o7-machinehum commented 6 years ago

Have either of you managed to solve this?

sebastianmontero commented 6 years ago

I haven't been able to solve the issue.

On Tue, Sep 25, 2018 at 7:36 AM Walker notifications@github.com wrote:

Have either of you managed to solve this?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/EOSIO/eos/issues/3162#issuecomment-424147998, or mute the thread https://github.com/notifications/unsubscribe-auth/AMi9ghk9hph8SQKg8bvMrpH38W-aEZR3ks5ueV59gaJpZM4UDHgs .

dongfangx commented 6 years ago

I'm having the same issue as you, did you manage to solve it?

o7-machinehum commented 6 years ago

Hey guys, eosiocpp is deprecated! Switch over to eosio.cdt It's a shame all the documentation online is all using the old stuff, even the developer portal. Follow the steps in the readme and you should be able to compile/deploy a working tokens contract, I did!

sebastianmontero commented 6 years ago

Thanks Walker, so the docker eosio/eos-dev:v1.3.0 image is also deprecated?

On Thu, Sep 27, 2018 at 2:03 AM Walker notifications@github.com wrote:

Hey guys, eosiocpp is deprecated! Switch over to eosio.cdt https://github.com/EOSIO/eosio.cdt It's a shame all the documentation online is all using the old stuff, even the developer portal. Follow the steps in the readme and you should be able to compile/deploy a working tokens contract, I did!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/EOSIO/eos/issues/3162#issuecomment-424793710, or mute the thread https://github.com/notifications/unsubscribe-auth/AMi9gleNzE_bK78OgY2IQoSBEK8Ao4NOks5ue7NLgaJpZM4UDHgs .

jgiszczak commented 6 years ago

Thanks Walker, so the docker eosio/eos-dev:v1.3.0 image is also deprecated?

Yes, that Docker image is deprecated. It will be replaced with appropriate images for eosio.cdt.

sebastianmontero commented 6 years ago

I have determined the root of the issue, the problem is that the eosio.token.hpp file does not have the abi instructions for the accounts table, so the abi file that is generated using eosiocpp does not contain the definitions for this table, hence the error "table doesn't exist". Adding this definitions solves the issue.

On Fri, Sep 28, 2018 at 5:54 AM jgiszczak notifications@github.com wrote:

Thanks Walker, so the docker eosio/eos-dev:v1.3.0 image is also deprecated?

Yes, that Docker image is deprecated. It will be replaced with appropriate images for eosio.cdt https://github.com/EOSIO/eosio.cdt.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/EOSIO/eos/issues/3162#issuecomment-425239211, or mute the thread https://github.com/notifications/unsubscribe-auth/AMi9gp8O5jZnqMgQeUiSsmncdONiv7ciks5ufTrrgaJpZM4UDHgs .