You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description:
In a pure browser environment, initializing IPFS nodes based on Helia with even an empty services configuration (e.g., libp2p: { services: {} }) disrupts the node's ability to discover peer nodes automatically. However, removing the services option entirely restores peer discovery capabilities. Given the dependencies of OrbitDB on specific libp2p configurations involving the services option (specifically pubsub with gossipsub), it is crucial to enable services.
Steps to Reproduce:
Initialize a Helia-based IPFS node in a clean browser environment with the following configuration:
// index.jsimport{IDBBlockstore}from'blockstore-idb';import{IDBDatastore}from'datastore-idb';import{createHelia}from'helia';constinstantiateHeliaNode=async()=>{constdatastore=newIDBDatastore('/datastore2');constblockstore=newIDBBlockstore('/blockstore2');awaitdatastore.open();awaitblockstore.open();constheliaInstance=awaitcreateHelia({libp2p: {services: {}},peerStore: {persistence: false,threshold: 5},keychain: {pass: 'very-strong-password'},datastore: datastore,blockstore: blockstore});returnheliaInstance;};document.addEventListener("DOMContentLoaded",async()=>{consthelia=window.helia=awaitinstantiateHeliaNode();// monitorconsole.log('Helia node created with ID:',helia.libp2p.peerId.toString())setInterval(async()=>{constpeers=awaithelia.libp2p.peerStore.all();console.log(`Total number of store peers: ${peers.length}`);console.log('Connected peers count:',helia.libp2p.getPeers().length);},3000);});
<!-- index.html --><!DOCTYPE html><htmllang="en"><head><metacharset="UTF-8" /><metahttp-equiv="X-UA-Compatible" content="IE=edge" /><metaname="viewport" content="width=device-width, initial-scale=1.0" /><scripttype="module" crossoriginsrc="./index.js"></script></head><body><h1>IPFS in the Browser via Helia</h1></body></html>
Observe the node's inability to discover peers (It may take several minutes or more).
Remove or delete the services configuration and reinitialize the node in a clean browser environment (e.g., a new incognito window):
// In the index.js file: constheliaInstance=awaitcreateHelia({// libp2p: {// services: {}// },peerStore: {persistence: false,threshold: 5},keychain: {pass: 'very-strong-password'},datastore: datastore,blockstore: blockstore});
Observe that the node can now discover peers.
Expected Behavior:
The node should be able to discover peers automatically, even when the services option is used, provided it is configured correctly or even if it is empty.
Actual Behavior:
The node fails to discover peers when the services option is included in the configuration. Removing this option restores peer discovery functionality.
Environment:
Browser Version: Google Chrome 123.0.6312, Microsoft Edge 123.2420
Operating System: Windows 2022
Helia Version: 4.2.1
Libp2p Version: 1.3.3
Additional Information:
Despite reviewing the documentation on service-related configurations (libp2p interface documentation and source code), I am still unsure how to resolve this issue.
Use the Service option to start Helia:
Start Helia without using the Service option:
The text was updated successfully, but these errors were encountered:
orwithout
changed the title
Issue with Node Auto-discovery When Initializing with Custom Service
Issue with Peer-discovery When Initializing with Custom Service (pure browser environment)
May 8, 2024
Description:
In a pure browser environment, initializing IPFS nodes based on Helia with even an empty
services
configuration (e.g.,libp2p: { services: {} }
) disrupts the node's ability to discover peer nodes automatically. However, removing theservices
option entirely restores peer discovery capabilities. Given the dependencies of OrbitDB on specificlibp2p
configurations involving theservices
option (specificallypubsub
withgossipsub
), it is crucial to enableservices
.Steps to Reproduce:
services
configuration and reinitialize the node in a clean browser environment (e.g., a new incognito window):Expected Behavior:
The node should be able to discover peers automatically, even when the
services
option is used, provided it is configured correctly or even if it is empty.Actual Behavior:
The node fails to discover peers when the
services
option is included in the configuration. Removing this option restores peer discovery functionality.Environment:
Additional Information:
Despite reviewing the documentation on service-related configurations (libp2p interface documentation and source code), I am still unsure how to resolve this issue.
Use the Service option to start Helia:
Start Helia without using the Service option:
The text was updated successfully, but these errors were encountered: