3

1.What is chainbase used for? we can find the answer in : about chainbase 2.when we add a new object (i.e., row) to the table by Multi-Index such as class addressbook: contract { struct address { uint64_t account_name; string first_name; string last_name; string street; string city; string ...


3

The still reversible blocks are stored in blocks/reversible. The reversible state is kept in RAM, and keeps track of inserts, deletes, and updates in their undo / redo forms, so they can be applied and unapplied when a change of longest chain occurs. If you're looking at the source, check references to chainbase instead of fork. Check the squash, commit ...


1

Yes, you can save parts of the data you need in MongoDB or MySQL. The library to enable that is called demux-js. There is a template and demo explaining how to use that library here. One important issue you need to keep in mind, any data that you don't save in RAM is not accessible to the smart contract code. So you can't have business logic in the smart ...


1

I found the solution. The reference code is followed by boost manual. (https://www.boost.org/doc/libs/1_73_0/libs/multi_index/example/ip_allocator.cpp) Boost.MultiIndex supports special allocators such as those provided by Boost.Interprocess, which allows for multi_index_containers to be placed in shared memory. Chainbase database use shared memory. If ...


1

Add struct by_keyBox; before using declaration: struct by_keyBox; using setw_multi_index = chainbase::shared_multi_index_container< s_object, indexed_by< ordered_unique<tag<by_id>, member<s_object, s_object::id_type, &s_object::id>>, ordered_unique<tag<by_keyBox>, composite_key<...


1

Yes, you will save 6 bytes per record if you go with the first solution compared to the second one. Records are stored in the chainbase and each record consumes the amount of memory used for the entry, depending on the size of the datatypes used.


1

Reading a table at a certain block number isn't so easy since a block only records change in state, not the full state. I think your best way forward is learning to use dfuse: https://www.dfuse.io


1

chain_plugin is actually the core part that manages the blockchain data structure in nodeos. Most of time it is enabled automatically. mongo_db_plugin is an add-on plugin that aims to replace the previous history_plugin and history_api_plugin, and is for data access / analysis / reporting purpose only. It is more like a peripheral module attached to the ...


Only top voted, non community-wiki answers of a minimum length are eligible