3

I get this -

cleos get block 490684
{
  "timestamp": "2018-08-11T13:36:20.000",
  "producer": "eosio",
  "confirmed": 0,
  "previous": "00077cbb75a31d441793c5f6783366b953c48f43da7940a11b9ef9971d779d48",
  "transaction_mroot": "0000000000000000000000000000000000000000000000000000000000000000",
  "action_mroot": "17ad7c545fa46f2717521a36fe334d7a6c14d71f46565a911f2b8a62234488b3",
  "schedule_version": 0,
  "new_producers": null,
  "header_extensions": [],
  "producer_signature": "SIG_K1_K2LsUdPM7HzQvY8pd58w2XdgfKe3x4jJraT7yF5cVeTSnAehW7tTyxHK6f6v5wL1L8umVWHjjPtfoazJHsSRin1iaf5odE",
  "transactions": [],
  "block_extensions": [],
  "id": "00077cbcfcecfabbc1adbb7015f8e0c7dd86a83bbb6c2b47e947eee6d85de8ea",
  "block_num": 490684,
  "ref_block_prefix": 1891347905
}

I am trying to interrogate the chain more to find what is being stored. I get an ID of

00077cbcfcecfabbc1adbb7015f8e0c7dd86a83bbb6c2b47e947eee6d85de8ea

What is that exactly?

Also in ethereum we have hashes in headers to maintain the reliability and then the Merkle tree. Is there something the same in EOS? Can I use this data such as "previous" and "action_mroot" to find out more what is being stored on the blockchain?

3

What is Block ID?

It's a hash of the block header according to libraries/chain/block_header.cpp:

namespace eosio { namespace chain {
   digest_type block_header::digest()const
   {
      return digest_type::hash(*this);
   }

   uint32_t block_header::num_from_id(const block_id_type& id)
   {
      return fc::endian_reverse_u32(id._hash[0]);
   }

   block_id_type block_header::id()const
   {
      // Do not include signed_block_header attributes in id, specifically exclude producer_signature.
      block_id_type result = digest(); //fc::sha256::hash(*static_cast<const block_header*>(this));
      result._hash[0] &= 0xffffffff00000000;
      result._hash[0] += fc::endian_reverse_u32(block_num()); // store the block num in the ID, 160 bits is plenty for the hash
      return result;
}

Also in ethereum we have hashes in headers to maintain the reliability and then the Merkle tree. Is there something the same in EOS?

Yes, there are several such mechanisms:

  • Each header refers to the ID of the previous block (see here)
  • Each transactions specifies a block ID (see here for code, and here for the whitepaper details: "The EOS.IO software requires every transaction to include part of the hash of a recent block header")
  • EOS has a merkle tree for all actions in a block, a merkle tree for all transactions within a block, and a merkle tree of all blocks as detailed in the whitepaper and explained by Dan.

Figure from EOS paper showing how Merkle Trees are used in the blockchain

Figure from EOS paper showing how Merkle Trees are used in the blockchain

Can I use this data such as "previous" and "action_mroot" to find out more what is being stored on the blockchain?

You can use Merkle roots for generating Merkle proofs if you're operating a thin client and you want to verify if a transaction was included in an irreversible block without downloading the blocks. But, yes, you can use previous to query the block that the current block points to.

However, if you want to explore data in the blockchain, you can, more simply, query blocks by block number, which is a counter increcemented by 1 for every block in the blockchain. Example:

$ cleos -u https://api.eosnewyork.io get block 10000000

Would give you the 10,000,000th block produced along with all transactions included inside (but not all inline actions).

| improve this answer | |
  • Thanks. I am still testing but when I get the nodes running I will test these data values. – Trevor Lee Oakley Aug 11 '18 at 17:56

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.