EOSCommunity.org Forums

Beginner Question: What to Save to the Blockchain vs a Different Database

Does it make sense to just use the eosio blockchain for the authorization of actions (post/put/delete) and saving the other table data on a SQL db or something similar?

For example, a eos user is creating a blog post, we post to the blockchain a block that has the blog post id (references SQL id) with timestamps and the eos user who created it. But we do not save the actual post data (title/description/etc) to the blockchain.

I guess my question boils down to, is it best practice to save all db table data on the blockchain? Or have more of a hybrid approach where you are only saving certain data you want the blockchain to keep track of.

I am slowly learning more about eosio development and am sorry if this is an obvious question.

Generally you should just be storing critical metadata on-chain because trying to store all data would be expensive and limiting.

The only issue with this method is that the data on-chain is highly available but the off-chain data might become inaccessible sometime in the future (maybe your database crashes). One way to solve this is to store the IPFS hash on-chain and then replicate the data in many IPFS nodes. Anyone could read the IPFS hashes from chain and then download the data from IPFS to have their own replica of the full content.