nim-libp2p/docs/GO_DAEMON.md

1.4 KiB

Table of Contents

Introduction

This is a libp2p-backed daemon wrapping the functionalities of go-libp2p for use in Nim.
For more information about the go daemon, check out this repository.

Installation

# clone and install dependencies
git clone https://github.com/status-im/nim-libp2p
cd nim-libp2p
nimble install

# perform unit tests
nimble test

# update the git submodule to install the go daemon 
git submodule update --init --recursive
go version
git clone https://github.com/libp2p/go-libp2p-daemon
cd go-libp2p-daemon
git checkout v0.0.1
go install ./...
cd ..

Usage

Example

Examples can be found in the examples folder

Getting Started

Try out the chat example. Full code can be found here:

nim c -r --threads:on examples\chat.nim

This will output a peer ID such as QmbmHfVvouKammmQDJck4hz33WvVktNEe7pasxz2HgseRu which you can use in another instance to connect to it.

./example/chat
/connect QmbmHfVvouKammmQDJck4hz33WvVktNEe7pasxz2HgseRu

You can now chat between the instances!

Chat example