nostril

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

README.md (2606B)


      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 *--giftwrap-to* <hex pubkey>
     28 	Wrap a note with a giftwrap to a specific pubkey
     29 
     30 *--kind* <number>
     31 	Set the kind of the note
     32 
     33 *--created-at* <unix timestamp>
     34 	Set the created at. Optional, this is set automatically.
     35 
     36 *--sec* <hex seckey>
     37 	Set the secret key for signing, otherwise one will be randomly generated.
     38 
     39 *--mine-pubkey*
     40 	Mine a pubkey. This may or may not be cryptographically dubious.
     41 
     42 *--pow* <difficulty>
     43 	Number of leading 0 bits of the id the mine for proof-of-work.
     44 
     45 *--tag* <key> <value>
     46 	Add a tag with a single value
     47 
     48 *--tagn* <N> <value \* N ...>
     49 	Add a tag with 0 or more elements
     50 
     51 *-t*
     52 	Shorthand for --tag t <hashtag>
     53 
     54 *-p*
     55 	Shorthand for --tag p <hex pubkey>
     56 
     57 *-e*
     58 	Shorthand for --tag e <note id>
     59 
     60 
     61 # Examples
     62 
     63 *Generate an event*
     64 
     65 ```
     66 $ ./nostril --sec <key> --content "this is a message"
     67 {
     68 	"id": "da9c36bb8206e748cf136af2a43613a5ee113cb5906a09a8d3df5386039d53ab",
     69 	"pubkey": "4f6fa8547cf2888415522918175ea0bc0eb473287c5bd7cc459ca440bdf87d97",
     70 	"created_at": 1660750302,
     71 	"kind": 1,
     72 	"tags": [],
     73 	"content": "this is a message",
     74 	"sig": "3e4d7d93522e54f201a22944d4d37eb4505ef1cf91c278a3f7d312b772a6c6509d1e11f146d5a003265ae10411a20057bade2365501872d2f2f24219730eed87"
     75 }
     76 ```
     77 
     78 *Wrap event to send to a relay*
     79 
     80 ```
     81 $ ./nostril --envelope --sec <key> --content "hello"
     82 [ "EVENT",
     83 {
     84 	"id": "ed378d3fdda785c091e9311c6e6eeb075db349a163c5e38de95946f6013a8001",
     85 	"pubkey": "fd3fdb0d0d8d6f9a7667b53211de8ae3c5246b79bdaf64ebac849d5148b5615f",
     86 	"created_at": 1649948103,
     87 	"kind": 1,
     88 	"tags": [],
     89 	"content": "hello",
     90 	"sig": "9d9a49bbc66d4782030b24c71416965e790214d02a54ab132d960c2b02def0371c3d93e5a60a285c55e99721599d1332450731e2c6bb1114b96b591c6967f872"
     91 } ]
     92 ```
     93 
     94 *Send to a relay*
     95 
     96 ```
     97 nostril --envelope --sec <key> --content "this is a message" | websocat wss://relay.damus.io
     98 ```
     99 
    100 *Send a nip04 DM*
    101 
    102 ```
    103 nostril --envelope --dm <pubkey> --sec <key> --content "this is a secret" | websocat wss://relay.damus.io
    104 ```
    105 
    106 *Mine a pubkey*
    107 
    108 ```
    109 nostril --mine-pubkey --pow <difficulty>
    110 ```
    111 
    112 *Reply to an event. nip10 compliant, includes the `thread_id`*
    113 
    114 ```
    115 ./nostril --envelope --sec <key> --content "this is reply message" --tag e <thread_id> --tag e <note_id> | websocat wss://relay.damus.io
    116 ```