1

I have installed EOS using this - https://eosio-nodeos.readme.io/docs/docker-quickstart

docker pull eosio/eos-dev

And start the EOSIO node:

docker run --rm --name eosio -d -p 8888:8888 -p 9876:9876 -v /tmp/work:/work -v /tmp/eosio/data:/mnt/dev/data -v /tmp/eosio/config:/mnt/dev/config eosio/eos-dev  /bin/bash -c "nodeos -e -p eosio --plugin eosio::wallet_api_plugin --plugin eosio::wallet_plugin --plugin eosio::producer_plugin --plugin eosio::history_plugin --plugin eosio::chain_api_plugin --plugin eosio::history_api_plugin --plugin eosio::http_plugin -d /mnt/dev/data --config-dir /mnt/dev/config --http-server-address=0.0.0.0:8888 --access-control-allow-origin=* --contracts-console --http-validate-host=false"

I am now using the API reference here - https://developers.eos.io/eosio-nodeos/reference

This works -

curl --request POST --url http://127.0.0.1:8888/v1/chain/get_info

Giving (after running twice) -

{
  "server_version": "4f4e5c22",
  "chain_id": "cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f",
  "head_block_num": 1133,
  "last_irreversible_block_num": 1132,
  "last_irreversible_block_id": "0000046c539765f73086b65cfb453fffb59b88130097064816e2b622cb1a7422",
  "head_block_id": "0000046d224758649572aec799adb313868a4fcbea3536c092e0645a33137545",
  "head_block_time": "2018-08-13T08:43:35.500",
  "head_block_producer": "eosio",
  "virtual_block_cpu_limit": 619663,
  "virtual_block_net_limit": 3253337,
  "block_cpu_limit": 199900,
  "block_net_limit": 1048576
}

{
  "server_version": "4f4e5c22",
  "chain_id": "cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f",
  "head_block_num": 1854,
  "last_irreversible_block_num": 1853,
  "last_irreversible_block_id": "0000073d66c1581cd561d92a80c90aff17f9e46adfaf45ba4f08b94a4aab5b0b",
  "head_block_id": "0000073edb76b2f92f995364f497899691c2f05171e68ef1b1bdff14a534b168",
  "head_block_time": "2018-08-13T08:49:36.000",
  "head_block_producer": "eosio",
  "virtual_block_cpu_limit": 1274266,
  "virtual_block_net_limit": 6692339,
  "block_cpu_limit": 199900,
  "block_net_limit": 1048576
}

When I try

curl --request POST --url http://127.0.0.1:8888/v1/chain/get_block
{
  "code": 500,
  "message": "Internal Service Error",
  "error": {
    "code": 3010008,
    "name": "block_id_type_exception",
    "what": "Invalid block ID",
    "details": []
  }
}

It seems the EOS single node chain is running. But this basic command fails. I understood eosio was installed automatically as an account.

What could be the cause of this error? Do I need to define an account manually for eosio?

1

You are not passing any block_id or block_num in your request. Try this:

curl --request POST --url http://127.0.0.1:8888/v1/chain/get_block --data '{"block_num_or_id":"1854"}'

HTH.

| improve this answer | |
  • Thanks. I am still reading all the docs so I was unaware of the JSON at the end being needed. – Trevor Lee Oakley Aug 13 '18 at 9:21
  • developers.eos.io/eosio-nodeos/reference This is good source for all the rpc apis. check it out. – Rajat Chaudhary Aug 13 '18 at 9:25
  • That is what I was using. – Trevor Lee Oakley Aug 13 '18 at 9:26
  • With each API, there are fields to be filled. So, if you fill all the input boxes and try out, you will see the full request for curl or 2-3 more languages. – Rajat Chaudhary Aug 13 '18 at 9:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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