Blockchain Semantics Insights
Business Case | Deep Tech | Announcements | Blockchain Glossary |
How to upload files on Blockchain?Feb. 17, 2018, 12:17 p.m. GMT
Blockchain today is getting synonymous with a reliable, robust and secure data storage facility. The immutable and secure data storage model makes storing an actual file on Blockchain a really tempting idea. I mean, who in this world does not want to keep his files secure. So why not just store the data at the most secure(proposed) location that there could be? Well, no.
Problems associated with directly uploading files on Blockchain:
Say you want to upload documents into Bitcoin’s Blockchain. The 1 MB size limit per block in Bitcoin's Blockchain would limit the maximum file size that we can upload. In Ethereum, there is theoretically no limit for the block size. This does not mean that we can create a block on the Ethereum network with tons of transactions. Ethereum takes care of it with the help of block gas limit. When the cumulative gas of a bundle of transactions reaches the block gas limit, those many transactions form the part of that block. Storing information on Blockchain costs us money and storing large documents will be very expensive.
Fun Statistical Fact:
Storing 1 KiloByte of data in the public Blockchain, as per conversion rates on June 7th, 2017 is approximately $2.11.
That said, many Blockchain-like solutions designed just to store data were developed recently. Some common ones are StorJ, Filecoin, IPFS etc. These networks are not the replica of Bitcoin or Ethereum networks. However, they borrow some key properties like decentralization and cryptography from it.
Let's consider that you want to upload a file on IPFS. IPFS would break the file into multiple pieces, sign it cryptographically, and store it on different computer nodes across the globe. It would return back a hash with which you can uniquely identify that file. You should now take this hash and store it on a Blockchain network like Ethereum.
If you wish to retrieve this file, you need to first query the Ethereum network to pull out the hash. Once you get the hash, send a query to IPFS network and pass the retrieved hash. IPFS would then return the original file that was uploaded to the IPFS network.
This ensures that the file you uploaded is secure, stored permanently, and cannot be tampered with. Storing the hash on Ethereum gives us the guarantee that whenever someone tries to download the hash, she would get back the exact same hash that was originally stored. This is guaranteed by the inherent nature of Blockchain. IPFS takes care of storing the actual file securely with the help of cryptography. IPFS takes care of the backup by storing it on multiple computer nodes.
That's how you store a file on Blockchain!