5 releases (breaking)

0.5.0 Sep 5, 2023
0.4.0 Jul 9, 2023
0.3.0 Feb 20, 2023
0.2.0 Jan 8, 2023
0.1.0 Jan 1, 2023

#824 in Command line utilities

28 downloads per month

MIT license

66KB
1.5K SLoC

Nostr-tool

crates.io crates.io - Downloads Docker Pulls MIT

A simple CLI tool to send nostr events.

Currently, this is more of a POC on the use of the nostr-sdk library in a CLI application.

Install

Clone the repo and run the following command in the repo folder. You must have Rust installed to compile this.

Install from crates.io

cargo install nostr-tool

Build from source

cargo build --release

Build with Docker locally

docker build -t nostr-tool .

Build with Docker from DockerHub

docker pull 0xtr/nostr-tool:0.3.0

Run nostr-tools command once to get the standard help menu up. Each subcommand also has it's own help menu accessed by appending the --help flag.

Examples

Update metadata

nostr-tool -r wss://nostr.oxtr.dev update-metadata -n "Alice" -a "Who the fuck is Alice?" -p "https://upload.wikimedia.org/wikipedia/en/2/2b/New_world-living_next_door_to_alice.JPG"

Create a new note with a new identity

nostr-tool -r wss://nostr.oxtr.dev text-note -c "Hello World"

Create a new note with an existing private key

nostr-tool -r wss://nostr.oxtr.dev -p {PRIVATE_KEY} text-note -c "Hello World"

Create a new note with an existing private key as a reply to another note

nostr-tool -r wss://nostr.oxtr.dev -p {PRIVATE_KEY} text-note -c "Hello World" --etag {EVENT-ID_TO_REPLY_TO} --ptag {PUBKEY_YOU_ARE_REPLYING_TO}

Import contacts/followers from a CSV file

nostr-tool -r wss://nostr.oxtr.dev -p {PRIVATE_KEY} publish-contact-list-csv -f {PATH_TO_CSV_FILE}

The CSV file should have the following format

pubkey,relay,petname
b2d670de53b27691c0c3400225b65c35a26d06093bcc41f48ffc71e0907f9d4a,"wss://nostr.oxtr.dev",""
32e1827635450ebb3c5a7d12c1f8e7b2b514439ac10a67eef3d9fd9c5c68e245,"wss://relay.damus.io",""

Send a direct message

nostr-tool -r wss://nostr.oxtr.dev -p {PRIVATE_KEY} send-direct-message --receiver {RECIPIENT_PUBKEY} --message "Hello World"

Delete an event

nostr-tool -r wss://nostr.oxtr.dev -p {PRIVATE_KEY} delete-event -e {EVENT_ID} -r "The reason for deleting the event"

React to an event

nostr-tool -r wss://nostr.oxtr.dev -p {PRIVATE_KEY} react -e {EVENT_ID} -a {EVENT_AUTHOR_PUBKEY} -r "👍"

Run with docker

docker run nostr-tool nostr-tool -r wss://nostr.oxtr.dev text-note -c "Hello World"

Dependencies

~12–28MB
~399K SLoC