multiaddr
Python implementation of jbenet's multiaddr
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 multiaddruv
uv add multiaddrpoetry
poetry add multiaddrInstalling 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
Tags
More Internet packages
Botocore provides low-level, data-driven access…
permissive · top 100 on PyPI
aiobotocoreProvides an async client for AWS services using…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
filelockProvides a platform-independent file locking…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
googleapis-common-protosProvides common Protocol Buffer message…
permissive · top 100 on PyPI
ipaddrProvides utilities for parsing, validating, and…
permissive · top 15,000 on PyPI
netaddrRepresents and manipulates IPv4, IPv6, MAC…
permissive · top 5,000 on PyPI
py-multicodecWraps data with self-describing multicodec…
permissive · top 15,000 on PyPI
ipaddressProvides IPv4 and IPv6 address manipulation for…
permissive · top 5,000 on PyPI
pmd-net-protoParses, assembles, and validates network…
copyleft · top 15,000 on PyPI
IPyIPy provides Python classes for parsing,…
permissive · top 5,000 on PyPI
netifaces-plusRetrieves network interface information…
permissive · top 15,000 on PyPI
pproxypproxy is an asynchronous proxy server that…
permissive · top 15,000 on PyPI
zeroconfDiscovers and registers services on local…
copyleft · top 5,000 on PyPI
ngrokExposes ngrok's secure gateway service to…
permissive · top 15,000 on PyPI