I want to keep the same node of Helia although I refresh the browsesr

Hello everyone,

I was wondering if it is possible to have the same node that was initialized for the first time. For example, IPFS daemon is always consistent with the same node. I want to have the same functionality using Helia.

Thanks in advance

The memory data store is used by default

By default, Helia is instantiated with a Memory Datastore (where the key pair and PeerID are stored) and Memory Blockstore (where blocks are stored):

The memory data store does not persist anything across reloads.

Changing the default block/data store for persisent peer identity

In the browser, you can do that by instantiating Helia with the IndexedDB-data/block store:

import { createHelia } from 'helia'
import { IDBDatastore } from 'datastore-idb'

const store = new IDBDatastore('helia-data')

const helia = await createHelia({ datastore: store })
1 Like