mirror of
https://github.com/waku-org/nwaku-compose.git
synced 2025-02-16 17:26:37 +00:00
67 lines
2.4 KiB
Markdown
67 lines
2.4 KiB
Markdown
# nwaku-compose
|
||
|
||
Ready to use docker-compose to run your own [nwaku](https://github.com/waku-org/nwaku) full node:
|
||
* nwaku node running relay and store protocols with RLN enabled.
|
||
* Simple frontend to interact with your node and the network, to publish and receive messages.
|
||
* Grafana dashboard for advanced users or node operators.
|
||
* Requires `docker-compose` and `git`.
|
||
|
||
|
||
**📝 0. Prerequisites**
|
||
|
||
You need:
|
||
* Ethereum Sepolia ws endpoint. Get one free from [Infura](https://www.infura.io/).
|
||
* Ethereum Sepolia account with some balance <0.01 Eth. Get some [here](https://www.infura.io/faucet/sepolia).
|
||
* A password to protect your rln membership.
|
||
|
||
```
|
||
export ETH_CLIENT_ADDRESS=wss://sepolia.infura.io/ws/v3/YOUR_INFURA_KEY
|
||
export ETH_TESTNET_KEY=REPLACE_BY_YOUR_KEY
|
||
export KEYSTORE_PASSWORD=PICK_A_PASSWORD
|
||
```
|
||
|
||
**🔑 1. Register RLN membership**
|
||
|
||
The RLN membership is your access key to The Waku Network. Its registration is done onchain, and allows your nwaku node to publish messages in a decentralized and private way, respecting some rate limits. This command will register it and store in `keystore/keystore.json`. Note that if you just want to relay traffic (not publish), you don't need one.
|
||
|
||
```
|
||
./register_rln.sh
|
||
```
|
||
|
||
**🖥️ 2. Start everything**
|
||
|
||
Start all processes. Your RLN membership is loaded into nwaku under the hood.
|
||
```console
|
||
docker-compose up -d
|
||
```
|
||
|
||
**🏄🏼♂️ 3. Interact with your nwaku node**
|
||
* See [localhost:3000](http://localhost:3000) for node metrics.
|
||
* See [localhost:4000](http://localhost:4000). Under development 🚧
|
||
|
||
**📬 4. Use the REST API**
|
||
|
||
Your nwaku node exposes a [REST API](https://waku-org.github.io/waku-rest-api/) to interact with it.
|
||
|
||
```
|
||
# get nwaku version
|
||
curl http://127.0.0.1:8645/debug/v1/version
|
||
# get nwaku info
|
||
curl http://127.0.0.1:8645/debug/v1/info
|
||
```
|
||
|
||
You can publish a message to a `contentTopic` that everyone subscribed to it will receive. Note that `payload` is base64 encoded.
|
||
|
||
```
|
||
curl -X POST "http://127.0.0.1:8645/relay/v1/auto/messages" \
|
||
-H "content-type: application/json" \
|
||
-d '{"payload":"XaaabsQ==","contentTopic":"/my-app/2/chatroom-1/proto"}'
|
||
```
|
||
|
||
You can fetch all messages sent in that topic.
|
||
```
|
||
curl -X GET "http://127.0.0.1:8645/store/v1/messages?contentTopics=%2Fmy-app%2F2%2Fchatroom-1%2Fproto&pageSize=50&ascending=true" \
|
||
-H "accept: application/json"
|
||
```
|
||
|
||
For advanced documentation, refer to [ADVANCED.md](https://github.com/waku-org/nwaku-compose/blob/master/ADVANCED.md). |