2022-04-14 10:56:50 -04:00
|
|
|
|
|
|
|
# nostril
|
|
|
|
|
|
|
|
A cli util for creating nostr events
|
|
|
|
|
2022-08-18 12:11:23 -04:00
|
|
|
## Installation
|
|
|
|
|
|
|
|
### Fedora
|
|
|
|
|
|
|
|
```bash
|
|
|
|
$ sudo dnf install libtool automake
|
|
|
|
$ make
|
|
|
|
|
|
|
|
# Optional - install to system PATH
|
|
|
|
|
|
|
|
$ sudo make install
|
|
|
|
```
|
|
|
|
|
2022-04-14 22:46:40 -04:00
|
|
|
## Usage
|
|
|
|
|
2022-08-09 11:05:57 -04:00
|
|
|
usage: nostril [OPTIONS]
|
2022-08-31 06:39:27 -04:00
|
|
|
|
2022-04-14 22:46:40 -04:00
|
|
|
OPTIONS
|
2022-08-31 06:39:27 -04:00
|
|
|
|
2022-08-09 11:05:57 -04:00
|
|
|
--content the content of the note
|
2022-04-14 22:46:40 -04:00
|
|
|
--dm <hex pubkey> make an encrypted dm to said pubkey. sets kind and tags.
|
|
|
|
--envelope wrap in ["EVENT",...] for easy relaying
|
|
|
|
--kind <number> set kind
|
|
|
|
--created-at <unix timestamp> set a specific created-at time
|
|
|
|
--sec <hex seckey> set the secret key for signing, otherwise one will be randomly generated
|
2022-04-15 13:41:17 -04:00
|
|
|
--pow <difficulty> number of leading 0 bits of the id to mine
|
2022-04-20 13:37:36 -04:00
|
|
|
--tag <key> <value> add a tag
|
2022-04-20 19:23:00 -04:00
|
|
|
-e <event_id> shorthand for --tag e <event_id>
|
|
|
|
-p <pubkey> shorthand for --tag p <pubkey>
|
2022-04-14 22:46:40 -04:00
|
|
|
|
2022-04-14 10:56:50 -04:00
|
|
|
## Examples
|
|
|
|
|
|
|
|
Generate an event:
|
|
|
|
|
2022-08-11 15:19:01 -04:00
|
|
|
$ ./nostril --sec <key> --content "this is a message"
|
2022-04-14 10:56:50 -04:00
|
|
|
{
|
2022-08-17 11:32:35 -04:00
|
|
|
"id": "da9c36bb8206e748cf136af2a43613a5ee113cb5906a09a8d3df5386039d53ab",
|
|
|
|
"pubkey": "4f6fa8547cf2888415522918175ea0bc0eb473287c5bd7cc459ca440bdf87d97",
|
|
|
|
"created_at": 1660750302,
|
2022-04-14 10:56:50 -04:00
|
|
|
"kind": 1,
|
|
|
|
"tags": [],
|
2022-08-17 11:32:35 -04:00
|
|
|
"content": "this is a message",
|
|
|
|
"sig": "3e4d7d93522e54f201a22944d4d37eb4505ef1cf91c278a3f7d312b772a6c6509d1e11f146d5a003265ae10411a20057bade2365501872d2f2f24219730eed87"
|
2022-04-14 10:56:50 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
Wrap event to send to a relay:
|
|
|
|
|
2022-08-11 15:19:01 -04:00
|
|
|
$ ./nostril --envelope --sec <key> --content "hello"
|
2022-04-14 10:56:50 -04:00
|
|
|
[
|
|
|
|
"EVENT",
|
|
|
|
{
|
|
|
|
"id": "ed378d3fdda785c091e9311c6e6eeb075db349a163c5e38de95946f6013a8001",
|
|
|
|
"pubkey": "fd3fdb0d0d8d6f9a7667b53211de8ae3c5246b79bdaf64ebac849d5148b5615f",
|
|
|
|
"created_at": 1649948103,
|
|
|
|
"kind": 1,
|
|
|
|
"tags": [],
|
|
|
|
"content": "hello",
|
|
|
|
"sig": "9d9a49bbc66d4782030b24c71416965e790214d02a54ab132d960c2b02def0371c3d93e5a60a285c55e99721599d1332450731e2c6bb1114b96b591c6967f872"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
|
|
|
Send to a relay:
|
|
|
|
|
2022-08-16 16:27:50 -04:00
|
|
|
$ ./nostril --envelope --sec <key> --content "this is a message" | websocat wss://relay.damus.io
|
2022-04-14 10:56:50 -04:00
|
|
|
|
2022-04-14 22:46:11 -04:00
|
|
|
Send a nip04 DM:
|
|
|
|
|
2022-08-16 16:27:50 -04:00
|
|
|
$ ./nostril --envelope --dm <pubkey> --sec <key> --content "this is a secret" | websocat wss://relay.damus.io
|
2022-04-14 10:56:50 -04:00
|
|
|
|
2022-08-31 06:39:27 -04:00
|
|
|
Mine a pubkey:
|
|
|
|
|
|
|
|
$ ./nostril --mine-pubkey --pow <difficulty>
|
|
|
|
|
|
|
|
Reply to an event. nip10 compliant, includes the `thread_id`:
|
|
|
|
|
|
|
|
$ ./nostril --envelope --sec <key> --content "this is reply message" --tag e <thread_id> --tag e <note_id> | websocat wss://relay.damus.io
|