
IPFS
Table of Contents
IPFS
IPFS is an open system to manage data without a central server. That means it’s decentralized eh.
Why IPFS?
Our peer-to-peer content delivery network is built around the innovation of
- content addressing:
- store,
- retrieve,
- locate data based on the fingerprint of its actual content rather than its name or location.
- content addressing:
Open: The IPFS network is distributed and participatory, which reduces the problem of data silos that plague central servers.
Verifiable: The integrity of all data is verified using hash functions, so you can trust that you always get the data you’re looking for.
Resilient: Files and data can be stored across multiple nodes, which keeps content at the ready even during critical outages.
What can be done?
Build peer-to-peer apps with IPFS
Store and manage your data on IPFS
Use IPFS apps
Develop tooling for IPFS
As I am just starting out I’ll start with “Store and manage your data on IPFS”
Interesting a new thing came up here, Web3 Storage, we’ll learn about it later.
Okay so,
IPFS is a decentralized protocol and web3.storage is a Data layer on top of it.
Store and manage your data on IPFS
Let’s start by installing the IPFS Desktop app.
Download the client from here.
When it is beating like a heart, it really gets my heart thumping.
This is first page of application.
These are the peers I am connected to.
Let’s add a file and see what happens.
- Added a file (.m4a)
Chormium said:
504 Gateway timeout
The gateway is taking too long to fetch your content from the public IPFS network. This could be due to several reasons:
There are no providers for CID in the IPFS network
The provider node for the CID is offline, on a slow network connection, or is overloaded
You might try waiting for a while and trying again. To prevent having this problem in the future, why not self-host a node? You will be able to get all the content in the IPFS network straight from its source! For more information see the implementations page. You might also want to have a look at the IPFS companion browser extension which will allow your browser to seamlessly fetch content from your local node.
How you can proceed:
Verify the URL and try again.
Self-host and run an IPFS client that verifies your data.
Try diagnosing your request with the IPFS diagnostic tools.
Inspect the CID or DAG.
Debug retrievability of CID
So, I
- copied the CID
- pasted it in Explorer
- Tapped inspect
The file size is 4mb!
Viewing on local gateway:
- Opens up Brave browser
- http://bafybeiee2tuwgidl74iedxiftl7qmphgc5ebf23ztoqsz3bpcjf67eccwe.ipfs.localhost:8080/
- Music starts to play!
I think QmXHAprFSFijbChcydw5m6DNP35CULXVmHi1wuWY7xW4nU
is the hash of the file that I have uplaoded, no this is the CID.
Viewing on Public gateway:
https://bafybeiee2tuwgidl74iedxiftl7qmphgc5ebf23ztoqsz3bpcjf67eccwe.ipfs.dweb.link/
But this URL does not seems to be working.
Inspecting more, so the 4mb file that I have uploaded is that divided into 16 pieces?
Single block:
The calculation does seems fit.
Operations that can be performed:
Copy CID: QmXHAprFSFijbChcydw5m6DNP35CULXVmHi1wuWY7xW4nU
Inspect: shows you the 16 blocks
Pinning?
Download
- As CAR?
Publish to IPNS
Please wait while the initial 20 copies of the updated IPNS record are stored with the help of DHT peers…
Copy the link below and share it with others. The IPNS address will resolve as long as your node remains available on the network once a day to refresh the IPNS record.
https://ipfs.io/ipns/k51qzi5uqu5dlm808wfx724kkx6ewnptre6zrfmqi4i3fh49904ve9ia6toxzq
Opening this link gives same error.
504 Gateway timeout
The gateway is taking too long to fetch your content from the public IPFS network. This could be due to several reasons:
There are no providers for CID in the IPFS network
The provider node for the CID is offline, on a slow network connection, or is overloaded
You might try waiting for a while and trying again. To prevent having this problem in the future, why not self-host a node? You will be able to get all the content in the IPFS network straight from its source! For more information see the implementations page. You might also want to have a look at the IPFS companion browser extension which will allow your browser to seamlessly fetch content from your local node.
How you can proceed:
Verify the URL and try again.
Self-host and run an IPFS client that verifies your data.
Try diagnosing your request with the IPFS diagnostic tools.
Inspect the CID or DAG.
There are no providers for CID in the IPFS network, why not? I am hosting it.
The provider node for the CID is offline, on a slow network connection. Well I am online and the network is not slow.
Now I’ll have to dig into the IPFS.
Publishing Files
https://docs.ipfs.tech/quickstart/publish/
In this quickstart guide, you will learn about pinning services and how to use them to publish content-addressed data with IPFS. To learn the process, you will upload the file to a pinning service called web3.storage (opens new window). By the end of this guide, you should have a better understanding of how content addressing and CIDs work from a high level.
Pinning refers to the process of ensuring that a particular piece of content is retrievable with IPFS.
Pinning services are similar to hosting services, in that they run an IPFS node for you and ensure that your files are available to the IPFS network.
Here let’s using Web3 Storage for pinning: https://web3.storage/
To get started with w3up you'll need to sign up for a subscription. If you choose the free plan we won't charge your credit card, but we do need a card on file before we will store your bits.
Pick a plan below and complete the Stripe signup flow to get started!
Well it is asking for money.
Trying Filebase
I could register to Filebase.
In settings add FileBase service for Pinning.
- Create a bucket in Filebase:
- Access keys:
Choose that bucket and it will give the key
It says fail to fetch!!
Pinata
Sign up and get to the dashboard.
Nope this is not working!
I have added, Secret, JWT, Key
So, I upload the file to Pinata and got the CID : bafybeihocxwgj43s2qvy5issdieu4wirlzjkfnhvpq4nzbkriodzkr43rq
And this is the file link: https://tan-left-pig-157.mypinata.cloud/ipfs/bafybeihocxwgj43s2qvy5issdieu4wirlzjkfnhvpq4nzbkriodzkr43rq
Well the closest I could go to my goal is:
- Got the file in IPFS but can access locally, so did I even got that to public? i don’t know
- Got the file publically using Pinata
I thought I could listen to the music at https://diffuse.sh/
But no worries let’s learn IPFS in more depth from here.