From b6f727d0d2d2eb9f867b9c7c64384be39ef65b59 Mon Sep 17 00:00:00 2001 From: LordGhostX <47832826+LordGhostX@users.noreply.github.com> Date: Mon, 22 Jan 2024 00:23:30 +0100 Subject: [PATCH] add content topic buckets consideration (#153) --- docs/guides/getting-started.md | 6 +++--- docs/learn/concepts/content-topics.md | 28 ++++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/docs/guides/getting-started.md b/docs/guides/getting-started.md index b7c1677..e58fe86 100644 --- a/docs/guides/getting-started.md +++ b/docs/guides/getting-started.md @@ -17,6 +17,7 @@ The Waku Network is a decentralised, permissionless system where anyone can run | | Description | Documentation | | - | - | - | | [nwaku](https://github.com/waku-org/nwaku) | Nim-based Waku implementation to run a standalone node and access the network (recommended) | [Run a Nwaku Node](/guides/nwaku/run-node) | +| [nwaku-compose](https://github.com/waku-org/nwaku-compose) | Pre-configured Docker Compose setup for running a RLN-enabled `nwaku` node with Grafana metrics dashboard | [Run Nwaku with Docker Compose](/guides/nwaku/run-docker-compose) | | [go-waku](https://github.com/waku-org/go-waku) | Golang-based Waku implementation to run a standalone node and access the network | COMING SOON | ## Integrate using SDKs @@ -26,6 +27,7 @@ Waku is implemented in multiple SDKs, allowing it to integrate with different la | | Description | Documentation | | - | - | - | | [@waku/sdk](https://github.com/waku-org/js-waku) | JavaScript/TypeScript SDK designed for browser environments | [JavaScript Waku SDK](/guides/js-waku/) | +| [@waku/react](https://www.npmjs.com/package/@waku/react) | React components and UI adapters designed for seamless integration with `@waku/sdk` | [Build React DApps Using @waku/react](/guides/js-waku/use-waku-react) | | [nwaku](https://github.com/waku-org/nwaku) | Nim SDK designed for integration with native Nim applications | COMING SOON | | [go-waku](https://github.com/waku-org/go-waku) | Golang SDK designed for integration with Golang applications, includes C bindings for usage in C/C++, C#/Unity, Swift, and Kotlin | COMING SOON | | [waku-rust-bindings](https://github.com/waku-org/waku-rust-bindings) | Rust wrapper using `go-waku` bindings designed for integration in Rust applications | COMING SOON | @@ -44,6 +46,4 @@ Waku provides integrations tailored for mobile applications, enabling Waku to ru | | Description | Documentation | | - | - | - | | [REST API](https://waku-org.github.io/waku-rest-api/) | REST API interface provided by `nwaku` and `go-waku` to interact with the Waku Network | [Waku Node REST API Reference](https://waku-org.github.io/waku-rest-api/) | -| [@waku/react](https://www.npmjs.com/package/@waku/react) | React components and UI adapters designed for seamless integration with `@waku/sdk` | [Build React DApps Using @waku/react](/guides/js-waku/use-waku-react) | -| [@waku/create-app](https://www.npmjs.com/package/@waku/create-app) | Starter kit to bootstrap your next `@waku/sdk` project from various example templates | [Scaffold DApps Using @waku/create-app](/guides/js-waku/use-waku-create-app) | -| [nwaku-compose](https://github.com/waku-org/nwaku-compose) | Pre-configured Docker Compose setup for running and monitoring a `nwaku` node using Prometheus and Grafana | [Run Nwaku with Docker Compose](/guides/nwaku/run-docker-compose) | \ No newline at end of file +| [@waku/create-app](https://www.npmjs.com/package/@waku/create-app) | Starter kit to bootstrap your next `@waku/sdk` project from various example templates | [Scaffold DApps Using @waku/create-app](/guides/js-waku/use-waku-create-app) | \ No newline at end of file diff --git a/docs/learn/concepts/content-topics.md b/docs/learn/concepts/content-topics.md index 69fd380..3392a73 100644 --- a/docs/learn/concepts/content-topics.md +++ b/docs/learn/concepts/content-topics.md @@ -43,4 +43,30 @@ Waku is developing privacy-preserving features like [Anonymous Filter Subscripti You can increase [k-anonymity](https://www.privitar.com/blog/k-anonymity-an-introduction/) within the network by using a unified content topic across the entire application or targeting specific features like notifications or private messages, allowing multiple users to share it. -However, maintaining functionality with a single content topic can introduce complexity. We recommend switching functionality using the Protocol Buffer (`proto`) message format. By doing so, applications can retain a high granularity and functionality while using a single content topic, preserving user privacy. \ No newline at end of file +We recommend switching functionality using the Protocol Buffer (`proto`) message format. By doing so, applications can retain a high granularity and functionality while using a single content topic, preserving user privacy. For example: + +```js +message NotificationPayload { +... +} + +message FeatureAbcPayload { +... +} + +// By default, all fields in protobuf are optional so only field may be encoded at a time +message Payload { + NotificationPayload notification = 1; + FeatureAbcPayload feature_abc = 2; +} +``` + +### Creating buckets help in distributing traffic + +When an application uses a single content topic, all users using [request/response protocols](/learn/concepts/network-domains#requestresponse-domain) (`Filter`, `Store`) receive all its messages. For heavy traffic, developers can create buckets by hashing a unique identifier (e.g., recipient's ID, public key, or app domain topic) and adding its first byte to the content topic, like `/my-app/0/a/proto`. + +This approach divides traffic into multiple topics, reducing the messages users have to download. Developers can add more first bytes to the content topic over time to improve efficiency and privacy based on messages and user needs. + +:::info +The **k** value of **k-anonymity** equals the number of IDs for which the first character of the hash is `"a"`. For example, using a single content topic in an application with 10,000 users results in **k = 10,000**. However, using the hash ID's first character, **k** reduces to **10,000 / 16 = 625**. +::: \ No newline at end of file