Gravity IPFS: Off-chain Data Storage
One of the main problems concerning scalability of the blockchain is the limited size of it’s blocks. This essentially makes it impossible to store more complex data than transaction history, registry entries, and hashes in a block. Therefore, the majority of public blockchains have not yet surpassed the "transactional" stage of development.
Gravity strives to become not only a blockchain of transactions/for transactions, but, above all else, a distributed protocol for managing the sum of all possible data, and the use of distributed data stores such as IPFS is inevitable in this task.
IPFS organizes distributed data storage on users' computers. This is the same concept BitSwap Ledgers implemented in IPFS, a scalable register where the distribution of content blocks is similar to the distribution in the Kademlia DHT. These registries deal only with peer-to-peer relationships without regard to latency, bandwidth, or network availability, making IPFS a versatile and extensible decentralized file system.
Thus, after IPFs integration, it becomes possible store only the hash data on-chain. The data itself will be stored off-chain, in IPFS.
The ability to store just the hash data on-chain, significantly decreases the size of data to be stored, which slows down the speed of chain bloat, thus decreasing the resources required for blockchain nodes, as well as the time it takes to resync and replay, which is a huge problem on existing blockchains that try to store unnecessary data on their chains.
Here is how it works: The hash of a file fully corresponds to the content loaded into IPFS and is actually, in itself, the content address. If the file is modified, its hash will change and the file will no longer be available at the same content address. This makes it impossible for third-parties to change the uploaded content, opening up many opportunities for practical application in the fields of transmission and storage of reliable data. Multi-versioning of the file (like git) is supported to allow the owner to change the content.
Processing and storage of a large amount of reliable data is a very important component for the use of blockchain technologies as well as the implementation of decentralized solutions areas such as Big Data, AI Deep Learning, Internet-of-Things, Smart House, CCTV, etc.
Data hash associates with smart contracts, which organize the transaction cycle. This is another important feature of blockchain IPFS integration: Participants get the ability to control access to the data itself, including on an optional paid basis, without any intermediaries. The hash is encrypted with the private key of the recipient. This is a guarantee that only those who have paid will be able to gain access to the data.
This feature enables broad integration of blockchain technologies in the industry of paid access control to content, such as video and audio files, training courses, and any other content which is usually behind a traditional paywall, including access control to copyrighted objects as well.
Gravity Protocol implements a mechanism for transferring the rights to download content (media files, etc.) within a blockchain transaction, using encryption of IPFS storage blocks. An asymmetric encryption algorithm with public key is used to generate the signature that contains the hash address of the content and the password to decrypt the data blocks (see Fig. 1). The data blocks themselves are encrypted using the AES-256 symmetric algorithm, since the asymmetric encryption algorithm is not efficient when it comes to working with large amounts of data in terms of performance and resource requirements when compared to symmetric. The process of transferring the rights to download content is implemented by a built-in smart contract and is reflected in all blockchain transactions. As such, for the recipient of the content, operations are performed in reverse order (see Fig. 2).
The files themselves are located on the computers and servers of network participants. All members of the network will be given the opportunity to store Gravity IPFS data on their servers and devices, and will receive payment for this. The Gravity wallet interface will be used to activate IPFS storage. As a result, the data loaded into Gravity IPFS will have maximum storage security. With this in mind, the IPFS-storage system of the Gravity network ideally needs to be self-sufficient.
Thanks to the integration of IPFS in the Gravity Protocol, the Gravity Solutions Company will be able to deploy solutions for both small and medium businesses. For example, a digital content marketplace with flexible content storage and a content distribution system or an accounting system with a distributed storage can be created.
Implementation of IPFS in Gravity Protocol is planned by the end of 2018, according to our Roadmap.
by Vladimir Pugachev
See the previous articles
Gravity Protocol Intro
Gravity Protocol Roadmap
A Deeper Look Into Dan Larimer’s radio
Gravity Protocol initial distribution
Access to private testing
Adaptive Emission: Making Blockchain Economy Real
Telegram channel: https://t.me/gravityprotocol
Telegram dev chat: https://t.me/gravity_protocol