Skip to content

feat: create @helia/http library without bitswap/libp2p deps  #289

@SgtPooki

Description

@SgtPooki

Helia consumers should be able to use Helia without depending on the p2p network. Ideally, users could use Helia modularly, with trustless-http-gateway (or other source of getting blocks) and validate those blocks, using only the IPFS portion of Helia.

Current

It doesn't seem like we can "remove" libp2p entirely, but we can disable it:

const helia = await createHelia({
  blockBrokers: [
    trustlessGateway()
  ],
  libp2p: {
    start: false,
    connectionManager: {
      minConnections: 0,
    },
  }
})

Future (with @helia/http)

No runtime js-libp2p deps are pulled in with this module

import type { Helia } from '@helia/interface'
import { createHttpOnlyHelia } from '@helia/http' // export name to be decided. should probably be `createHelia`
import { unixfs } from '@helia/unixfs'

const helia: Helia<null> = createHttpOnlyHelia() 

const fs = unixfs(helia)

// ...
### Tasks
- [ ] https://github.com/ipfs/helia/issues/341
- [x] create @helia/http package
- [x] @helia/http should accept an interface of only blockstore+blockBrokers that should work like Helia's networked blockstore.
- [ ] Add `@helia/http` usage example to readme

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions