skillfed

multiaddr

Python implementation of jbenet's multiaddr

multiaddr v0.2.0 316.5K downloads/30d#7,675 on PyPI36
Permissive license MIT License Active released

What it is and what it does

py-multiaddr is a Python implementation of the multiaddr specification—a way to express network addresses as composable protocol stacks. Instead of separate IP, port, and protocol fields, multiaddr encodes them as a single string like `/ip4/127.0.0.1/tcp/8080/p2p/QmPeer`, making it easy to parse, validate, and manipulate complex network paths. It handles encapsulation and decapsulation (nesting protocols), DNS resolution with peer ID preservation, and wildcard expansion for server binding across network interfaces.

The package targets libp2p and IPFS ecosystems but is generally useful for any application needing a unified, protocol-agnostic address representation. It depends on trio for async DNS, base58 and multihash variants for encoding, and netaddr for IP manipulation. The API is straightforward: construct a Multiaddr from a string or bytes, call methods like `protocols()`, `encapsulate()`, `decapsulate()`, or `resolve()` to work with it.

Use it for:

  • Parsing and validating bootstrap node addresses in p2p networks with embedded peer IDs.
  • Expanding wildcard addresses (0.0.0.0, ::) to concrete interfaces for server binding.
  • Composing protocol stacks for tunneling scenarios (proxy → destination chains).
  • Resolving DNS and DNSADDR records while preserving peer identity across resolution.
  • Extracting and comparing protocol layers from complex network addresses.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Parses, constructs, and manipulates multiaddrs—protocol-agnostic network addresses that combine IP, DNS, transport, and peer identity into a single composable format.

Yes, if you are building or integrating with libp2p, IPFS, or other multiformats-based systems. The package is actively maintained, has no known vulnerabilities, and low install friction. The pre-alpha status and small maintainer team are worth noting for production use, but the core functionality is stable and widely used in the ecosystem.

Install

multiaddr on PyPI

pip

pip install multiaddr

uv

uv add multiaddr

poetry

poetry add multiaddr

Installing multiaddr

Before you install

Low friction: pure Python wheel with 12 runtime dependencies including trio for async DNS. Actively maintained with recent commits; marked pre-alpha but in use across the multiformats ecosystem.

License in practice

Dual-licensed MIT or Apache 2.0—permissive either way, suitable for commercial and open-source projects without copyleft obligations.

Quickstart

pip install multiaddr

from multiaddr import Multiaddr

m = Multiaddr("/ip4/127.0.0.1/tcp/8080")
print(m.protocols())
print(m.to_bytes())

Requires Python 3.10+; async DNS resolution requires trio and an event loop.

Verify before relying

  • Whether DNS resolution performance scales to high-volume bootstrap node lookups in production p2p networks.
  • Stability guarantees or breaking-change policy given pre-alpha status (Development Status :: 2).

Package facts

License MIT License (permissive)
Python support supports the current Python release (<4.0,>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 12 — base58, dnspython, idna, netaddr, psutil, py-cid, py-multicodec, py-multibase, py-multihash, trio-typing, trio, varint
Maintenance actively maintained — 150 days since the last release
Last repo commit
First released
Downloads 316,501/month — #7,675 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: multiaddr-0.2.0-py3-none-any.whl

Keywords: multiaddr

Development Status :: 2 - Pre-AlphaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseNatural Language :: EnglishProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13

Tags

multiaddr parsing and constructionnetwork address compositionDNS resolution with peer IDprotocol encapsulation decapsulationlibp2p multiaddr implementationwildcard address expansionthin waist address validation
p2p-networkinglibp2paddress-parsing

More Internet packages