Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

Connect Helia Node with Infura Gateway #56

Closed
seanrasku opened this issue Jun 5, 2023 · 4 comments
Closed

Connect Helia Node with Infura Gateway #56

seanrasku opened this issue Jun 5, 2023 · 4 comments

Comments

@seanrasku
Copy link

seanrasku commented Jun 5, 2023

Looking through the docs, I see the only way to instantiate a Helia node is with createHelia(), which takes a libp2p. Is it possible to connect it to an Infura IPFS gateway yet? I'm trying to understand how to pin data with Helia IPNS, but cannot find documentation to answer my question.

@achingbrain
Copy link
Member

If the Infura IPFS gateway is running an IPFS node on a multiaddr you know, you can either dial the multiaddr after startup:

import { createHelia } from 'helia'

const helia = await createHelia()
helia.libp2p.dial(multiaddr)

or you can configure libp2p to bootstrap to the Infura node (e.g. connect on startup):

import { createHelia } from 'helia'
import { bootstrap } from '@libp2p/bootstrap'

const helia = await createHelia({
  libp2p: {
    peerDiscovery: [
      bootstrap({
        list: [
          multiaddr,
          // ...other bootstrap nodes
        ]
      })
    ]
  }
})

See the default libp2p config and the default list of bootstrap nodes

@TJKoury
Copy link

TJKoury commented Jun 29, 2023

This still doesn't seem to be working, maybe it just doesn't work in the browser yet.

Here's a test sandbox, using the same instance / transport as the helia instance that seems to be working on the page.

The error I get is "PublishError.InsufficientPeers", even though there are plenty of peers.

Also, this isn't to Infura gateways, just thought it might be the same issue.

@SgtPooki
Copy link
Member

@TJKoury the browser usecase is not likely to succeed well yet. Follow ipfs/helia#182 for more details

@achingbrain
Copy link
Member

Tracked in ipfs/helia#182

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants