You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
libp2p is a networking stack and library modularized out of The IPFS Project, and bundled separately for other tools to use.
9
16
10
-
#Description
17
+
## Table of Contents
11
18
12
-
libp2p is a networking stack and library modularized out of The IPFS Project, and bundled separately for other tools to use.
19
+
-[Background](#background)
20
+
-[Packages](#packages)
21
+
-[Notes](#notes)
22
+
-[Install](#install)
23
+
-[Usage](#usage)
24
+
-[Setting everything up](#setting-everything-up)
25
+
-[Dialing and listening](#dialing-and-listening)
26
+
-[Using Peer Routing](#using-peer-routing)
27
+
-[Using Records](#using-records)
28
+
-[Stats](#stats)
29
+
-[Contribute](#contribute)
30
+
-[License](#license)
31
+
32
+
## Background
13
33
14
34
libp2p is the product of a long, and arduous quest of understanding -- a deep dive into the internet's network stack, and plentiful peer-to-peer protocols from the past. Building large scale peer-to-peer systems has been complex and difficult in the last 15 years, and libp2p is a way to fix that. It is a "network stack" -- a protocol suite -- that cleanly separates concerns, and enables sophisticated applications to only use the protocols they absolutely need, without giving up interoperability and upgradeability. libp2p grew out of IPFS, but it is built so that lots of people can use it, for lots of different projects.
15
35
16
36
We will be writing a set of docs, posts, tutorials, and talks to explain what p2p is, why it is tremendously useful, and how it can help your existing and new projects.
17
37
38
+
### Packages
18
39
19
-
# Packages
20
40
| Package | Version | Dependencies | DevDependencies |
> **This is a work in progress, interface might change at anytime**
77
+
> **This is a work in progress. The interface might change at anytime.**
48
78
49
79
libp2p expects a [Record Store interface](https://github.com/diasdavid/abstract-record-store), a swarm and one or more Peer Routers that implement the [Peer Routing](https://github.com/diasdavid/abstract-peer-routing), the goal is to keep simplicity and plugability while the remaining modules execute the heavy lifting.
50
80
51
81
libp2p becomes very simple and basically acts as a glue for every module that compose this library. Since it can be highly customized, it requires some setup. What we recommend is to have a libp2p build for the system you are developing taking into account in your needs (e.g. for a browser working version of libp2p that acts as the network layer of IPFS, we have a built and minified version that browsers can require)
52
82
53
83
### Setting everything up
54
84
55
-
```
85
+
```js
56
86
var Libp2p =require('libp2p')
57
87
58
88
// set up a Swarm, Peer Routing and Record Store instances, the last two are optional
@@ -62,31 +92,36 @@ var p2p = new Libp2p(swarm, [peerRouting, recordStore])
62
92
63
93
### Dialing and listening
64
94
95
+
```js
65
96
p2p.swarm.dial(peerInfo, options, protocol, function (err, stream) {})
p2p.routing.findPeers(key, function (err, peerInfos) {})
104
+
```
71
105
72
106
### Using Records
73
107
108
+
```js
74
109
p2p.record.get(key, function (err, records) {})
75
110
p2p.record.store(key, record)
111
+
```
76
112
77
113
### Stats
78
114
79
-
# Contribute
115
+
TODO
80
116
81
-
libp2p implementation in JavaScript is a work in progress. As such, there's a few things you can do right now to help out:
117
+
## Contribute
118
+
119
+
THe libp2p implementation in JavaScript is a work in progress. As such, there's a few things you can do right now to help out:
82
120
83
121
- Go through the modules below and **check out existing issues**. This would be especially useful for modules in active development. Some knowledge of IPFS/libp2p may be required, as well as the infrasture behind it - for instance, you may need to read up on p2p and more complex operations like muxing to be able to help technically.
84
122
-**Perform code reviews**. Most of this has been developed by @diasdavid, which means that more eyes will help a) speed the project along b) ensure quality and c) reduce possible future bugs.
0 commit comments