How to connect to a node knowing it's multiaddress & peer id


If I am told about a new node with multiaddress: /ipv4/x.x.x.x/tcp/3333/p2p/Qxxxxxxx

How do I connect to that know.

When starting from scratch I know that this address is added to the bootstrap list.
But how to do it when the node is already up?


ipfs swarm connect /ipv4/x.x.x.x/tcp/3333/p2p/Qxxxxxxx


But I am not using ipfs. I am coding in nodejs.


Ah ok :smiley: I was about to send how to do it using libp2p in JS.

I’ll see

Hi again.

I think I found a solution. Please let me know if this is the way to achieve the same result as when initiating a node with bootstraping:

const { multiaddr } = require(‘multiaddr’)
const ma = multiaddr(ipv4/x.x.x.x/tcp/3333/p2p/Q.....)
await hwnode.dial(ma)