IPFS and IPNS is one node enough for a basic API?

Hello,

I thought if I pin a file to ipfs locally with a python script or the CLI, that I can shut down my computer and should be able to reach from any other place with the CID that file.
I read now that this is not always true and to ensure that I would need my own cluster or IPFS nodes? Is this true?

I am asking because I want to create a small API and deploy it on a server. The API should be able to publish new files to an already deployed server and then use IPNS to keep the
uri of the folder static. so that I can do:

ipfs://<IPNS_FOLDERR_CID>/filename

Most http gateway services do only offer a pinning service to IPFS but I want to keep it static. But will the files still be reachable if my VM goes down?

I do not want to make the API public available it will only be used for some NFT minting

When you add/pin a file on your own node, it is only copied into that node (locally) and your node becomes a server for it. If you shut down that node/server, that file is no longer available to others. The solution is to re-pin that file on another server that doesn’t go down (there are sites that offer that service, such as web3.storage, pinata, fleek, etc). you can also run your own server on a provider (such as AWS, Digital Ocean, etc) and re-pin your files there.

The bottom line is, the file has to be pinned on a server that stays up, or it’s not available

1 Like

@ylempereur thank you for clarifying this.

Is the same for IPNS? Could I pin my folder/file to a pinning service like pinata and then take the CID from the Pinata cluster and publish to IPNS from my node?

If my node then goes offline can I still reach the files using my IPNS protocol? The files would be pinned by a cluster? Or does the node from which I published to IPNS also need to stay online?

Yes, you can.

It depends, there are two kinds of IPNS:

  • DNS based. This is served by the DNS infrastructure, your node isn’t involved and can be shut down
  • Name publish. This is served by your node, and your node only, it cannot be re-pinned (yet). If your node goes down, it goes away within a few hours

@ylempereur okay cool so I would need to go with solution one? When you say DNS based IPNS do you mean this DNSLink | IPFS Docs

Yep, that’s the one.

@ylempereur

I have read the description and also the base documentation on dnslink.io It seems when I use DNSLink I will need to resolve the address inside the smart contract? Or can I use inside my smart contract then a static baseUri? I am a bit confused by the documentation.

They state that with a simple up-to-date txt record it is easy to resolve the address. But can I simply paste the address into the browser and the browser will resolve it for me? Or at least can OpenSea resolve this?

It depends on how to intend to retrieve the target file:

  • if you set up a gateway, you can then use an https://domain.tld url, and it will retrieve the file for you (and take care of everything)
  • if you are using an ipfs node, just use an ipns path: /ipns/domain.tld

either way, that’s all you need to do

1 Like

Do I even need my either of both?

Can I not just pin and patch my folder using pinata and then update the txt record to point to the new hash?

if you just set up the _dnslink.xxx record, you’ll still need an ipfs node to retrieve your content (or use an ipfs compatible browser, such as Brave). If you want anyone else to be able to retrieve the content, you need to also set up a gateway and then you can use an https url to it. those were the two options I described

For IPNS pinning you can use https://dwebservices.xyz