go-waku/README.md

137 lines
5.3 KiB
Markdown
Raw Permalink Normal View History

# go-waku
A Go implementation of the [Waku v2 protocol](https://rfc.vac.dev/spec/10).
2021-10-09 18:18:53 +00:00
<p align="left">
<a href="https://goreportcard.com/report/github.com/waku-org/go-waku"><img src="https://goreportcard.com/badge/github.com/waku-org/go-waku" /></a>
<a href="https://godoc.org/github.com/waku-org/go-waku"><img src="http://img.shields.io/badge/godoc-reference-5272B4.svg?style=flat-square" /></a>
2023-10-16 16:28:54 +00:00
<a href=""><img src="https://img.shields.io/badge/golang-%3E%3D1.20.0-orange.svg?style=flat-square" /></a>
2022-12-10 16:26:59 +00:00
<a href="https://codeclimate.com/github/waku-org/go-waku/maintainability"><img src="https://api.codeclimate.com/v1/badges/426bdff6a339ff4d536b/maintainability" /></a>
2021-10-09 18:18:53 +00:00
<br>
</p>
## Install
2021-10-11 15:46:35 +00:00
#### Building from source
2021-10-09 18:18:53 +00:00
```
git clone https://github.com/waku-org/go-waku
2021-10-09 18:18:53 +00:00
cd go-waku
make
2021-10-11 15:46:35 +00:00
# See the available command line options with
./build/waku --help
2021-10-09 18:18:53 +00:00
```
#### Nix
You can build Waku v2 node using [Nix](https://nixos.org/) [Flakes](https://nixos.wiki/wiki/Flakes):
```sh
nix build github:waku-org/go-waku
```
Or build the library using:
```
nix build github:waku-org/go-waku#library
```
To start a shell with build dependencies use:
```
nix develop
```
2021-10-09 18:18:53 +00:00
2021-10-11 15:46:35 +00:00
#### Docker
2023-05-08 21:33:10 +00:00
```
docker run -i -t -p 60000:60000 -p 9000:9000/udp \
wakuorg/go-waku:latest \
--dns-discovery \
2024-03-11 13:22:48 +00:00
--dns-discovery-url enrtree://AIRVQ5DDA4FFWLRBCHJWUWOO6X6S4ZTZ5B667LQ6AJU6PEYDLRD5O@sandbox.waku.nodes.status.im \
2023-05-08 21:33:10 +00:00
--discv5-discovery
```
or use the [image:tag](https://hub.docker.com/r/wakuorg/go-waku/tags) of your choice.
2023-05-08 21:33:10 +00:00
or build and run the image with:
2021-10-09 18:18:53 +00:00
```
docker build -t wakuorg/go-waku:latest .
2021-10-11 15:46:35 +00:00
docker run wakuorg/go-waku:latest --help
2021-10-09 18:18:53 +00:00
```
2022-03-23 18:40:54 +00:00
#### Building on windows
Windows requires the following tools to be installed
- git bash (which is installed as part of [Git](https://git-scm.com/downloads))
- [chocolatey](https://chocolatey.org/install)
- [make](https://community.chocolatey.org/packages/make)
- [mingw](https://community.chocolatey.org/packages/mingw)
- [go](https://go.dev/doc/install)
2021-10-09 18:18:53 +00:00
## Library
```
go get github.com/waku-org/go-waku
2021-10-09 18:18:53 +00:00
```
2022-03-21 23:15:53 +00:00
## C Bindings
```
make static-library
make dynamic-library
```
## Mobile libraries
Requires [`gomobile`](https://pkg.go.dev/golang.org/x/mobile/cmd/gomobile)
```
make mobile-android
make mobile-ios
```
2022-05-04 21:08:24 +00:00
## Tutorials and documentation
2022-09-06 22:18:19 +00:00
- [Receive and send messages using Waku Relay](docs/api/relay.md)
- [Send messages using Waku Lightpush](docs/api/lightpush.md)
- [Encrypting and decrypting Waku Messages](docs/api/encoding.md)
- [Retrieve message history using Waku Store](docs/api/store.md)
2023-11-22 11:35:20 +00:00
- [C Bindings](library/c/README.md)
- [Waku Specs](https://rfc.vac.dev/spec), has information of [waku topics](https://rfc.vac.dev/spec/23/), wakuv1/[wakuv2](https://rfc.vac.dev/spec/14/) message, [rln relay](https://rfc.vac.dev/spec/58/) etc.
- [Enr](https://eips.ethereum.org/EIPS/eip-778), [Enrtree](https://eips.ethereum.org/EIPS/eip-1459)
- [devp2p](https://github.com/ethereum/go-ethereum/tree/master/cmd/devp2p) tool for playing with enr/entree sync tree. [Tutorial](https://geth.ethereum.org/docs/developers/geth-developer/dns-discovery-setup)
2022-05-04 21:08:24 +00:00
2021-10-09 18:18:53 +00:00
## Examples
2022-05-04 21:08:24 +00:00
Examples of usage of go-waku as a library can be found in the `examples/` folder:
- [**basic2**](examples/basic2) - demonstrates how to send and receive messages
- [**chat2**](examples/chat2) - simple chat client using waku relay / lightpush + filter / store protocol to send/receive messages and retrieve message history
- [**filter2**](examples/filter2) - demonstrates how to use filter protocol
- [**c-bindings**](examples/c-bindings) - simple program to demonstrate how to consume the go-waku library via C FFI
- [**waku-csharp**](examples/waku-csharp) - C# console application that uses the go-waku library via FFI
- [**android-kotlin**](examples/android-kotlin) - android app that uses a .jar generated by gomobile using kotlin
2021-08-25 20:16:14 +00:00
2021-04-13 18:52:02 +00:00
## Contribution
Thank you for considering to help out with the source code! We welcome contributions from anyone on the internet, and are grateful for even the smallest of fixes!
If you'd like to contribute to go-waku, please fork, fix, commit and send a pull request. If you wish to submit more complex changes though, please check up with the core devs first to ensure those changes are in line with the general philosophy of the project and/or get some early feedback which can make both your efforts much lighter as well as our review and merge procedures quick and simple.
To build and test this repository, you need:
2023-10-16 16:28:54 +00:00
- [Go](https://golang.org/) (version 1.20)
2021-04-13 18:52:02 +00:00
- [protoc](https://grpc.io/docs/protoc-installation/)
2023-03-09 15:48:25 +00:00
- [protoc-gen-go](https://protobuf.dev/getting-started/gotutorial/#compiling-protocol-buffers)
2021-04-13 18:52:02 +00:00
2021-10-18 10:13:39 +00:00
To enable the git hooks:
```bash
git config core.hooksPath hooks
```
2021-10-09 18:18:53 +00:00
2022-03-23 18:40:54 +00:00
## Bugs, Questions & Features
If you encounter any bug or would like to propose new features, feel free to [open an issue](https://github.com/waku-org/go-waku/issues/new/).
2022-03-23 18:40:54 +00:00
For more general discussion, help and latest news, join **#go-waku** on [Vac Discord](https://discord.com/channels/864066763682218004/865466710924460034) or [Telegram](https://t.me/vacp2p).
2021-04-13 18:52:02 +00:00
## License
Licensed and distributed under either of
* MIT license: [LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT
or
* Apache License, Version 2.0, ([LICENSE-APACHEv2](LICENSE-APACHEv2) or http://www.apache.org/licenses/LICENSE-2.0)
at your option. These files may not be copied, modified, or distributed except according to those terms.