Skip to content

Python scripts for transmitting Bitcoin transactions over a mesh network

Notifications You must be signed in to change notification settings

chGoodchild/btc-mesh-demo

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

The purpose of this repo is to demo a library that transmits bitcoin objects (addresses, raw_trx, psbt, etc) over a mesh network.

This project leverages:

  • The bdk-python bindings for Bitcoin wallet and transaction functionalities. More information can be found here: bdk-python.
  • The Meshtastic Python API for transmitting data over mesh networks. Documentation and details are available at Meshtastic Python API.

Setup

This example assumes there are three meshtastic devices (Alice, Bob and Charlie) sending around PSBTs. I used two different LILYGO T-Beams and a T-echo. You can adapt the demo to work with fewer or more devices as needed.

Steps:

  • Follow the Meshtastic documentation to flash meshtastic firmware onto your devices.
  • Use unzip btc/wallets.zip wallets to unzip the wallets directory. The password (hcpp23_mesh) was set to keep the duller bots out.
  • These wallets should already be funded with testnet sats, but you may need to create new wallets or fund them again if their balance is insufficient.
  • You can broadcast and receive transactions manually, or use the bdk tooling from this demo to do so.

Usage

  1. Start the listener from the machine you wish to act as your bridge between the internet and the mesh.
python3 btc/listen.py /dev/ttyACM<number>
  1. Start the broadcaster from the machine you wish to use to send transactions.
python3 btc/broadcast_tx.py /dev/ttyACM<number>

Note that you will need to replace /dev/ttyACM<number> with the actual port your device is connected to.

Essentially the function broadcast_tx.py will:

  • Select a sender and receiver based on the wallet balances of the wallets in btc/wallets.
  • Create a PSBT from the sender's wallet to the receiver's wallet.
  • Broadcast the PSBT over the mesh network.

The function listen.py will:

  • Listen for PSBTs being broadcast over the mesh network.
  • Broadcast the PSBTs to the Bitcoin testnet network upon receiving complete PSBTs.

Contributing

Pull requests are welcome. For major changes, please open an issue first to explain the changes that are being made on the branch.

About

Python scripts for transmitting Bitcoin transactions over a mesh network

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 94.9%
  • Shell 5.1%