Git Product home page Git Product logo

elementsd's Introduction

MIT license Crates

ElementsD

Utility to run a liquidregtest elementsd process, useful in integration testing environment.

use elementsd::bitcoincore_rpc::RpcApi;
let exe = elementsd::exe_path().expect("elementsd executable must be provided in ELEMENTSD_EXE, or with a feature like '0_21_0', or be in PATH");
let elementsd = elementsd::ElementsD::new(exe).unwrap();
let info = elementsd
    .client()
    .call::<bitcoind::bitcoincore_rpc::jsonrpc::serde_json::Value>("getblockchaininfo", &[])
    .unwrap();
assert_eq!(info.get("chain").unwrap(), "liquidregtest");

Validate pegin

You can also start elementsd with validate pegin capability by connecting an instance of bitcoind. See test test_elementsd_with_validatepegin

See the similar BitcoinD for details

Nix

For determinisim, in nix you cannot hit the internet within the build.rs. Moreover, some downstream crates cannot remove the auto-download feature from their dev-deps. In this case you can set the ELEMENTSD_SKIP_DOWNLOAD env var and provide the elementsd executable in the PATH (or skip the test execution).

Doc

To build docs:

RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --features download,doc --open

MSRV

  • 1.57.0 with one of the auto download features
  • 1.56.1 without features

MSRV 1.56.1 may require downgrading dependencies. See our .github/workflows/test.yml file for a complete list.

elementsd's People

Contributors

apoelstra avatar rcasatta avatar shesek avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

elementsd's Issues

Trouble generating blocks.

I am currently trying to use elementsd to create a regtest integration test framework.

I have the following code trying to generate new regtest blocks.

let elementsd = ElementsD::new(downloaded_exe_path().unwrap()).unwrap();

        let mining_address = elementsd
            .client()
            .call::<Value>("getnewaddress", &[])
            .unwrap()
            .to_string();

        elementsd.client().call::<Value>("generatetoaddress", &[101.into(), mining_address.into()]).unwrap();

This is error with the following msg:
called Result::unwrap() on an Err value: JsonRpc(Rpc(RpcError { code: -5, message: "Error: Invalid address", data: None })).

Any idea or hint on what I am doing wrong would be very helpful.

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.