Skip to content

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

@elielnfinic

Description

@elielnfinic

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions