Note
For a comprehensive coverage of blockchain development in Ethereum or mastering Solidity programming, taking our below self paced courses is highly recommended:
- Blockchain Solidity Course for Beginners
- Ethereum Developer Course
- Blockchain Security Course for Beginners
Recap
In our previous article (How Ethereum Client API Works), we discussed Ethereum client API.
In this article, we learn about Ethereum IPFS distributed storage.
Ethereum storage
In our previous series, Deep Research on Ethereum, we provided a high-level overview of different decentralized data and storage solutions in Ethereum, including IPFS, Swarm, and BigchainDB. In this article, we will delve into more details and steps to get started with some of the popular decentralized solutions.
In current cloud-based data storage, all data is stored in centralized cloud vendor’s servers; data access is through location-based addressing. The vendor handles and controls many background process jobs. Via vendor services, you can upload your data to a cloud server and set up a data recovery strategy to handle availability.
With a security access policy, data encryption, and other approaches, you can secure your data in cloud storage. The centralized storage solution makes data easier to manage, scale, and secure. However, because of this centralized nature, you do not fully control the data. You may face a data breach, data outage, lack of ownership, and other risks.
One-to-One Live Blockchain Classes
Coding Bootcamps school offers One-to-One Live Blockchain Classes for Beginners.
On the other hand, decentralized data storage stores data in multiple machines on the decentralized network. You can download your file similar to BitTorrent and other peer-to- peer (P2P) clients using a distributed P2P file sharing system. The entire file is distributed as smart chunks or data fragments and shared across all the client machines that have participants in the file download process. You can start sharing your client node as soon as you start downloading a small piece of the file. One of the main issues with the BitTorrent protocol is the lack of incentive for the user to run the client without rewards. Many of the download feeds come from a few hosts. The decentralized data storage migrates a similar issue by way of monetary rewards.
There is already enormous decentralized cloud storage offerings for blockchain applications on the market. We will review two of the most popular Ethereum storage solutions:
- Interplanetary File System (IPFS)
- Swarm
IPFS uses Filecoin as the incentive layer. For SWARM, the Ethereum Geth client is built in the incentive components.
Knowing the IPFS protocol
IPFS is a protocol and decentralized network that stores and delivers information by content instead of by location. Each IPFS file, including the blocks it contains, has a unique cryptographic hash. When you search IPFS files, the network will look up the nodes storing the contents by unique cryptographic hash. An IPFS support file can be accessed in a variety of ways, including FUSE and HTTP. Since each IPFS file has its own unique hash, which will remove file duplications in the network when content is changed, the address will also change and a new hash key will be generated. Inter-Planetary Name System (IPNS) is a decentralized naming system that can create and update human-readable and mutable links for IPFS content.
The IPNS address will use the /ipns/ prefix, followed by the hash of a public key. It is associated with content information that’s signed by the paired private key. When publishing new content, the content can be encrypted and signed with a private key.
Here is an example of an IPNS address link:
/ipns/QmOuTrFhUKA3ZodhzPWHbCFgcPMFWF4QsxXbkWfEpkitDa
You can publish an ipns address as follows: const addr = '/ipfs/QmOuTrFhUKA3ZodhzPWHbCFgcPMFWF4QsxXbkWfEpkitDa' ipfs.name.publish(addr, function (err,res) { .. });
Similar to BitTorrent, IPFS will allow users to both receive and host content. We have introduced the basics of IPFS. Now, let’s run a hands-on IPFS example.
Next Article
In our next article (How to Install and Start Ethereum IPFS Storage), we discuss how to install and start Ethereum IPFS storage.
This article is written in collaboration with Brian Wu who is a leading author of “Learn Ethereum: Build your own decentralized applications with Ethereum and smart contracts” book. He has written 7 books on blockchain development.
Resources
coming soon