Skip to content

Bridge to publish Nostr posts and send/receive DMs over LoRa using Meshtastic

License

Notifications You must be signed in to change notification settings

QuixoteSystems/nostrastic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nostrastic-alargado

Bridge to publish Nostr posts and send/receive DMs over LoRa using a Meshtastic device.

Note: This is a Beta version (Proof of Concept), so I am still debugging and improving the code. PRs are welcomed.

First steps

To use Nostrastic you need at least:

  • One Meshtastic Device
  • One Meshtastic Gateway Device, this means a Meshtastic Device with internet connection and MQTT enable.
  • Running Nostrastic with a computer/server with internet connection

Configure your Meshtastic devices

First of all you have to set up certains options in your Meshtastic Device and in your Meshtastic Gateway.

  • In your Meshtastic Device (with no internet):

    • Add mqtt channel as secondary (IMPORTANT: name has to be mqtt in lower case)
  • In your Meshtastic Gateway Device (with internet):

    • Add mqtt channel as secondary (IMPORTANT: name has to be mqtt in lower case)
    • In MQTT Config:
      • Enable MQTT
      • Enable JSON output
      • Disable Encryption

Architecture

This is one simple example where meshtastic devices with no internet can send Nostr post and send/receive DMs. Notice at least one meshtastic device in the mesh needs internet connection to forward all the messages to the MQTT Server. And then Nostrastic takes events from Nostr Relay and selected messages from MQTT Server and resend to the opposite direction.

nostrastic2

Start using Nostrastic

1- Clone or Download this repo.

2- Install packages requirements:

pip install -r requirements.txt

3- Fill up with your own data .env file

## NOSTR ###################################################################
# Your Public Keys
NPUB = 'npub...'
HEX_NPUB = 'hexadecimal...'

# Your Private Keys
NSEC = 'nsec...'
HEX_NSEC = 'hexadecimal'

# Relays
# Relay where senders and receivers users have to be
RELAY = 'wss://YOUR_RELAY'

## MQTT ####################################################################
# Meshtastic MQTT Server (Default) you can change for your own MQTT server
MQTT_SRV = 'mqtt.meshtastic.org'
MQTT_PORT = 1883
MQTT_USER = DEFAULT_USER
MQTT_PASS = DEFAULT_PASSWORD
# Suscription to mqtt JSON Channel has to be this path: json/mqtt other doesnt work
SUSCRIPTION = 'msh/YOUR/PATH/json/mqtt/#'
# Channel from MQTT where message are published
PUBLISHING = 'msh/YOUR/PATH/json/mqtt/!'

## MESHTASTIC ###############################################################
# Your Meshtastic ID Device from where you are writing over LoRa (without ! symbol)
# If change the MESH_DEVICE needs to reload the enviroment variables (close and open folder VS)
MESH_DEVICE = '12345678'

4- Fill up with your Nostr contacts contacts.json file:

{
    "(nickname_1)":"npub...",
    "(nickname_2)":"npub...",
    "(nickname_3)": "npub..."
}

5- Run main.php

python3 main.py

6- Automatically it will create nostrastic.log where you can see what is happening

7- From your Meshtastic device:

  • You have to go to mqtt channel and write: (post) or (nickname) following the post text or DM message:
    • To send a Nostr post:

      (post) This is an amazing note for all nostriches. --> This will send that text like a post to your Nostr account.

    • To send a DM to your contact (remember this nickname has to be on contacts.json):

      (nickname_1) Hi Pleb! How are you doing? --> This will send that text like a DM to your contact.

If you like this project, you can help by sending me some sats:

quixote LN wallet

LN address: quixote@getalby.com

About

Bridge to publish Nostr posts and send/receive DMs over LoRa using Meshtastic

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages