Skip to content
This repository has been archived by the owner on Sep 24, 2020. It is now read-only.

The following repository contains some examples on LibP2P and can be useful for people that are learning how to build P2P networks using LibP2P components.

da-moon/libp2p-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Libp2p-Examples

This repo uses LibP2P library to showcase some use case examples of LibP2P. LibP2P has many functions and it can be quite challenging to simply know when to use what functions. In the code, I have commented every function extensively so that it can help people with their learning process so that they can use LibP2P in their own programs.
Basic node functionalitis are in basicNode.go and all the others have corresponding names.

Running

To run this, after compilation and running the compiled binary, type 'Help' to see the list of available options.

Heartbeat

In heartbeat protocol , I showcase the simplest use case of libp2p which is to have one node send one message to another node and the other node replies back with some message.

Payment

in payment protocol, I showcase how two separate protocols can get multiplexed to a single node. I also show how JSON-like messages can get transfered between nodes. Here , I show the best practice on how to deal with data encoding, decoding and reading and writing to strings.

Sync

in sync protocol, I show how one can use a coded such as cbor to request for file transfer from another node.

About

The following repository contains some examples on LibP2P and can be useful for people that are learning how to build P2P networks using LibP2P components.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages