nostril

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

README.md (2460B)


      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 *-t*
     46 	Shorthand for --tag t <hashtag>
     47 
     48 *-p*
     49 	Shorthand for --tag p <hex pubkey>
     50 
     51 *-e*
     52 	Shorthand for --tag e <note id>
     53 
     54 
     55 # Examples
     56 
     57 *Generate an event*
     58 
     59 ```
     60 $ ./nostril --sec <key> --content "this is a message"
     61 {
     62 	"id": "da9c36bb8206e748cf136af2a43613a5ee113cb5906a09a8d3df5386039d53ab",
     63 	"pubkey": "4f6fa8547cf2888415522918175ea0bc0eb473287c5bd7cc459ca440bdf87d97",
     64 	"created_at": 1660750302,
     65 	"kind": 1,
     66 	"tags": [],
     67 	"content": "this is a message",
     68 	"sig": "3e4d7d93522e54f201a22944d4d37eb4505ef1cf91c278a3f7d312b772a6c6509d1e11f146d5a003265ae10411a20057bade2365501872d2f2f24219730eed87"
     69 }
     70 ```
     71 
     72 *Wrap event to send to a relay*
     73 
     74 ```
     75 $ ./nostril --envelope --sec <key> --content "hello"
     76 [ "EVENT",
     77 {
     78 	"id": "ed378d3fdda785c091e9311c6e6eeb075db349a163c5e38de95946f6013a8001",
     79 	"pubkey": "fd3fdb0d0d8d6f9a7667b53211de8ae3c5246b79bdaf64ebac849d5148b5615f",
     80 	"created_at": 1649948103,
     81 	"kind": 1,
     82 	"tags": [],
     83 	"content": "hello",
     84 	"sig": "9d9a49bbc66d4782030b24c71416965e790214d02a54ab132d960c2b02def0371c3d93e5a60a285c55e99721599d1332450731e2c6bb1114b96b591c6967f872"
     85 } ]
     86 ```
     87 
     88 *Send to a relay*
     89 
     90 ```
     91 nostril --envelope --sec <key> --content "this is a message" | websocat wss://relay.damus.io
     92 ```
     93 
     94 *Send a nip04 DM*
     95 
     96 ```
     97 nostril --envelope --dm <pubkey> --sec <key> --content "this is a secret" | websocat wss://relay.damus.io
     98 ```
     99 
    100 *Mine a pubkey*
    101 
    102 ```
    103 nostril --mine-pubkey --pow <difficulty>
    104 ```
    105 
    106 *Reply to an event. nip10 compliant, includes the `thread_id`*
    107 
    108 ```
    109 ./nostril --envelope --sec <key> --content "this is reply message" --tag e <thread_id> --tag e <note_id> | websocat wss://relay.damus.io
    110 ```