This is a Python wrapper around Waku
Go to file
Václav Pavlín 09aee72d41
feat: update readme, do not rely on msg being plaintext
2024-02-09 12:34:21 +01:00
lib Very initial and generic commits to conform the py-waku repo 2024-02-07 12:56:06 +01:00
tests feat: update readme, do not rely on msg being plaintext 2024-02-09 12:34:21 +01:00
vendor Add nwaku submodule 2024-02-06 12:27:18 +01:00
waku feat: update readme, do not rely on msg being plaintext 2024-02-09 12:34:21 +01:00
.gitignore Very initial and generic commits to conform the py-waku repo 2024-02-07 12:56:06 +01:00
.gitmodules Add nwaku submodule 2024-02-06 12:27:18 +01:00
LICENSE-APACHEv2 Very initial and generic commits to conform the py-waku repo 2024-02-07 12:56:06 +01:00
LICENSE-MIT Very initial and generic commits to conform the py-waku repo 2024-02-07 12:56:06 +01:00
README.md feat: update readme, do not rely on msg being plaintext 2024-02-09 12:34:21 +01:00
pyproject.toml Very initial and generic commits to conform the py-waku repo 2024-02-07 12:56:06 +01:00
requiremets.txt Very initial and generic commits to conform the py-waku repo 2024-02-07 12:56:06 +01:00
run_py.sh Very initial and generic commits to conform the py-waku repo 2024-02-07 12:56:06 +01:00
setup.py Very initial and generic commits to conform the py-waku repo 2024-02-07 12:56:06 +01:00

README.md

Py-Waku

Introduction

Py-Waku exposes a Waku module that can be used within Python projects. It is fundamentally a wrapper around nwaku

This repo has been tested with Python3 in Ubuntu.

If need a different setup, don't hesitate con contact us on Discord. The Discord server can be found at https://docs.waku.org/.

Prepare the development environment

Run the following commands from the root folder:

mkdir venv
python3 -m venv venv/
source venv/bin/activate
./venv/bin/python -m pip install -r requiremets.txt

Create a Py-Waku package

Run the following commands from the root folder:

source venv/bin/activate
./venv/bin/python3 -m build

Test the package

For that, we have a very simple example in tests/waku_example.py.

In order to use the waku module, please install it from the local dist/ folder, that can be created by following the instructions from the previous section.

The following command is an example on how to install the local package to your local virtual env.

./venv/bin/python3 -m pip install dist/waku-0.0.1-cp310-cp310-linux_x86_64.whl

Current limitations of nwaku cbindings do not allow you to use DNS name in the multiaddress of a peer you want to connect to. Due to that, we recommend to run another local node to connect to other peers and then connect to this local node from the py-waku.

docker run -i -t -p 60000:60000 -p 9000:9000/udp harbor.status.im/wakuorg/nwaku:v0.24.0 --dns-discovery:true --dns-discovery-url:enrtree://ANEDLO25QVUGJOUTQFRYKWX6P4Z4GKVESBMHML7DZ6YK4LGS5FC5O@prod.wakuv2.nodes.status.im --discv5-discovery --rest --rest-address=0.0.0.0

Once this node is up, get the multiaddress

LOCAL_PEER_MA=$(curl http://127.0.0.1:8646/debug/v1/info | jq -r ".listenAddresses[0]")
NODEKEY=$(openssl rand -hex 32)

You car run the tests/waku_example.py now as

./venv/bin/python3 tests/waku_example.py --peer ${LOCAL_PEER_MA} --key ${NODEKEY} -p 70000

Update the libwaku.so library

Given that Py-Waku conforms a wrapper around libwaku.so, it is likely that you would need to upgrade it. For that, you will need to update the submodule pointer to a more recent nwaku version:

  1. cd vendor/nwaku
  2. Check out to the commit/tag as you wish

Then, follow the following steps from the root folder to rebuild the libwaku.so library:

cd vendor/nwaku
make libwaku -j8
cd ../../
cp vendor/nwaku/build/libwaku.so lib/

Notice that the libwaku.so library is also distributed within the Py-Waku package.