EOSIO / eosjs

General purpose library for the EOSIO blockchain.
http://eosio.github.io/eosjs
MIT License
1.43k stars 463 forks source link

Unable to transfer token using node eosjs #4487 #238

Closed rameshb444 closed 6 years ago

rameshb444 commented 6 years ago

Hi,

I am trying to transfer token using node and eosjs, but getting below errors message: 'action's code account 'eosio.token' does not exist < error { message: 'action's code account 'eosio.token' does not exist', file: 'controller.cpp', line_number: 1486, method: 'validate_referenced_accounts' } http://127.0.0.1:8888/v1/chain/push_transaction {"compression":"none","transaction":{"expiration":"2018-07-04T07:50:59","ref_b ock_num":10513,"ref_block_prefix":2239072832,"net_usage_words":0,"max_cpu_usage_ms":0,"delay_sec":0,"context_free_actions":[],"actions":[{"account":"eosio.token","name": transfer","authorization":[{"actor":"eosio","permission":"active"}],"data":"0000c85353848c970040c85353848c97a086010000000000045359530000000000"}],"transaction_extensions :[]},"signatures":["SIG_K1_JzPeH9uE3bhfTNb1QQf8sNzvvm6Pkc8rqEX2EHCMh1DwmdUZGbD1j6Y73drwLm3nzaU99oBzkN1cJ2tybcCJGY7wKqRYXp"]} { Error: {"code":500,"message":"Internal Service Error","error":{"code":3040000,"name":"transaction_exception","what":"transaction exception","details":[{"message":"acti n's code account 'eosio.token' does not exist","file":"controller.cpp","line_number":1486,"method":"validate_referenced_accounts"}]}} at /home/eos/node/eos-api/node_modules/eosjs-api/lib/apigen.js:95:23

Below is my nodejs code :

Eos = require('eosjs'); // Connect to a testnet or mainnet eos = Eos(httpEndpoint, chainId, '5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3'); eos = Eos({"keyProvider" : "5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3"}); options = { authorization: 'eosio@active', broadcast: true, sign: true } eos.transfer('myaccount', 'myaccount1', '10.0000 SYS', '', options);

But I can transfer tokens using cleos from terminal.

./cleos --wallet-url http://localhost:8899 push action myaccount issue '["myaccount1", "100.0000 SYS", "memo" ]' -p eosio executed transaction: f6754433845024b533158ded0d99b54f8ac75dc61bcd75b845f5e41849ad9c77 128 bytes 1965 us

Please let me know if I am doing anything wrong. Thanks.

jcalfee commented 6 years ago

You have to create and deploy that account.. The blockchain is very generic to start. I put a lot of this commands to do this in ./docker/up.sh .. have a look and see if that help..

https://github.com/EOSIO/eosjs/blob/master/docker/up.sh

joeylin commented 6 years ago

how to fix this ? I got the same them problem