MCPcopy Index your code
hub / github.com/alfred-hodler/pushtx

github.com/alfred-hodler/pushtx @v0.4.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.4.0 ↗ · + Follow
82 symbols 127 edges 9 files 26 documented · 32%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Documentation Crates.io License Test Status

Privacy-focused Bitcoin Transaction Broadcaster

This is a Rust program that broadcasts Bitcoin transactions directly into the P2P network by connecting to a set of random Bitcoin nodes. This differs from other broadcast tools in that it does not not interact with any centralized services, such as block explorers.

The program is entirely self-contained and does not require Bitcoin Core or other dependencies.

If Tor is running on the same system, connectivity to the P2P network is established through a newly created circuit. Having Tor Browser running in the background is sufficient. Tor daemon also works.

Broadcast Process

  1. Resolve peers through DNS seeds.
  2. Detect if Tor is present.
  3. Connect to 10 random peers, through Tor if possible.
  4. Broadcast the transaction to a single peer.
  5. Wait until the transaction is seen on the network.
  6. Disconnect.

Executable

Install with Cargo: cargo install pushtx-cli

Demo

Library

 // this is our hex-encoded transaction that we want to parse and broadcast
 let tx = "6afcc7949dd500000....".parse().unwrap();

 // we start the broadcast process and acquire a receiver to the info events
 let receiver = pushtx::broadcast(vec![tx], pushtx::Opts::default());

 // start reading info events until `Done` is received
 loop {
     match receiver.recv().unwrap() {
         pushtx::Info::Done(Ok(report)) => {
             println!("{} transactions broadcast successfully", report.success.len());
             break;
         }
         pushtx::Info::Done(Err(err)) => {
             println!("we failed to broadcast to any peers, reason = {err}");
             break;
         }
         _ => {}
     }
 }

Disclaimer

This project comes with no warranty whatsoever. Please refer to the license for details.

Extension points exported contracts — how you extend this code

Peerlike (Interface)
Provides common functionality that uniquely identifies a peer. [1 implementers]
pushtx/src/p2p.rs
Outbox (Interface)
Describes a type that queues commands for outbound delivery. [1 implementers]
pushtx/src/p2p.rs
Receiver (Interface)
Describes a type capable of receiving p2p events. [1 implementers]
pushtx/src/p2p.rs
Sender (Interface)
Describes a type that sends queued commands outbound. [1 implementers]
pushtx/src/p2p.rs

Core symbols most depended-on inside this repo

send
called by 8
pushtx/src/p2p/client.rs
queue
called by 5
pushtx/src/p2p/client.rs
parse_fixed
called by 4
pushtx/src/seeds.rs
run
called by 3
pushtx/src/broadcast.rs
message
called by 3
pushtx/src/p2p/client.rs
detect_tor_proxy
called by 2
pushtx/src/broadcast.rs
is_port_reachable
called by 2
pushtx/src/broadcast.rs
txid
called by 2
pushtx/src/lib.rs

Shape

Method 35
Enum 16
Function 14
Class 13
Interface 4

Languages

Rust100%

Modules by API surface

pushtx/src/lib.rs19 symbols
pushtx/src/net.rs15 symbols
pushtx/src/p2p/client.rs13 symbols
pushtx/src/broadcast.rs9 symbols
pushtx/src/p2p.rs7 symbols
pushtx-cli/src/main.rs7 symbols
pushtx/src/handshake.rs5 symbols
pushtx/src/p2p/protocol.rs4 symbols
pushtx/src/seeds.rs3 symbols

For agents

$ claude mcp add pushtx \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page