bitcoin-zmq 0.2.0-alpha.1

A library providing a relatively thin wrapper around Bitcoin ZMQ, allowing the construction of asynchronous streams of transaction or block data.
Documentation
use bitcoin_zmq::{Topic, ZMQListener};
use futures::prelude::*;

#[tokio::main]
async fn main() {
    // Construct ZMQ listenr
    let listener = ZMQListener::bind("tcp://127.0.0.1:28332")
        .await
        .expect("could not connect");

    // Do something with specific topic messages
    listener
        .stream_classified()
        .take(10)
        .try_for_each(|(topic, raw)| {
            if topic == Topic::HashTx {
                println!("raw tx hash: {:?}", hex::encode(raw));
            }
            future::ok(())
        })
        .await
        .expect("zmq error'd during stream");
}