This chapter covers
- Introduction to the Libp2p Javascript library
- Using the Libp2p Javascript library to connect Web3 applications peer-to-peer
- Replacing application DNS with peer IDs provided by Libp2p
In this chapter you will learn about the Libp2p Javascript library, and how to use it to allow your Web3 applications to communicate peer-to-peer. After replacing centralized storage and compute with client-side Javascript programming in previous chapters, allowing instances of the Code Radio demo application to communicate peer-to-peer is the final step in removing all centralized resources and delivering a product that can be certified as Web3.
Libp2p is an open-source project initially developed by Protocol Labs, which refers to itself as a "modular network stack". As a network stack, Libp2p is designed to abstract away much of the complexities which come with programming network services, but a basic level of data networking is still required to make use of Libp2p in most application designs. At the time of writing, Libp2p is offered in several programming language implementations, including Go, Rust, Python, C++, and more. This chapter focuses on the Libp2p Javascript implementation which allows it to be seamlessly integrated with application running in a browser, such as Code Radio.