AIONostr

From Traxel Wiki
Jump to navigation Jump to search

Links

Install

Installing on a node that is already running Strfry, so basic system setup is done.

sudo apt install python3-venv
pip3 install virtualenv
git clone https://github.com/davestgermain/aionostr
cd aionostr
python3 -m venv bobenv
source ./bobenv/bin/activate

Test Run

Make a tunnel

ssh -L 7777:127.0.0.1:7777 admin@52.11.172.130 -N

Test success:

$ python bob_test.py send -r ws://localhost:7777 --content "hello" --kind 1 --private-key nsec1dgg7d6e0g2484twl9ygntc24ueehm44frrc8rc93vcvun04gmp9qgufd4g
2d88da29787d5d2a9553a645dc65a976bc7022bca36ba004fbbb0862cd0ccfd7
nevent1qqszmzx699u86hf2j4f6v3wuvk5hd0rsy272x6aqqnamkzrze5xvl4cpzdmhxw309akx7cmpd35x7um58gmnwdehvc5hs3

Docs:

$ python bob_test.py send --help
Usage: bob_test.py send [OPTIONS]

  Send an event to the network

  private key can be set using environment variable NOSTR_KEY

Options:
  -r TEXT             relay url
  -v, --verbose       verbose results
  --content TEXT      content
  --kind INTEGER      kind
  --created INTEGER   created_at
  --pubkey TEXT       public key
  --tags TEXT         tags
  --private-key TEXT  private key
  --dm TEXT           pubkey to send dm
  --help              Show this message and exit.

$ python bob_test.py --help
Usage: bob_test.py [OPTIONS] COMMAND [ARGS]...

  Console script for aionostr.

Options:
  --help  Show this message and exit.

Commands:
  bench
  gen         Generate a private/public key pair
  get         Get any nostr event
  make-nip19  Create nip-19 string for given object id
  mirror      Mirror a query from source relays to the target relay
  query       Run a query once and print events
  send        Send an event to the network

Success

$ python bob_test.py send -r ws://localhost:7777 --content "Nostred2" --kind 1 --private-key nsec1dgg7d6e0g2484twl9ygntc24ueehm44frrc8rc93vcvun04gmp9qgufd4g --tags '[["a","34550:npub10jlc40w2mexjzmhce54n8w3z2euemqdwpghg3f7lvxrunr7dgvasm0nurp:Nostred","ws://localhost:7777"]]' 
3ab5991581bb23ebe51a24918c86abd5915cfec67225ec7d8b97542b84fa6e29
nevent1qqsr4dvezkqmkgltu5dzfyvvs64aty2ulmr8yf0v0k9ew4ptsnaxu2gpzdmhxw309akx7cmpd35x7um58gmnwdehy7k9rs
$ python bob_test.py get -r ws://localhost:7777 nevent1qqsr4dvezkqmkgltu5dzfyvvs64aty2ulmr8yf0v0k9ew4ptsnaxu2gpzdmhxw309akx7cmpd35x7um58gmnwdehy7k9rs
{"id":"3ab5991581bb23ebe51a24918c86abd5915cfec67225ec7d8b97542b84fa6e29","pubkey":"7cbf8abdcade4d216ef8cd2b33ba2256799d81ae0a2e88a7df6187c98fcd433b","created_at":1696905392,"kind":1,"tags":[["a","34550:npub10jlc40w2mexjzmhce54n8w3z2euemqdwpghg3f7lvxrunr7dgvasm0nurp:Nostred","ws://localhost:7777"]],"content":"Nostred2","sig":"eb148e6804e4e1b896adfd5c7e9c399d8e029a5010ee35547ab9eaab356d8f0524a6da99a15162463c3a1205062621da4b3001422b9e6ba7220c67d51f1dc474"}
$ python bob_test.py send -r ws://localhost:7777 --content "Grumble" --kind 1 --private-key nsec1dgg7d6e0g2484twl9ygntc24ueehm44frrc8rc93vcvun04gmp9qgufd4g --tags '[["a","34550:npub10jlc40w2mexjzmhce54n8w3z2euemqdwpghg3f7lvxrunr7dgvasm0nurp:Nostred","ws://localhost:7777"],["e", "3ab5991581bb23ebe51a24918c86abd5915cfec67225ec7d8b97542b84fa6e29", ""]]'
3346dce2124ae5cf674a0a0d427543a4d35fa592fcdf0dd078cff47806df432d
nevent1qqsrx3kuugfy4ew0va9q5r2zw4p6f56l5kf0ehcd6puvlarcqm05xtgpzdmhxw309akx7cmpd35x7um58gmnwdeh79mhys
$ python bob_test.py get -r ws://localhost:7777 nevent1qqsrx3kuugfy4ew0va9q5r2zw4p6f56l5kf0ehcd6puvlarcqm05xtgpzdmhxw309akx7cmpd35x7um58gmnwdeh79mhys
{"id":"3346dce2124ae5cf674a0a0d427543a4d35fa592fcdf0dd078cff47806df432d","pubkey":"7cbf8abdcade4d216ef8cd2b33ba2256799d81ae0a2e88a7df6187c98fcd433b","created_at":1696905458,"kind":1,"tags":[["a","34550:npub10jlc40w2mexjzmhce54n8w3z2euemqdwpghg3f7lvxrunr7dgvasm0nurp:Nostred","ws://localhost:7777"],["e","3ab5991581bb23ebe51a24918c86abd5915cfec67225ec7d8b97542b84fa6e29",""]],"content":"Grumble","sig":"de9f6b5737e4d97f270b7331d780c0c12ce3fe09f0804ae03bfe1025284100b3158f07a20199661e95242b007c6c7b2d1d556008852ef714d2d29795446e988e"}