I read chainbase and fork database, I understood chainbase which stores user state and fork database which stores blocks. So Can I use mongodb to store user state and ignore chainbase? If it can, we do not more RAM, right?
Well, it depends.
But you've already got the right path to reduce RAM usage.
The first thing is whether the user state you mention is intend to be stored on the blockchain or not, fully or partly?
To be simplified:
on chain data is what in the RAM. Smart contract can interact with the on chain data. It is also "protected" by the blockchain.
off chain data is what not stored on the blockchain. Many decentralized exchange are doing off chain matching. They may have an off chain database for the task. As it is not on the blockchain, when a success match send back to blockchain, a validation process should involved.
So you will need to clearly split the user state, decide which part must put into chainbase and which part can be put into off chain mongodb. Cryptography algorithms may help you reduce the ram usage like moving data off chain and protect them with their hash on chain.
Answered by twksos on November 28, 2020
Get help from others!