1

I am trying this tutorial to connect to a local testnet on virtualbox from my host using eosjs https://steemit.com/eos/@eos-asia/deploying-your-first-production-eos-dapp

this is the code:

EOS = require('eosjs')

eos = EOS.Localnet({
  keyProvider: ['MY_PRIVATE_KEY_HERE'],
  httpEndpoint: 'http://192.168.56.101:8888'
})

eos.contract('ping.ctr').then((contract) => {
  contract.ping("tester", { authorization: ['tester'] }).then((res) => {
    console.log(res)
  })
})

This is the reply that I get

> node test.js
api error => { message: 'transaction declares authority \'{"actor":"tester","permission":"active"}\', but does not have signatures for it under a provided delay of 0 ms',
  file: 'authorization_manager.cpp',
  line_number: 405,
  method: 'check_authorization' } http://192.168.56.101:8888/v1/chain/push_transaction {"compression":"none","transaction":{"expiration":"2018-06-22T10:50:50","region":0,"ref_block_num":1320,"ref_block_prefix":2298898006,"max_net_usage_words":0,"max_kcpu_usage":0,"delay_sec":0,"context_free_actions":[],"actions":[{"account":"ping.ctr","name":"ping","authorization":[{"actor":"tester","permission":"active"}],"data":"000000005c95b1ca"}]},"signatures":["SIG_K1_KZ8ZUhBugRRtW8uDvA4Ry3UJdMTsX8X6fXfUzRyVgY9jkHFVh5M8LYLYjZxYqbXYJ7m2UY3QkAUGPZeXEgXUV2j7eCqoXa"]}
{ Error: {"code":500,"message":"Internal Service Error","error":{"code":3090003,"name":"unsatisfied_authorization","what":"provided keys, permissions, and delays do not satisfy declared authorizations","details":[{"message":"transaction declares authority '{\"actor\":\"tester\",\"permission\":\"active\"}', but does not have signatures for it under a provided delay of 0 ms","file":"authorization_manager.cpp","line_number":405,"method":"check_authorization"}]}}

On the VM I am able to get the desired PONG:

~/eos/build/contracts/ping$ cleos push action ping.ctr ping '["tester"]' -p tester
executed transaction: f1bd8aa658a29c83cdadc73bd59a86974d14c51ea63cd68e45632224c426bc06  104 bytes  3451 us
#      ping.ctr <= ping.ctr::ping               {"receiver":"tester"}
>> Pong

Any idea how to make it work or how to debug it?

1 Answer 1

1

I have found the issue. The tutorial says to install 'eosjs@dawn3' which is '[email protected]'. Upgrading to '[email protected]' fixed it.

P.S: '[email protected]' didn't work for another reason:

> node test.js
api < error      { message: 'Unknown Endpoint',
file: 'http_plugin.cpp',
line_number: 203,
method: 'handle_http_request' } http://192.168.56.101:8888/v1/chain/get_abi {"account_name":"tester"}
{ Error: {"code":404,"message":"Not Found","error":{"code":0,"name":"exception","what":"unspecified","details":[{"message":"Unknown Endpoint",

Apparently, the 'get_abi' endpoint was added in 15.0.1, while my eos testnet is 'too old' and doesn't have that update from the beginning of the month.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.