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?
1 Answer
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?
What is the difference?
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.
-
Thank @twksos, I am not clear with your comment: " **Cryptography algorithms may help you reduce the ram usage like moving data off chain and protect them with their hash on chain. ** ". Please kindly explain it. Anyway, thank you very much, I will determine information of state base on your comment– user2644Commented Dec 4, 2018 at 6:23