Giter VIP home page Giter VIP logo

rust-bitcoincore-zmq's Introduction

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

rust-bitcoincore-zmq's People

Contributors

antonilol avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

rust-bitcoincore-zmq's Issues

Name colision in crates.io

Hi, antonilol.
:-)

I was about to upload my version of bitcoincore-zmq
https://github.com/dev7ba/bitcoincore-zmq
And I've realized that you took that name 2 months before!

I really don't care, your version also includes support for other msg rather than sequence msgs... mine not. So better for the community.

I created mempoolexplorer.com a year ago and I was wondering what are you involved in now. Just to avoid other collisions and maybe finding synergies with your work. I haven't found any other place to contact you but github, feel free to delete this issue.

You can contact me by any means described in the footpage at mempoolexplorer.com.

See you.

Dev7ba.

integration tests experience is obscure

I want to review #4 so I'm trying to run the integration tests on my NixOS 23.05.

I checked out master and did:

$ nix-shell -p bitcoin
$ cd integration_tests
$  bash test.sh
Bitcoin Core version v25.0.0
Copyright (C) 2009-2023 The Bitcoin Core developers

Please contribute if you find Bitcoin Core useful. Visit
<https://bitcoincore.org/> for further information about the software.
The source code is available from <https://github.com/bitcoin/bitcoin>.

This is experimental software.
Distributed under the MIT software license, see the accompanying file COPYING
or <https://opensource.org/licenses/MIT>

datadir: /run/user/1000/tmp.Q2eSC09Pgj

Bitcoin Core starting

Setting up Bitcoin Core...
{
  "name": "default_wallet"
}
generated 200 blocks

Running tests
    Finished dev [unoptimized + debuginfo] target(s) in 0.04s
     Running `target/debug/bitcoincore_zmq_integration_tests`

Bitcoin Core stopping

So now I'm confused. Does that mean the tests were successful?

One improvement could be to add println! statements after each assert! indicating to the user about the success of each test. That would make the experience of running the integration tests a bit more intuitive.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.