Hello guys,
I would like to thank you for the extensive and valuable input. I didn't understand everything down to the last detail and need to understand pmem and its structure & function better.
On the Chainbase topic - it is not just an append-only database, but represents the (last) state of a transaction and able to manage a number of versions (multiversion) of the states.
Assume you have blocks (just containers) with the following transactions on the accounts B, C, D.
#B1: Trx(A -> B, 5 XYZ)
#B2: Trx(B -> C, 2 XYZ)
#B3: Trx(C -> D, 1 XYZ)
The final in-memory state on Chainbase for the above accounts would be, B=3, C=1, D=1.
The above principle is even more generic. Accounts are not just structures for managing balances, but so-called "Smart Contract" can be deployed that uses Boost Multi-index to manage states and therefore arbitrary structures are possible.
typedef eosio::multi_index<N(accounts), account>accounts; // <-- this here gets stored to a chainbase.
accounts from_acnts( _self, owner );
from_acnts.modify( from, owner, [&]( auto& a ) { // <-- is is compiled to WASM and interpreted as byte-code
a.balance -= value;
});
To confuse you even more, the above Boost example is compiled down to Webassembly and interpreted as WASM byte-code by a WASM engine, that is embedded within a C++ binary executable and where the Chainbase is used to store the states in RAM.
Let me please sketch a picture, how the above described parts are working together. Maybe we can do something together.
Back on the initial use case, RAM on the EOS Blockchain is expensive (1000 USD per 1,5 MB), because it is a commodity of speculation and it is known, that the offer is limited since more than 3-6 TB cannot be installed in a server.
Best Regards,
Jiri