<h3>How does IPFS use Blockchain</h3>
<p><a href="https://ipfs.io/#how" rel="nofollow noreferrer">https://ipfs.io/#how</a> says</p>
<blockquote>
<p>Blockchains</p>
<p>IPFS and the Blockchain are a perfect match! You can address large amounts of data with IPFS, and place the immutable, permanent IPFS links into a blockchain transaction. This timestamps and secures your content, without having to put the data on the chain itself.</p>
</blockquote>
<p>So yes, IPFS is separate from the Bitcoin blockchain but it seems you have the <em>option</em> of embedding a hash in a Bitcoin transaction (for which the usual fees are needed) as proof that the hashed data existed at a point in time.</p>
<p>The Bitcoin blockchain is a journal of Bitcoin currency transactions. Small items like hashes can be included in the transaction details that are recorded but you pay a fee per byte and you need to have a funded wallet.</p>
<hr />
<h3>Related Questions</h3>
<ul>
<li><a href="https://bitcoin.stackexchange.com/q/32575/13866">What methods are currently used to embed additional data into the Bitcoin blockchain?</a></li>
</ul>

CC BY-SA 4.0
2018-11-28T10:46:03.330Z
2018-11-29T10:13:37.247Z
2020-06-16T11:10:03.350Z
RedGrittyBrick
<p>Both Bitcoin and IPFS have a p2p messaging protocol where peers can request and offer public data resources to each other. </p>

<p><strong>Saving Data in the Bitcoin Blockchain</strong></p>

<p>The Bitcoin p2p layer is quite simple and simply allows Bitcoin nodes to gossip/propagate new transactions and valid blocks which extend the chain. Bitcoin nodes take these public data resources (tx's, blocks) and validate them to determine the canonical transaction history. </p>

<p>Saving data in the Bitcoin blockchain means "appending it" to one of these datatypes. You can add up to 80B of arbitrary data to any TX output script which you sign (See OP_RETURN), or arbitrary data in the Coinbase transaction input script if you mine a block. Once organised into the longest chain, both TX and Blocks will immutable, and considered part of the canonical valid transaction history, and so will your arbitrary data. Of course, the amount of data is very limited and not critical to the security or functionality of Bitcoin.</p>

<p><strong>Distributing Data with IPFS</strong></p>

<p>You can think of IPFS as a more generalised p2p protocol, which extends beyond just gossiping/flooding the peer topology with specific types of data (transactions, blocks). IPFS nodes request/provide peers with any filetype, and extend this to any type of data the user would like to share. The data itself is hash-addressed so it can be uniquely identified (similar to tx, and blocks, which are also hash-ID'd). Furthermore, IPFS offers metadata data-types to link different files to each other via hash-links (See IPLD). </p>

<p>Finally, the IPFS also hosts a distributed-hash-table (see Kademlia DHT), which enables any peer to to look up a distributed global map. This can be used as a global namespace, or a distributed resource to find the address of a peer that is currently hosting your file-of-interest.</p>

<p>Saving data in IPFS simply means that your file is being hosted/cached by at least one of the IPFS nodes in the network. If it is requested by other nodes, it will be cached locally at each requesting node for a time period. There are no guarantees that the file will be hosted indefinitely, as network peers collectively serve as distributed cache. The only guarantee to availability is to host your file(s)/data on a IPFS server you run yourself (pinning).</p>

<p>IPFS is conceptually very similar to Bittorrent/Gnutella.</p>

CC BY-SA 4.0
2018-11-29T19:44:31.613Z
2018-11-29T19:44:31.613Z
James C.
<p>My learning on blockchain is mainly theory based. I have always been under the impression that blockchain is about data processing and data storage which I think this is where I am confused.</p>

<p>I have always pictured blockchain as a P2P decentralised data storage system where anyone can transfer/upload/store anything on the blockchain network. Data can be anything of a value. Any upload and transfer of data is encrypted. Data is stored encrypted. There is some magical formula that turns whatever size data into digest. Anyone who retrieve the digest will be able to turn it back to the original content with the key. </p>

<p>The more I delve into it, the more it seems I have been understanding it all wrong. </p>

<p><strong>Data Storage</strong></p>

<p><em>I understand Bitcoin is not meant for data storage. It can be but not meant for. I read about IPFS.</em> </p>

<p>Now, the data storage part whenever it is mentioned with blockchain technology(not restricted to bitcoin), without reference to IPFS or equivalent, does the data generally mean hashes of digital signatures? We store the digital signatures of the data. We don't 'upload and save' the content like what we do with cloud storage? (Let's assume cost of storage is not an issue.)</p>

<p>The recipient is not able to 'convert' the digest to the original content since the original content is not 'transfer'/'store' on the blockchain at all. </p>

<p>If we want to encrypt the data, we will do it 'on our own' using an <em>external service</em> off the chain. We sign the encrypted data with private key. The recipient will use our public key to verify the digital signature and what they received is the encrypted data. The decryption part is to be communicated off the chain. </p>

<p>Have I understood the above correctly now? </p>

<p>======= </p>

<p>My question is not restricted to Bitcoin but blockchain in general. </p>

<blockchain><blockchain-data-storage>
Blockchain data storage
Samantha
# Blockchain data storage

(Asked by: username_0 on 2018-11-28)

My learning on blockchain is mainly theory based. I have always been under the impression that blockchain is about data processing and data storage which I think this is where I am confused.

I have always pictured blockchain as a P2P decentralised data storage system where anyone can transfer/upload/store anything on the blockchain network. Data can be anything of a value. Any upload and transfer of data is encrypted. Data is stored encrypted. There is some magical formula that turns whatever size data into digest. Anyone who retrieve the digest will be able to turn it back to the original content with the key.

The more I delve into it, the more it seems I have been understanding it all wrong.

**Data Storage**

*I understand Bitcoin is not meant for data storage. It can be but not meant for. I read about IPFS.*

Now, the data storage part whenever it is mentioned with blockchain technology(not restricted to bitcoin), without reference to IPFS or equivalent, does the data generally mean hashes of digital signatures? We store the digital signatures of the data. We don't 'upload and save' the content like what we do with cloud storage? (Let's assume cost of storage is not an issue.)

The recipient is not able to 'convert' the digest to the original content since the original content is not 'transfer'/'store' on the blockchain at all.

If we want to encrypt the data, we will do it 'on our own' using an *external service* off the chain. We sign the encrypted data with private key. The recipient will use our public key to verify the digital signature and what they received is the encrypted data. The decryption part is to be communicated off the chain.

Have I understood the above correctly now?

=======

My question is not restricted to Bitcoin but blockchain in general.

**Tags:** blockchain, blockchain-data-storage


---

## 2 answers

### Answer by username_1 on 2018-11-28. Score: 1 | Accepted answer

### How does IPFS use Blockchain

<https://ipfs.io/#how> says

> Blockchains
>
> IPFS and the Blockchain are a perfect match! You can address large amounts of data with IPFS, and place the immutable, permanent IPFS links into a blockchain transaction. This timestamps and secures your content, without having to put the data on the chain itself.

So yes, IPFS is separate from the Bitcoin blockchain but it seems you have the *option* of embedding a hash in a Bitcoin transaction (for which the usual fees are needed) as proof that the hashed data existed at a point in time.

The Bitcoin blockchain is a journal of Bitcoin currency transactions. Small items like hashes can be included in the transaction details that are recorded but you pay a fee per byte and you need to have a funded wallet.

---

### Related Questions

* [What methods are currently used to embed additional data into the Bitcoin blockchain?](https://bitcoin.stackexchange.com/q/32575/13866)


---

### Answer by username_2 on 2018-11-29. Score: 1

Both Bitcoin and IPFS have a p2p messaging protocol where peers can request and offer public data resources to each other.

**Saving Data in the Bitcoin Blockchain**

The Bitcoin p2p layer is quite simple and simply allows Bitcoin nodes to gossip/propagate new transactions and valid blocks which extend the chain. Bitcoin nodes take these public data resources (tx's, blocks) and validate them to determine the canonical transaction history.

Saving data in the Bitcoin blockchain means "appending it" to one of these datatypes. You can add up to 80B of arbitrary data to any TX output script which you sign (See OP\_RETURN), or arbitrary data in the Coinbase transaction input script if you mine a block. Once organised into the longest chain, both TX and Blocks will immutable, and considered part of the canonical valid transaction history, and so will your arbitrary data. Of course, the amount of data is very limited and not critical to the security or functionality of Bitcoin.

**Distributing Data with IPFS**

You can think of IPFS as a more generalised p2p protocol, which extends beyond just gossiping/flooding the peer topology with specific types of data (transactions, blocks). IPFS nodes request/provide peers with any filetype, and extend this to any type of data the user would like to share. The data itself is hash-addressed so it can be uniquely identified (similar to tx, and blocks, which are also hash-ID'd). Furthermore, IPFS offers metadata data-types to link different files to each other via hash-links (See IPLD).

Finally, the IPFS also hosts a distributed-hash-table (see Kademlia DHT), which enables any peer to to look up a distributed global map. This can be used as a global namespace, or a distributed resource to find the address of a peer that is currently hosting your file-of-interest.

Saving data in IPFS simply means that your file is being hosted/cached by at least one of the IPFS nodes in the network. If it is requested by other nodes, it will be cached locally at each requesting node for a time period. There are no guarantees that the file will be hosted indefinitely, as network peers collectively serve as distributed cache. The only guarantee to availability is to host your file(s)/data on a IPFS server you run yourself (pinning).

IPFS is conceptually very similar to Bittorrent/Gnutella.


---

