First draft

This commit is contained in:
Franck Royer 2021-05-21 16:13:28 +10:00
parent 2598119d2f
commit a8ef6c95d6
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
1 changed files with 109 additions and 0 deletions

View File

@ -0,0 +1,109 @@
2021-05-21-js-waku.md---
layout: post
name: ""
title: ""
date: 2021-05-21 12:00:00 +0800
author: franck
published: true
permalink: /2021-05-21-js-waku
categories: research
summary: This post is going to give you an overview of how spam protection can be achieved in Waku Relay through rate-limiting nullifiers. We will cover a summary of spam-protection methods in centralized and p2p systems, and the solution overview and details of the economic spam-protection method. The open issues and future steps are discussed in the end.
image: /assets/img/rain.png
discuss: https://forum.vac.dev/t/privacy-preserving-p2p-economic-spam-protection-in-waku-v2-with-rate-limiting-nullfiers/66
---
After almost three months working on js-waku,
we thought it would be a good time to give a proper update.
<!-- Waku v2 is built for Status and Ethereum ecosystem -->
Waku v2 comes from a need to have a more scalable, better optimised solution for the Status app to achieve decentralised
communications on resource restricted devices (ie, phones).
We see a need of such solution not only for ourselves but also for the broader Ethereum ecosystem.
If you want to read more about Waku v2 and what it aims to achieve,
go to [What's the Plan for Waku v2?](/waku-v2-plan).
<!-- present waku v2 ecosystem pre js-waku, ie, wakunode2 -->
Since last year, we have been busy defining and implementing Waku v2 protocols in [nim-waku](https://github.com/status-im/nim-waku),
from which you can build [wakunode2](https://github.com/status-im/nim-waku#wakunode).
Wakunode2 is an adaptive and modular Waku v2 node,
it allows users to run their own node and use the Waku v2 protocols they need.
The nim-waku project doubles as a library, that can be used to add Waku v2 support to native applications.
<!-- present the gap js-waku is trying to fill -->
We believe that dApps and wallets can benefit from the Waku network in several ways.
For some dApp, it may make sense to enable user to user communications.
For others, machine-to-machine communication could be a great asset.
For example, in the case of a DAO with a governance token,
Waku could be used for [gas-less polling](https://twitter.com/ethstatus/status/1293963402705018881?s=20).
Enabling the DAO to notify their users of a new poll, and users to vote without interacting with the blockchain.
<!-- explain how js-waku is filling the gap -->
For this to happen, we need to give developers a library which is easy integrate in their dApps:
[JS-Waku](https://github.com/status-im/js-waku).
<!-- explain what we have achieved so far: more on the journey? -->
JS-Waku is a JavaScript library that allows your dApp, wallet or other web app to interact with the Waku v2 network.
It is available right now on [npm](https://www.npmjs.com/package/js-waku), start using it by running `npm install js-waku`.
As it is written in TypeScript, types are included in the npm package to allow easy integration in TypeScript, ClojureScript and other typed languages that compile to JavaScript.
Key Waku v2 protocols are already available: [message](https://rfc.vac.dev/spec/14/), [store](https://rfc.vac.dev/spec/13/), [relay](https://rfc.vac.dev/spec/11/) and [light push](https://rfc.vac.dev/spec/19/).
Enabling your dApp to:
- Send and receive near-instant messages on the Waku network (relay),
- Query nodes for messages that may have been missed, e.g. due to poor cellular network (store),
- Send messages with confirmations (light push).
We focused the past month on developing a [ReactJS Chat App](https://status-im.github.io/js-waku/).
The aim was to create enough building blocks in JS-Waku to enable this showcase web app.
Most of the focus was on getting familiar with both the Waku v2 [RFCs](https://rfc.vac.dev/)
and the [js-libp2p](https://github.com/libp2p/js-libp2p) library that we heavily rely on.
Soon, we will [use it daily for dogfooding](https://github.com/status-im/nim-waku/issues/399) purposes.
JS-Waku is the second implementation of Waku v2 so a lot of effort on interoperability was needed.
For example, to ensure compatibility with the reference implementation (nim-waku),
we run our [tests against wakunode2](https://github.com/status-im/js-waku/blob/90c90dea11dfd1277f530cf5d683fb92992fe141/src/lib/waku_relay/index.spec.ts#L137) as part of the CI.
As we built the [web chat app](https://github.com/status-im/js-waku/tree/main/examples/web-chat),
we were able to fine tune the API to provide a simple and succinct interface.
You can start a node, connect to other nodes and send a message in less than ten lines of code:
```javascript
import { Waku } from 'js-waku';
const waku = await Waku.create();
const nodes = await getStatusFleetNodes();
await Promise.all(nodes.map((addr) => waku.dial(addr)));
const msg = WakuMessage.fromUtf8String("Here is a message!", "my-cool-app")
await waku.relay.send(msg);
```
As more developers use JS-Waku, we will evolve the API to allow for more custom and fine-tune usage of the network
while preserving this out of the box experience.
<!-- explain what is next for js-waku -->
Next, we are directing our attention towards [Developer Experience](https://github.com/status-im/js-waku/issues/68).
We already have [documentation ready](https://www.npmjs.com/package/js-waku) but we want to provide more:
[Tutorials](https://github.com/status-im/js-waku/issues/56), more examples and showing how [JS-Waku can be used with Web3](https://github.com/status-im/js-waku/issues/72).
<!-- explain where can people use js-waku -->
If you are as excited as us by JS-Waku, you can start building a dapp with it, you can find documentation on the [npmjs page](https://www.npmjs.com/package/js-waku).
Whether you are a developer you can still come chat with us on Discord [#waku (core development)](https://discord.gg/uWbdCmFU) or [#waku-support (dev support)](https://discord.gg/VChNsDdj) (soon to be migrated to Waku!).
If you have any ideas on how Waku could enable a specific dapp or use case, do share, we are always keen to hear it.
<!-- explain how people can help: use it or even propose ideas -->
<!-- mention JD -->