BTC NOON
  • Home
  • Cryptocurrency
  • Bitcoin
  • Ethereum
  • Blockchain
  • Regulations
  • Altcoin
  • DeFi
  • Web 3.0
No Result
View All Result
BTC NOON
No Result
View All Result
Home Web 3.0

How to Store Files on the Blockchain Using IPFS

Xiao Chen Sun by Xiao Chen Sun
March 21, 2023
in Web 3.0
0
How to Store Files on the Blockchain Using IPFS
74
SHARES
1.2k
VIEWS
Share on FacebookShare on Twitter


In this series, we’re going to discuss the on-chain and off-chain methods of storing file documents on the blockchain.

You might also like

My foray into Ethereum and creating something of value for a global ecosystem

QANplatform Selected for the EY (Ernst & Young) Startup Academy to Accelerate Growth and Innovation

FUNToken Enters a New Era as It Joins the Ranks of BitMart Exchange, Expanding Opportunities for iGaming Enthusiasts

And later on, we’ll learn how to store files such as images, PDFs, or any other digital asset off-chain using the InterPlanetary File System (IPFS) network powered by Moralis and Infura IPFS.

By the end of this tutorial series, you’ll be able to store and access files on the IPFS network.

Blockchain as a Database

Blockchain is an immutable database that is capable of storing data

As a database, a blockchain is an immutable digital ledger of transactions that is distributed across multiple computer networks. It enables us to store data, i.e. NFTs metadata (including files), and retrieve them in the same way that any other database does.

Storing Files on the Blockchain (On-Chain)

On-chain refers to verified activities or transactions that take place directly on the blockchain. Uploading files directly to a blockchain is also an on-chain activity in this case.

Should we, however, store files directly on-chain? Is it a good idea to keep files on-chain? And how much does blockchain storage cost?

Cost of Storing Files on the Blockchain (On-Chain)

What is the cost of storing files on the blockchain? The cost of storing large files on the blockchain can be very expensive. A gigabyte of storage costs around $100 USD on the blockchain

The cost of storing large files on the blockchain can be very expensive. According to IBM’s “Storage Needs for Blockchain Technology – Point of View document” on Page 9, a gigabyte of storage costs around $100 USD on the blockchain, which is 500 times more expensive than traditional storage.

Performance of Storing Files on the Blockchain (On-Chain)

Storing a large number of files on a blockchain can increase the access latency, which makes the blockchain system perform slowly

Apart from being expensive, storing a large number of files on a blockchain can increase the access latency of the files (increase the time it takes to upload/download the files from the blockchain).

File storage requires low latency for fast access. However, when there is an increase in latency due to heavy files, this may slow down the performance of the blockchain system and make maintenance very difficult.

It is not advisable to store non-transaction data such as files, contracts, documents, PDFs, and personal information directly on the blockchain but you should instead consider storing them off-chain.

Storing Files Outside the Blockchain (Off-Chain)

The term “off-chain” refers to activities or transactions that take place outside of the blockchain. In this context, an off-chain asset is a file that is not directly uploaded on the blockchain.

Since it is not advisable to store non-transaction data, the file is uploaded to another server or database (IPFS, MongoDB, Oracle, etc.) and the HashID generated for the uploaded document will be stored on the blockchain as metadata.

What is IPFS?

Web3 Database 🤯

InterPlanetary File System (IPFS) is a decentralized storage system based on content addressing

The InterPlanetary File System (IPFS) is a decentralized storage system. A protocol and peer-to-peer (p2p) network for storing, accessing, and sharing data in a distributed file system like a blockchain.

IPFS is based on Content-Based Identity (CID) or Content-Based Addressing which is created to be faster than the traditional Location-Based Addressing method of saving files.

What is Location-Based Addressing?

HTTP: “Where” is the content you want 🤷‍♂️

Location-Based Addressing is the traditional method of accessing content such as photos, music, and files on the internet and it requires specifying where the content is hosted by providing an absolute path or address to the content as shown below:

Example of accessing content on the web using Location-based Addressing

The limitation of Location-Based Addressing is that it makes use of a centralized server and the contents will be unavailable if the server that hosts them goes down.

In a centralized server such as Twitter and Facebook, they independently control how their user’s saved contents are delivered (i.e. URL) and you can only access a Twitter profile image via Twitter URL and not Facebook URL.

What is Content-Based Addressing?

IPFS: “What” content do you want 🤔

In Content-Based Addressing or Content-Addressed Storage (CAS), every uploaded content has its own unique identifier known as Hash, which can be compared to a fingerprint, and no two contents can share the same hash.

Content such as photos, music, and files are accessible through their unique IPFS hash rather than their location.

Example of accessing content with their IPFS hash on the web using Content-Based Addressing

Any content uploaded on IPFS is accessible via the supported IPFS public gateway. For instance, when a file is uploaded via Moralis IPFS, we can then make use of the Infura IPFS URL to access the file.

The uploaded contents are stored in an IPFS object which is a data structure with two fields, a data which can hold up to 256 KB of blob data, and links, which is an array of links to other IPFS objects.



{
   Data: "",
   Links: [
      {
         Name: “”,  
         Hash: “”,
         Size: 256000
      }
   ]
}

When content is more than 256kb in size, IPFS will automatically break it down into multiple objects and create an empty IPFS to link all the hashes together.

Contents stored on the IPFS cannot be changed like on the blockchain. Instead, IPFS supports versioning of your contents known as IPFS commit object, which is connected to the previous version objects.

IPFS is originally created by Juan Benet, the founder of Protocol Labs in February 2015.

Where Are IPFS Data Stored?

Cached Folders 🗂

Data stored on IPFS are saved locally on a computer’s cache folder and served to others who requested it via an IPFS gateway. The data is also cached on the new user’s computer.

The cached data are trashed during garbage collection which could lead to loss of data. In order to save your data permanently on the IPFS, you need to pin it to one of the IPFS networks.

What Are the Advantages of IPFS?

  1. Fast record retrieval.

  2. It works with every technology.

  3. Only a single instance of content can be stored (no duplicate).

  4. Uploaded contents are authentic with their unique identifiers.

  5. Uploaded contents cannot be altered.

Difference Between IPFS and HTTP Storage

IPFS (Content-Based Addressing) HTTP (Location-Based Addressing)
It is based on a decentralized server It is based on a centralized origin server
It makes use of content-addressing It makes use of location-addressing
All objects with the same content are stored only once All objects with the same content can be stored multiple times
Files are shared across multiple nodes and are always accessible Files are not accessible when the server is down
It has a high market It has a low market
Immutable (Versioning) Mutable

Wrapping Up

InterPlanetary File System (IPFS) is a reliable and decentralized storage system. It is also widely regarded as the future of file storage.

In this article, we learned about the differences between HTTP and IPFS storage, as well as the on-chain and off-chain (IPFS) methods of storing files on the blockchain.

Where Do You Go Next?

Now that you know how files are stored on the blockchain and how IPFS works:


This article is a part of the Hashnode Web3 blog, where a team of curated writers are bringing out new resources to help you discover the universe of web3. Check us out for more on NFTs, DAOs, blockchains, and the decentralized future.



Source link

Tags: BlockchainFilesIPFSStore
Share30Tweet19
Xiao Chen Sun

Xiao Chen Sun

Recommended For You

My foray into Ethereum and creating something of value for a global ecosystem

by Xiao Chen Sun
September 21, 2023
0
My foray into Ethereum and creating something of value for a global ecosystem

This month marks an enormous milestone for me within the Ethereum neighborhood. In September 2016, I announced the open-source library, Web3j, that I had authored to the world. Web3j was created...

Read more

QANplatform Selected for the EY (Ernst & Young) Startup Academy to Accelerate Growth and Innovation

by Xiao Chen Sun
September 21, 2023
0
QANplatform Selected for the EY (Ernst & Young) Startup Academy to Accelerate Growth and Innovation

Proper after the discharge of the enterprise-ready quantum-resistant QAN Private Blockchain, QANplatform is honored to announce its choice to take part within the prestigious EY Startup Academy. This...

Read more

FUNToken Enters a New Era as It Joins the Ranks of BitMart Exchange, Expanding Opportunities for iGaming Enthusiasts

by Xiao Chen Sun
September 16, 2023
0
FUNToken Enters a New Era as It Joins the Ranks of BitMart Exchange, Expanding Opportunities for iGaming Enthusiasts

The momentous event of FUNToken’s official itemizing on BitMart Alternate has arrived, efficient September fifteenth, 2023. Acknowledged as a number one participant within the crypto panorama, BitMart Alternate boasts over...

Read more

Why is Web3 so significant globally?

by Xiao Chen Sun
September 14, 2023
0
Why is Web3 so significant globally?

I have been studying David Deutsch's wonderful e-book, The Starting of Infinity of late. For these of you who aren't acquainted with David Deutsch, he pioneered the sphere of quantum...

Read more

QANplatform Launches the Quantum-Resistant Private Blockchain: The New Era for Web3 OS

by Xiao Chen Sun
September 13, 2023
0

QANplatform has unveiled the world's first personal blockchain that's each quantum-resistant and suitable with Ethereum's EVM, whereas additionally enabling builders to code good contracts in any programming language. ...

Read more
Next Post
SkyBridge Capital CEO Anthony Scaramucci Says SEC Should Be Kept in Check With New Pro-Crypto Initiatives

SkyBridge Capital CEO Anthony Scaramucci Says SEC Should Be Kept in Check With New Pro-Crypto Initiatives

Related News

Goerli Shapella Announcement | Ethereum Foundation Blog

Sepolia Shapella Announcement | Ethereum Foundation Blog

March 10, 2023
Cobo and BlockSec Join Forces to Co-Build Advanced DeFi

Cobo and BlockSec Join Forces to Co-Build Advanced DeFi

September 6, 2023
Tracing Bitcoin’s price decline through crucial metrics

Tracing Bitcoin’s price decline through crucial metrics

August 4, 2023

Browse by Category

  • Altcoin
  • Altcoin News
  • Altcoins
  • Artificial Intelligence
  • Bitcoin
  • Blockchain
  • Blockchain Games
  • Business
  • Crypto
  • Cryptocurrencies
  • Cryptocurrency
  • Culture
  • DeFi
  • Economy
  • Education
  • Entertainment
  • Ethereum
  • Featured
  • Gambling
  • Governance
  • Health
  • Lifestyle
  • Market
  • News
  • Regulations
  • Uncategorized
  • Web 3.0
  • World

Find Via Tags

Altcoin Analyst Bank Binance Bitcoin Blockchain Blog BTC CEO Coinbase Court Crypto data DeFi digital ETF ETH Ethereum Exchange finance Financial Foundation FTX Heres high IBM Investors Launch Launches market million Network NFT Price Protocol Rally Regulatory Report Ripple SEC Spot Top Trading Web3 XRP

Categories

  • Altcoin
  • Altcoin News
  • Altcoins
  • Artificial Intelligence
  • Bitcoin
  • Blockchain
  • Blockchain Games
  • Business
  • Crypto
  • Cryptocurrencies
  • Cryptocurrency
  • Culture
  • DeFi
  • Economy
  • Education
  • Entertainment
  • Ethereum
  • Featured
  • Gambling
  • Governance
  • Health
  • Lifestyle
  • Market
  • News
  • Regulations
  • Uncategorized
  • Web 3.0
  • World

Recommended

  • Australian Financial Regulator Sues Kraken Subsidiary for Allegedly Violating Margin Trading Regulations
  • Trader Says Dogecoin Rival Has Additional Upside Potential, Updates Outlook on Bitcoin and Worldcoin
  • Analyst Backs Bitcoin To Reach $34,500 In 2024 In New Prediction
  • What can AI and generative AI do for governments?
  • $25K or $30K Coming First? (BTC Price Analysis)

© 2023 BTC NOON | All Rights Reserved

No Result
View All Result
  • Home
  • Cryptocurrency
  • Bitcoin
  • Ethereum
  • Blockchain
  • Regulations
  • Altcoin
  • DeFi
  • Web 3.0

© 2023 BTC NOON | All Rights Reserved

Are you sure want to unlock this post?
Unlock left : 0
Are you sure want to cancel subscription?