2021-03-15 14:35:10 +11:00
# js-waku
2021-03-05 09:34:01 +11:00
2021-03-15 14:35:10 +11:00
A JavaScript implementation of the [Waku v2 protocol ](https://specs.vac.dev/specs/waku/v2/waku-v2 ).
2021-04-09 11:55:41 +10:00
## Waku Protocol Support
2021-04-13 10:56:13 +10:00
You can track progress on the [project board ](https://github.com/status-im/js-waku/projects/1 ).
2021-04-09 11:55:41 +10:00
- ✔: Supported
- 🚧: Implementation in progress
- ⛔: Support is not planned
| Spec | Implementation Status |
| ---- | -------------- |
|[6/WAKU1 ](https://rfc.vac.dev/spec/6 )|⛔|
|[7/WAKU-DATA ](https://rfc.vac.dev/spec/7 )|⛔|
|[8/WAKU-MAIL ](https://rfc.vac.dev/spec/8 )|⛔|
|[9/WAKU-RPC ](https://rfc.vac.dev/spec/9 )|⛔|
|[10/WAKU2 ](https://rfc.vac.dev/spec/10 )|🚧|
|[11/WAKU2-RELAY ](https://rfc.vac.dev/spec/11 )|✔|
|[12/WAKU2-FILTER ](https://rfc.vac.dev/spec/12 )||
2021-04-20 10:24:03 +10:00
|[13/WAKU2-STORE ](https://rfc.vac.dev/spec/13 )|✔ (querying node only)|
2021-04-09 11:55:41 +10:00
|[14/WAKU2-MESSAGE ](https://rfc.vac.dev/spec/14 )|✔|
|[15/WAKU2-BRIDGE ](https://rfc.vac.dev/spec/15 )||
|[16/WAKU2-RPC ](https://rfc.vac.dev/spec/16 )|⛔|
|[17/WAKU2-RLNRELAY ](https://rfc.vac.dev/spec/17 )||
|[18/WAKU2-SWAP ](https://rfc.vac.dev/spec/18 )||
2021-04-13 10:56:13 +10:00
## Bugs, Questions & Features
2021-04-01 11:09:51 +11:00
2021-04-13 10:56:13 +10:00
If you encounter any bug or would like to propose new features, feel free to [open an issue ](https://github.com/status-im/js-waku/issues/new/ ).
For support, questions & more general topics, please join the discussion on the [Vac forum ](https://forum.vac.dev/tag/js-waku ) (use _\#js-waku_ tag).
2021-04-01 11:09:51 +11:00
## Examples
2021-04-28 09:53:33 +10:00
## Web Chat App (ReactJS)
A ReactJS web app is provided as an a show case of the library used in the browser.
A deployed version is available at https://status-im.github.io/js-waku/
Do note that due to some technical restrictions, it does not currently work out-of-the-box.
2021-04-28 20:26:35 +02:00
If you wish to try it out, follow the instructions on the [Vac forum ](https://forum.vac.dev/t/waku-web-app-using-js-waku/78 ).
2021-04-28 09:53:33 +10:00
It is currently unstable and likely to break.
To run a development version locally, do:
```shell
git clone https://github.com/status-im/js-waku/ ; cd js-waku
npm install
npm run build
cd web-chat
npm install
npm run start
```
Then, you can use `/help` to change your nick and connect to a server.
## CLI Chat App (NodeJS)
2021-04-01 11:09:51 +11:00
A node chat app is provided as a working example of the library.
It is interoperable with the [nim-waku chat app example ](https://github.com/status-im/nim-waku/blob/master/examples/v2/chat2.nim ).
2021-04-23 16:33:53 +10:00
To run the chat app, first ensure you have [Node.js ](https://nodejs.org/en/ ) v14 or above:
```shell
node --version
```
Then, install and run:
2021-04-01 11:09:51 +11:00
```shell
2021-04-13 10:56:13 +10:00
git clone https://github.com/status-im/js-waku/ ; cd js-waku
2021-04-01 11:09:51 +11:00
npm install
2021-04-13 10:56:13 +10:00
npm run chat -- --staticNode /ip4/134.209.139.210/tcp/30303/p2p/16Uiu2HAmPLe7Mzm8TsYUubgCAW1aJoeFScxrLj8ppHFivPo97bUZ
2021-04-01 11:09:51 +11:00
```
2021-04-23 16:33:53 +10:00
You can also specify an optional `listenAddr` parameter (.e.g `--listenAddr /ip4/0.0.0.0/tcp/7777/ws` ).
2021-04-01 15:46:14 +11:00
This is only useful if you want a remote node to dial to your chat app,
it is not necessary in normal usage when you just connect to the fleet.
2021-03-15 16:22:26 +11:00
## Contributing
2021-04-13 10:56:13 +10:00
### Build & Test
2021-03-15 16:22:26 +11:00
To build and test this repository, you need:
- [Node.js & npm ](https://nodejs.org/en/ )
2021-04-20 10:02:47 +10:00
- [bufbuild ](https://github.com/bufbuild/buf ) (only if changing protobuf files)
- [protoc ](https://grpc.io/docs/protoc-installation/ ) (only if changing protobuf files)
2021-03-15 16:22:26 +11:00
To ensure interoperability with [nim-waku ](https://github.com/status-im/nim-waku/ ), some tests are run against a nim-waku node.
This is why `nim-waku` is present as a [git submodule ](https://git-scm.com/book/en/v2/Git-Tools-Submodules ), which itself contain several submodules.
At this stage, it is not possible to exclude nim-waku tests, hence `git submodule update --init --recursive` is run before testing (see [`pretest` script ](https://github.com/status-im/js-waku/blob/main/package.json )).
To build nim-waku, you also need [Rust ](https://www.rust-lang.org/tools/install ).
2021-04-13 10:56:13 +10:00
### Guidelines
- Please follow [Chris Beam's commit message guide ](https://chris.beams.io/posts/git-commit/ ),
- Usually best to test new code,
- [CI ](https://github.com/status-im/js-waku/blob/main/.github/workflows/ci.yml ) must pass.
2021-04-28 16:29:43 +10: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-APACHE-v2 ](LICENSE-APACHE-v2 ) 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.