https://github.com/bvcxza/sonos
C++ library and command line tool for Nostr
https://github.com/bvcxza/sonos
command-line-tool cpp library nostr
Last synced: 19 days ago
JSON representation
C++ library and command line tool for Nostr
- Host: GitHub
- URL: https://github.com/bvcxza/sonos
- Owner: bvcxza
- License: mit
- Created: 2024-11-01T21:42:47.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-07-11T19:50:09.000Z (12 months ago)
- Last Synced: 2025-11-28T17:42:24.950Z (7 months ago)
- Topics: command-line-tool, cpp, library, nostr
- Language: C++
- Homepage:
- Size: 105 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-nostr - sonos - C++ library and command line tool for Nostr (Libraries / Client reviews and/or comparisons)
README
# SONOS
A C++ library and a command line tool for [Nostr](https://nostr.com). It follows [NIP-01](https://github.com/nostr-protocol/nips/blob/master/01.md) spec.
## Prerequisite to build
This project uses [miniforge](https://github.com/conda-forge/miniforge) as dependency manager. Follow [instructions](https://github.com/conda-forge/miniforge#install) to install it.
## For users
### Build and Install
See [Prerequisite](#prerequisite-to-build) before build.
```
git clone --recurse-submodules https://github.com/bvcxza/sonos.git
cd sonos
mamba env update -n $(basename $PWD) -f conda.yml
. env.sh
bld_secp256k1 && cnf -DCMAKE_INSTALL_PREFIX=~/.local && bld install
```
### Run
Just enter `sonos` to show usage.
```
Commands:
convert:
Convert bech32 addresses (npub1 and nsec1) to/from hexadecimal string.
Usage: sonos convert
Usage: sonos convert
event:
Create and send a event to nostr relays.
Usage: echo "content" | sonos event
keypair:
Create or show keypair from hexadecimal/bech32 secret string
Usage: sonos keypair [secret]
relays:
Show user's relays from hexadecimal/bech32 public key.
Usage: sonos relays
req:
Send a REQ message to nostr relays and execute a external command for each received event.
The program called by command receives the event JSON file path as the first parameter ($1 in bash).
Usage: sonos req
user:
Show user metadata from hexadecimal/bech32 public key.
Usage: sonos user
```
### Send a REQ and handle events with external program
Example: Call a [bash script](samples/script.sh) for each [event](https://github.com/nostr-protocol/nips/blob/master/01.md#events-and-signatures) with tag "Monero".
```
sonos req '{"kinds":[1],"#t":["Monero"],"limit":0}' ./samples/script.sh nostr.bitcoiner.social:443
```
## For developers
### Build and Test
See [Prerequisite](#prerequisite-to-build) before build.
```
git clone https://github.com/bvcxza/sonos.git
cd sonos
git submodule update --init --force --recursive
mamba env update -n $(basename $PWD) -f conda.yml
. env.sh
bld_secp256k1 && cnf && bld && tst
```
### Run
Just enter `run` to show usage.
## Donations
Please consider donating to support the development of this project.
[Monero (XMR)](https://www.getmonero.org): 8AADjm5nz4GXXn7Tf6FNfwCaAjAdkvdUs5KgRwBGUj2NHwWqkxbfLzYPom3mL6a1cN1aypyfvyzaxHAM8aARbafFKkABT6Z