• Stars
    star
    124
  • Rank 288,207 (Top 6 %)
  • Language
    Rust
  • License
    Creative Commons ...
  • Created over 10 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Rust JSONRPC library

Status

Rust Version compatibility

This library is compatible with Rust 1.48.0 or higher.

However, if you want to use the library with 1.41, you will need to pin a couple of our dependencies:

cargo update -p serde --precise 1.0.156
cargo update -p syn --precise 1.0.107

before building. (And if your code is a library, your downstream users will need to run these commands, and so on.)

Rust JSONRPC Client

Rudimentary support for sending JSONRPC 2.0 requests and receiving responses.

As an example, hit a local bitcoind JSON-RPC endpoint and call the uptime command.

use jsonrpc::Client;
use jsonrpc::simple_http::{self, SimpleHttpTransport};

fn client(url: &str, user: &str, pass: &str) -> Result<Client, simple_http::Error> {
    let t = SimpleHttpTransport::builder()
        .url(url)?
        .auth(user, Some(pass))
        .build();

    Ok(Client::with_transport(t))
}

// Demonstrate an example JSON-RCP call against bitcoind.
fn main() {
    let client = client("localhost:18443", "user", "pass").expect("failed to create client");
    let request = client.build_request("uptime", &[]);
    let response = client.send_request(request).expect("send_request failed");

    // For other commands this would be a struct matching the returned json.
    let result: u64 = response.result().expect("response is an error, use check_error");
    println!("bitcoind uptime: {}", result);
}

Githooks

To assist devs in catching errors before running CI we provide some githooks. If you do not already have locally configured githooks you can use the ones in this repository by running, in the root directory of the repository:

git config --local core.hooksPath githooks/

Alternatively add symlinks in your .git/hooks directory to any of the githooks we provide.

More Repositories

1

coinjoin

**NOT RELATED IN ANY WAYTO COINJOIN DOT IO, OR ANY OTHER COINJOIN WEBSITES. COINJOIN DOT IO IS A SCAM** Simplifies merging of bitcoin transactions for improved anonymity, using the popular CoinJoin scheme.
Rust
59
star
2

mimblewimble-paper

LaTeX of the MimbleWimble paper
TeX
29
star
3

wizards-wallet

A Bitcoin wallet written in Rust as a testbed for experimental user-facing tools
Rust
24
star
4

taproot

Taproot security proof
TeX
19
star
5

miniscript-workshop

Miniscript workshop code for Advancing Bitcoin 2020 (and perhaps later conferences)
Rust
14
star
6

RamseyScript

Explore mathematical spaces related to Ramsey-type problems.
C
9
star
7

icboc

Cold wallet designed around the Ledger Nano S
Rust
9
star
8

halfsleep

A mutation tester for rust
Rust
7
star
9

zkstuff

Random collection of zero-knowledge stuff
Python
7
star
10

strason

Json parser that preserves field ordering and stores numbers as strings, preserving their full data
Rust
6
star
11

sidechains-whitepaper

LaTeX source of the sidechains whitepaper published at http://www.blockstream.com/sidechains.pdf
TeX
5
star
12

pomotoshi

Rewrite of pomobar in Rust with some additional features
Rust
4
star
13

pregnancy-wheel

Pregnancy milestone volvelles
PostScript
4
star
14

sighacker

C
4
star
15

ots-viewer

Website to view opentimestamps in a user-friendly way
Rust
4
star
16

cj-client

Gtk client for a centralized coinjoin server
C
4
star
17

alts

(anti) altcoin whitepaper
TeX
4
star
18

todl

Essential Seafarer's Table of Discrete Logarithms
C++
3
star
19

rust-codex32

Rust reference implementation of codex32
Rust
3
star
20

rsgit

Various utilities for git repo management
Rust
2
star
21

russell-code

just a scrap repo for experimenting with error correction codes
Rust
1
star
22

asic-faq

Bitcoin document on ASICs and Decentralization
TeX
1
star
23

local-nix-ci

Scripts that I personally use to test PRs from projects
Nix
1
star
24

blog-posts

Content repo for my blog
PostScript
1
star
25

trade-tracker

simple utility for computing IVs and stuff for options trades
Rust
1
star