If you’ve ever chatted to a programmer about blockchain storage, you’ve likely found is that the subject is fairly complex. That’s because blockchain storage can be distributed, decentralized, on-chain, and off-chain. I’m sure there are other alternatives as well. In most cases, people are usually referring to on-chain or a P2P-based off-chain storage.
So, here’s a fresh look at both on-chain and off-chain storage, and how this applies to application development.
On-chain storage works by having a copy of the data available on every node that is participating in the chain.
This method of data storage tends to come at a very high price and is usually only utilized for data that every node MUST have a copy of — in order to validate things like transactions.
Off-chain storage works differently by recording a ‘valid at this point-in-time’ record on the blockchain, containing a URI handler with a hash of the file that’s being stored off-chain. These files tend to be stored on a separate decentralized file system (such as an IPFS).
Decentralized file systems typically leverage a peer-to-peer network that replicates, stores, and serves files based on some kind of an incentive (eg. receive compensation for storing the data).
The Applications of Blockchain Storage
Blockchain storage can be applied to a variety of cases, and one of the most common reasons is to deploy decentralized applications (DApps).
All client-side components of the application (such as HTML/JS/CSS and other assets) are stored on the IPFS — with all other interactions occurring via smart contracts. The data then becomes transparent, accessible, and resilient due to the way it has been stored.
What this really means is that the stored data becomes immutable and verifiable, so long as nodes in the network are incentivized to keep a copy of the data.
Ok, So What are Some of the Drawbacks?
On-chain storage is extremely expensive. The last time I checked, contemporary blockchain solutions can cost around ~570 ETH to store 1MB of data on the Ethereum blockchain.
Off-chain storage doesn’t guarantee permanence. Off-chain solutions must be properly incentivized in order to guarantee enough copies of the data exist to survive the ephemeral nature of P2P hosts.
The second issue with both off-chain and on-chain blockchain storage solutions is the lack of file deletion. Once data has been verified and written to the on-chain ledger, it’s there for good. With regards to off-chain storage, once more than one node has replicated the content, there is no guarantee on the ability to delete the file.
Blockchain storage allows for data transparency but it can be prohibitively expensive to store information on-chain. This is why Regium has chosen the more fiscally mindful approach of storing hashes instead of data to ensure trust.