ipfs-examples / helia-examples

How to do most anything with your Helia node
https://verified-fetch.vercel.app
64 stars 58 forks source link

example: create and host IPFS content from helia node (browser & nodejs) #39

Open SgtPooki opened 1 year ago

SgtPooki commented 1 year ago

Not sure what the blockers are, but after a post in slack, I wanted to make sure we had an item tracking creating an example for this, and any blockers.

achingbrain commented 1 year ago

For people without slack, or for after slack deletes the message, this is what it said:

Was able to get Helia working, and it uploads my file, but I'm not able to see it on the public gateways? How do I publish to ipns or get it to be seen on the public gateways?

Connecting to 12D3Foo...
Adding file image-581431514258.jpg...
Added to bafyfoo
achingbrain commented 1 year ago

The need for an IPNS example is mentioned here: https://github.com/ipfs/helia/issues/43

The esbuild demo generates a link you can click to load content you just added to your local node from the public gateway.

It's going to be hard from the browser because you either have to:

  1. Be trying to load content from a gateway that your demo browser node already has a direct connection to (e.g. for bitswap to do it's thing)
  2. Be externally diallable by the gateway. Adding the block will cause a provider record to be published to third party nodes that points to your browser node. The gateway needs to be able to resolve that provider record, then dial your node for bitswap to kick in.

--

  1. is luck of the draw since the gateways have round-robin DNS
  2. will become more workable when the private-to-private webrtc transport arrives
achingbrain commented 1 year ago

Maybe a dupe of https://github.com/ipfs-examples/helia-examples/issues/38 ?

aschmahmann commented 1 year ago

IIUC 2 should also be doable even without the private-to-private webrtc transport.

For example: if a publicly reachable node (e.g. the kubo nodes currently running behind dweb.link) tries to fetch content from a browser and that browser node is connected to some relays the publicly reachable node can ask the browser to dial them back using WSS, WebTransport or browser-to-server webrtc

Obviously private-to-private webrtc gives more connectivity in more environments which is 👍. It's also unintuitive for people to think that making themselves publicly accessible will result in them being able to retrieve more content, although it happens to be good for the network overall for more nodes to be publicly accessible so not such a bad result 🙃.

maceip commented 1 year ago

can we get an ipfs funded circuitRelayServer to bootstrap browser-browser webrtc -> ipfs (and/or do other public relays exist?).

I think an example of helia with autonat + circuitrelay using an ipfs-hosted bootstrap /webrtc/ multiaddr would increase new dev velocity ( I just went down this rabbit hole)

SgtPooki commented 1 year ago

AFAIK, this is fully unblocked, we just need to write up the example.

SgtPooki commented 1 year ago

FYI: I posted a reply to the discuss.ipfs.tech post regarding fetching content from a helia node.

See https://discuss.ipfs.tech/t/how-to-retrieve-content-uploaded-via-helia-using-the-ipfs-gateway/16582/6?u=sgtpooki.

Please let me know if anyone tries it out and runs into issues.