The multiaddr /p2p/QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N uniquely identifies my local IPFS node, using libp2p’s registered protocol id /p2p/  and the multihash of my IPFS node’s public key.

https://github.com/libp2p/specs/blob/master/peer-ids/peer-ids.md

Let’s say that I have the Peer ID:

 QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N

And my public ip is 198.51.100.0. I start my libp2p application and listen for connections on TCP port 4242.

Now I can start handing out multiaddrs to all my friends, of the form:

 /ip4/198.51.100.0/tcp/4242/p2p/QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N

Combining my “location multiaddr” (my IP and port) with my “identity multiaddr” (my libp2p PeerId), produces a new multiaddr containing both key pieces of information.

Now not only do my friends know where to find me, anyone they give that address to can verify that the machine on the other side is really me, or at least, that they control the private key for my PeerId


🌱 Back to Garden