nostril

A C cli tool for creating nostr events
git clone git://jb55.com/nostril
Log | Files | Refs | Submodules | README | LICENSE

README.md (2526B)


      1 nostril(1)
      2 
      3 # NAME
      4 
      5 nostril - generate nostr events
      6 
      7 # SYNPOSIS
      8 
      9 *nostril* [OPTIONS...]
     10 
     11 # DESCRIPTION
     12 
     13 *nostril* is a tool that creates and signs nostr events.
     14 
     15 # OPTIONS
     16 
     17 *--content*
     18 	The text contents of the note
     19 
     20 *--dm* <hex pubkey>
     21 	Create a direct message. This will create a kind-4 note with the
     22 	contents encrypted>
     23 
     24 *--envelope*
     25 	Wrap the event with `["EVENT", ... ]` for easy relaying
     26 
     27 *--kind* <number>
     28 	Set the kind of the note
     29 
     30 *--created-at* <unix timestamp>
     31 	Set the created at. Optional, this is set automatically.
     32 
     33 *--sec* <hex seckey>
     34 	Set the secret key for signing, otherwise one will be randomly generated.
     35 
     36 *--mine-pubkey*
     37 	Mine a pubkey. This may or may not be cryptographically dubious.
     38 
     39 *--pow* <difficulty>
     40 	Number of leading 0 bits of the id the mine for proof-of-work.
     41 
     42 *--tag* <key> <value>
     43 	Add a tag with a single value
     44 
     45 *--tagn* <N> <value \* N ...>
     46 	Add a tag with 0 or more elements
     47 
     48 *-t*
     49 	Shorthand for --tag t <hashtag>
     50 
     51 *-p*
     52 	Shorthand for --tag p <hex pubkey>
     53 
     54 *-e*
     55 	Shorthand for --tag e <note id>
     56 
     57 
     58 # Examples
     59 
     60 *Generate an event*
     61 
     62 ```
     63 $ ./nostril --sec <key> --content "this is a message"
     64 {
     65 	"id": "da9c36bb8206e748cf136af2a43613a5ee113cb5906a09a8d3df5386039d53ab",
     66 	"pubkey": "4f6fa8547cf2888415522918175ea0bc0eb473287c5bd7cc459ca440bdf87d97",
     67 	"created_at": 1660750302,
     68 	"kind": 1,
     69 	"tags": [],
     70 	"content": "this is a message",
     71 	"sig": "3e4d7d93522e54f201a22944d4d37eb4505ef1cf91c278a3f7d312b772a6c6509d1e11f146d5a003265ae10411a20057bade2365501872d2f2f24219730eed87"
     72 }
     73 ```
     74 
     75 *Wrap event to send to a relay*
     76 
     77 ```
     78 $ ./nostril --envelope --sec <key> --content "hello"
     79 [ "EVENT",
     80 {
     81 	"id": "ed378d3fdda785c091e9311c6e6eeb075db349a163c5e38de95946f6013a8001",
     82 	"pubkey": "fd3fdb0d0d8d6f9a7667b53211de8ae3c5246b79bdaf64ebac849d5148b5615f",
     83 	"created_at": 1649948103,
     84 	"kind": 1,
     85 	"tags": [],
     86 	"content": "hello",
     87 	"sig": "9d9a49bbc66d4782030b24c71416965e790214d02a54ab132d960c2b02def0371c3d93e5a60a285c55e99721599d1332450731e2c6bb1114b96b591c6967f872"
     88 } ]
     89 ```
     90 
     91 *Send to a relay*
     92 
     93 ```
     94 nostril --envelope --sec <key> --content "this is a message" | websocat wss://relay.damus.io
     95 ```
     96 
     97 *Send a nip04 DM*
     98 
     99 ```
    100 nostril --envelope --dm <pubkey> --sec <key> --content "this is a secret" | websocat wss://relay.damus.io
    101 ```
    102 
    103 *Mine a pubkey*
    104 
    105 ```
    106 nostril --mine-pubkey --pow <difficulty>
    107 ```
    108 
    109 *Reply to an event. nip10 compliant, includes the `thread_id`*
    110 
    111 ```
    112 ./nostril --envelope --sec <key> --content "this is reply message" --tag e <thread_id> --tag e <note_id> | websocat wss://relay.damus.io
    113 ```