Skip to content

A nostr-tools inspired library for Arduino (and other) microcontrollers. With NWC support

License

Notifications You must be signed in to change notification settings

riccardobl/nostrduino

Repository files navigation

Nostrduino

A nostr-tools inspired library for Arduino (and others).

This was created using arduino-nostr as starting point, most of the code was rewritten and the library was expanded to include more features.

Compatibility

This library is compatible with esp32 based boards out of the box. But it can be ported to other boards by reimplementing the platform specific code in the src/esp32.

Features

Philosophy

This library is built with a DIY philosophy in mind, similar to nostr-tools, this library provides helpers to create, sign and verify messages and to use some of the NIPs features (see the src/Nip* files).

In addition to that, the library provides some "managed" services (in src/services folder) that you can use in your sketches without worrying about the details and complexity of the nostr protocol.

Installation

Check the platformio registry page for instructions.

ESP32 dependencies

This library depends on the following additional libraries for the esp32 platform:

  • WebSockets@^2.4.1

Usage

See the example scripts in examples/ for simple examples of how to use this library.

Development

Setting up the build environment

# create venv
python3 -m venv venv
# activate venv
source venv/bin/activate
# install platformio
pip install platformio

Compiling Tests

Test NIP01

Edit examples/ESP32TestNip01/ESP32TestNip01.cpp and set the WIFI_SSID, WIFI_PASS and WIFI_CHANNEL.

Then compile with:

pio run -e ESP32TestNip01

Test NIP04

Compile with:

pio run -e ESP32TestNip04

Test NWC

Edit examples/ESP32TestNWC/ESP32TestNWC.cpp and set the WIFI_SSID, WIFI_PASS , WIFI_CHANNEL and NWC_URL. NB: you can get a nwc url from https://nwc.getalby.com/ or https://app.mutinywallet.com/settings/connections.

Then compile with:

pio run -e ESP32TestNWC

Running tests

You can upload the compiled tests to your ESP32 with:

pio run -e TEST_NAME -t upload

or use an emulator like wokwi.