Library / SDK
libp2p/go-libp2p avatar
libp2p/go-libp2p

go-libp2p: the Go networking stack behind IPFS and Filecoin

libp2p implementation in Go

6,883 stars1,288 forksGoMIT

At a glance

What is it?
go-libp2p is the Go implementation of the libp2p networking stack, a modular set of packages for building peer-to-peer applications. Its value is real, but the README is thinner than the specification it implements.
Who is it for?
Adopt go-libp2p if you are writing a Go service that needs peer identity, transport negotiation, stream multiplexing and pubsub without designing those yourself, and if you are prepared to read the specification alongside the code. Do not adopt it if you want a documented, batteries-included API: the README points to docs.libp2p.io and the examples folder, and the repository itself documents very little beyond that.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 10 days ago.
What is it written in?
Mainly Go, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 30, 2026, and from our analysis. They are not legal advice.

Editorial analysis

What go-libp2p actually solves, and who ends up using it

Building a peer-to-peer system means solving the same problems every time: how two machines find each other, how they agree on a transport, how they authenticate each other's identity, how they multiplex several logical conversations over one connection, and how they keep talking when one side sits behind a NAT. go-libp2p packages those concerns as separate modules so an application can take the ones it needs. The README frames this as a network stack that "cleanly separates concerns" and lets applications "only use the protocols they absolutely need, without giving up interoperability and upgradeability." That sentence is the whole design argument, and it is a fair one.

The project grew out of IPFS and was bundled separately so other tools could use it. The README lists Kubo (the original Go IPFS implementation), Lotus (a Filecoin protocol implementation) and Prysm (an Ethereum Beacon Chain consensus client) as notable users. That is the realistic audience: teams building a network where peers are first-class, not teams adding a socket to a web service. If your application is a client talking to your own server, go-libp2p is more machinery than the problem requires.

The module layout: host, transports, muxers and the fx wiring

The repository is an entrypoint rather than a single package. The top level holds libp2p.go, options.go, config/, core/, p2p/, defaults.go and limits.go, and the go.mod require block shows what those pull in: go-multiaddr for addresses, go-multistream for protocol negotiation, go-yamux/v5 as a stream multiplexer, go-reuseport, go-netroute, zeroconf for mDNS discovery, and go-libp2p-asn-util. A libp2p host is assembled from these parts, and options.go is where the construction options live.

The dependency list also reveals the internal architecture. The presence of fx_options_test.go and a gologshim/ directory indicates the host is wired with Uber's fx dependency injection and that logging is adapted through a shim layer, which is a design choice worth knowing before you go looking for a plain constructor. Transports are not hardcoded: the go.mod requires gorilla/websocket and marten-seemann/tcp, and the README's example imports only the top-level package, so transport selection is a configuration concern rather than a compile-time one. The limits.go file and the config/ directory are where resource limits and defaults are expressed. None of this is explained in the README; it is visible only from the file tree and go.mod.

Installing go-libp2p and running a first example

There is no binary to install. go-libp2p is a Go module, and the README says you start by adding imports from the repositories, giving this line as the example.

go
import "github.com/libp2p/go-libp2p"

Because the repository is a Go module named github.com/libp2p/go-libp2p, a normal `go get` pulls it into your module graph. The go.mod declares `go 1.26.0`, and the README states the project tests against and supports the two most recent major releases of Go, so check your toolchain before starting.

The examples live in the examples/ directory, which is its own Go module with its own go.mod and go.sum. That matters: the examples pin the library separately from the main repository, so the version you see there is not necessarily the version you just fetched. The available examples, per the directory listing, include chat, chat-with-mdns, chat-with-rendezvous, echo, pubsub, relay, routed-echo, http-proxy, metrics-and-dashboards, libp2p-host and multipro. A reasonable first run is the echo example, which exercises the host and stream path without requiring a discovery service.

bash
cd examples/echo
go run .

The README does not document the output of any example, so treat the console text as something to read rather than something to expect. For a host-only starting point, examples/libp2p-host is the smallest surface. For discovery without infrastructure, chat-with-mdns uses zeroconf, which the go.mod confirms as a direct dependency.

Resource limits and NAT traversal are where the sharp edges are

A peer-to-peer host accepts connections from strangers, which makes resource exhaustion the default failure mode rather than an edge case. The repository carries limits.go and a config/ directory for exactly this, but the README does not explain how to set them, and it does not document what the defaults are. Anyone running a public-facing host should read those files directly before deploying.

NAT traversal is the second sharp edge. The go.mod requires huin/goupnp, jackpal/go-nat-pmp and koron/go-ssdp, which points to UPnP, NAT-PMP and SSDP based port mapping, plus go-reuseport for socket reuse. Those mechanisms work on some home routers and not on others, and they do nothing on a carrier-grade NAT or a locked-down cloud network. The repository also carries examples/relay, and the related search terms include relay, which suggests circuit relay is the intended fallback when direct dialing fails. The README does not describe when to reach for it. If your peers cannot accept inbound connections, plan for a relay or a rendezvous service from the start rather than after the first deployment.

The third constraint is version churn. The release history shows v0.48.0 in March 2026, v0.49.0 in July 2026 and v0.50.0 on 2026-09-21, with the last push to master on the same day. Minor versions arrive every few months, and go.mod itself carries two `retract` directives for v0.26.1 and v0.36.0 because of release tooling mistakes. Treat upgrades as scheduled work.

go-libp2p compared with rust-libp2p and js-libp2p

The README points to rust-libp2p and js-libp2p as sibling implementations of the same specification. The difference is not features but runtime and audience. rust-libp2p gives you a compiled binary with no garbage collector, which suits long-running network daemons where tail latency matters. js-libp2p runs in Node.js and in browsers, which is the only one of the three that can put a peer inside a web page. go-libp2p sits between them: garbage-collected, fast to compile, and easy to embed in the kind of backend service that already exists in Go.

The practical consequence is that protocol compatibility is a specification question, not an implementation question. A Go peer can talk to a Rust peer because both implement the libp2p specs, and the README links to that specification repository. If your team is split across languages, that interoperability is the reason to choose any of them. If your team is entirely in Go and your peers are servers you control, a plain TCP or HTTP service with your own authentication will be less work than adopting a stack whose defaults you have to read out of source files.

Maintenance, licensing and the cost of staying current

The repository is not archived, and the last push to master was on 2026-09-21, the same day as the v0.50.0 release. That is a recent push, and the release cadence of roughly every two to five months over the past year is consistent with it. Maintenance is real and visible. What is less visible is what an upgrade costs you: the go.mod pins specific major versions of go-yamux, go-multiaddr, go-multistream and the multiformats family, so a bump to go-libp2p can move several of those at once. The two retract directives in go.mod are a reminder that tags occasionally go wrong.

Licensing is MIT, stated in the README and present as a LICENSE file at the repository root. MIT is permissive: it allows commercial and closed-source use with attribution and without a copyleft obligation on your own code. The README does not discuss what the MIT grant means for the protocols you implement on top of the library, and nothing here should be read as legal advice. One contribution rule is worth flagging because it affects how you interact with the project: the README requires that any use of AI assistance in a pull request be disclosed, with an example disclosure given, and it warns that undisclosed assistance makes triage harder. The README also states that pull requests suspected of being low-effort attempts to collect airdrops may be closed without comment.

Editorial conclusion

Adopt go-libp2p if you are writing a Go service that needs peer identity, transport negotiation, stream multiplexing and pubsub without designing those yourself, and if you are prepared to read the specification alongside the code. Do not adopt it if you want a documented, batteries-included API: the README points to docs.libp2p.io and the examples folder, and the repository itself documents very little beyond that. Before you commit, read examples/go.mod to see how the examples pin the library, check the go.mod require block for the transport and muxer versions you will inherit, and confirm that your Go toolchain matches the two most recent major releases the project supports. The v0.50.0 release on 2026-09-21 is the version to start from.

Frequently asked questions

What is go-libp2p used for?

It is the Go implementation of the libp2p networking stack, used to build peer-to-peer applications that need transports, peer identity, stream multiplexing and protocol negotiation. The README names Kubo, Lotus and Prysm as notable users.

How do I install go-libp2p in a Go project?

It is a Go module rather than a binary. The README shows adding an import from github.com/libp2p/go-libp2p, and the go.mod declares go 1.26.0 with support for the two most recent major Go releases.

Where are the go-libp2p examples?

They are in the examples/ directory, which is its own Go module with separate go.mod and go.sum files. The directory listing includes chat, chat-with-mdns, echo, pubsub, relay, routed-echo and libp2p-host.

Does go-libp2p provide monitoring dashboards?

Yes. The README states that prebuilt Grafana dashboards are provided for monitoring libp2p in production, with the JSON files in the dashboards/ directory, and it also links to live public dashboards.

What licence does go-libp2p use?

The README states that go-libp2p is MIT-licensed open source software, and a LICENSE file sits at the repository root. Contributions follow a DCO process according to the README.

Official sources

  1. Issues
  2. libp2p/go-libp2p on GitHub
  3. License: MIT
  4. README
  5. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/libp2p-go-libp2p.svg)](https://hysenlabs.com/projects/libp2p-go-libp2p)