Skip to main content

Virtual Meshtastic node using mudp transport and meshdb storage.

Project description

vnode

Virtual Meshtastic node runtime built around:

  • mudp for multicast UDP send/receive
  • meshdb for packet and node persistence
  • Meshtastic-style PKI DM encryption using X25519 + SHA-256 + AES-CCM

Config

Edit node.json.

If node.json does not exist yet, the runtime will create it automatically from example-node.json.

If the template leaves node_id blank, the runtime will generate and persist a random Meshtastic-style node ID when it creates or first loads node.json.

The runtime will generate and persist a PKI private key into node.json on first run if the private key is blank.

The derived public key is written automatically to node.public.key next to node.json. That file is generated by the runtime and should not need manual edits.

The position section in node.json controls periodic position broadcasts. Set position.enabled to true, then set position.latitude and position.longitude, and adjust position.position_interval_seconds to control how often the node sends POSITION_APP packets. You can also set position.altitude if you want altitude included in the payload. Leave position.enabled false or leave latitude/longitude as null to disable position broadcasts.

Run

.venv/bin/pip install -e .
.venv/bin/python -m vnode --vnode-file node.json run

Send a DM

.venv/bin/python -m vnode --vnode-file node.json send-text --to '!1234abcd' --message 'hello'

send-text uses PKI automatically for direct messages when the destination node has a stored public key in meshdb. Otherwise it falls back to channel encryption. --config is still accepted as a compatibility alias for --vnode-file.

Library

The installable package lives under vnode/vnode, and the public library surface is exported from vnode directly:

from vnode import NodeConfig, VirtualNode, generate_keypair

node = VirtualNode("node.json")
packet_id = node.send_text("!1234abcd", "hello")

The runtime also mirrors the common Meshtastic Python pubsub and method surface:

  • topics: meshtastic.connection.established, meshtastic.connection.lost, meshtastic.receive, meshtastic.receive.text, meshtastic.receive.position, meshtastic.receive.user, meshtastic.receive.data.<PORTNUM>, meshtastic.node.updated, meshtastic.log.line
  • methods: receive(), unreceive(), close(), sendText(), sendData(), sendPosition(), getMyNodeInfo(), getMyUser(), getLongName()

That means code shaped like the Meshtastic Python library can often run on VirtualNode with minimal changes.

Examples

Use these as small runnable references for common tasks:

  • examples/autoresponder.py: DM-only reply bot for inbound direct text messages
  • examples/listen_packets.py: packet logger using the mirrored meshtastic.receive callback shape
  • examples/send_dm.py: minimal one-shot direct-message sender
  • examples/library_embed.py: minimal application-style embedding example using both vnode and Meshtastic-style APIs
  • examples/meshtastic_compat.py: minimal Meshtastic-style example using meshtastic.* topics and sendText()
  • examples/serial_or_vnode.py: try a real serial node first, then fall back to vnode when no device is attached
  • examples/watch_reliability.py: watcher for ACK, NAK, retry, and retransmit-failure events
.venv/bin/python examples/autoresponder.py
.venv/bin/python examples/listen_packets.py
.venv/bin/python examples/send_dm.py --to '!1234abcd' --message 'hello'
.venv/bin/python examples/library_embed.py
.venv/bin/python examples/meshtastic_compat.py
.venv/bin/python examples/serial_or_vnode.py
.venv/bin/python examples/watch_reliability.py --to '!1234abcd' --message 'hello'

See examples/README.md for the full list.

License

GPL-3.0-only. See LICENSE.

Meshtastic® is a registered trademark of Meshtastic LLC. Meshtastic software components are released under various licenses, see GitHub for details. No warranty is provided - use at your own risk.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vnode-0.1.4.tar.gz (27.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vnode-0.1.4-py3-none-any.whl (28.5 kB view details)

Uploaded Python 3

File details

Details for the file vnode-0.1.4.tar.gz.

File metadata

  • Download URL: vnode-0.1.4.tar.gz
  • Upload date:
  • Size: 27.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for vnode-0.1.4.tar.gz
Algorithm Hash digest
SHA256 ff08ab95f26b97d08ea2f84d2decede853fe9e5234e467b2ac4178d5de6d51f9
MD5 34db3a29f388f609f081318ab4388ad6
BLAKE2b-256 8a9f7b0e6a1f80897771764f3660d03cc018ca4fed37fa8f85bbe20e258fe611

See more details on using hashes here.

Provenance

The following attestation bundles were made for vnode-0.1.4.tar.gz:

Publisher: release.yaml on pdxlocations/vnode

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vnode-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: vnode-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 28.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for vnode-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 60b7ffd1924ae8b529ed3d66b0e8958024aaffd98ca22031df2352bada33f1ba
MD5 0350f65a720cd5ee5d5b025b6bcc0b5d
BLAKE2b-256 b818f2ac38886114545db72fe0df4032be6e9207c77a6d21b57bc1ec2c277ed4

See more details on using hashes here.

Provenance

The following attestation bundles were made for vnode-0.1.4-py3-none-any.whl:

Publisher: release.yaml on pdxlocations/vnode

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page