Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DHT discovery is only finding bootstrap nodes NOT other nodes #2

Open
elielnfinic opened this issue Oct 27, 2024 · 0 comments
Open

Comments

@elielnfinic
Copy link

Hello everyone,

I am currently testing the DHT discovery example file. I created a simple bootstrap node.
When launching 4 instances of 1-dht.js file, they are able to make connection to the bootstrap node only, they can't connect to other nodes.

Do you think this behavior is okay?

Here is my bootstrap node code :

import { createLibp2p } from 'libp2p'
import { tcp } from '@libp2p/tcp'
import { noise } from '@chainsafe/libp2p-noise'
import { kadDHT } from '@libp2p/kad-dht'
import { identify } from '@libp2p/identify'
import { yamux } from '@chainsafe/libp2p-yamux'

const node = await createLibp2p({
    addresses: {
        listen: [
            '/ip4/0.0.0.0/tcp/2000',
            '/ip4/0.0.0.0/tcp/2001/ws'
        ]
    },
    transports: [
        tcp()
    ],
    streamMuxers: [
        yamux()
    ],
    connectionEncrypters: [
        noise()
    ],
    services: {
        identify: identify(),
        dht: kadDHT({
            kBucketSize: 20,
            clientMode: false           // Whether to run the WAN DHT in client or server mode (default: client mode)
        })
    }
})

node.start();


console.log('PeerID: ', node.peerId.toString())
  console.log('Multiaddrs: ', node.getMultiaddrs())

Thank you.

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

No branches or pull requests

1 participant