ghostcore-zmq

Crates.ioghostcore-zmq
lib.rsghostcore-zmq
version1.4.0
sourcesrc
created_at2024-06-23 12:35:41.515198
updated_at2024-06-23 12:35:41.515198
descriptionGhost Core ZMQ subscriber with minimal dependencies
homepagehttps://github.com/bleach86/rust-ghostcore-zmq
repositoryhttps://github.com/bleach86/rust-ghostcore-zmq
max_upload_size
id1281177
size88,733
(bleach86)

documentation

README

Build and test Integration tests crates.io docs.rs

Rust Bitcoin Core ZMQ Subscriber

Usage example

fn main() {
    for msg in bitcoincore_zmq::subscribe_receiver(&["tcp://127.0.0.1:28359"]).unwrap() {
        match msg {
            Ok(msg) => println!("Received message: {msg}"),
            Err(err) => println!("Error receiving message: {err}"),
        }
    }
}

For more examples, have a look in the examples directory.

Features

  • Minimal dependencies: the 2 crates bitcoin and zmq, optionally 2 additional crates are needed for the async subscriber, async_zmq and futures-util.
  • Handles all message types from Bitcoin Core: hashblock, hashtx, block, tx and sequence.
  • Flexible: choose between blocking functions with a callback, reading from a Receiver or reading from an asynchronous Stream without locking to a specific async runtime.

Testing

Tests run on every push and pull request. Integration tests use the latest version of the 3 most recent major Bitcoin Core versions, see integration_tests.yml.

Useful resources


TODO:

  • This README
  • SequenceMessage itest
  • Easy addEventListener like functionality with help of the getzmqnotifications rpc (bitcoincore-rpc PR: #295)
  • raw messages
  • zmq publisher
  • include source in message
Commit count: 100

cargo fmt