38 releases

0.20.0 Apr 29, 2026
0.19.0 Jan 6, 2026
0.18.0 Apr 12, 2024
0.17.0 Jan 2, 2024
0.6.2 Nov 23, 2015

#90 in Network programming

Download history 34895/week @ 2026-01-23 34830/week @ 2026-01-30 32793/week @ 2026-02-06 30731/week @ 2026-02-13 36318/week @ 2026-02-20 38133/week @ 2026-02-27 58366/week @ 2026-03-06 47963/week @ 2026-03-13 40362/week @ 2026-03-20 46673/week @ 2026-03-27 44229/week @ 2026-04-03 49491/week @ 2026-04-10 46921/week @ 2026-04-17 39166/week @ 2026-04-24 45956/week @ 2026-05-01 50554/week @ 2026-05-08

189,758 downloads per month
Used in 222 crates (39 directly)

CC0 license

140KB
2.5K SLoC

Status

Rust Version compatibility

This library is compatible with Rust 1.75.0 or higher.

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", None);
    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);
}

Dependencies

~0.4–3.5MB
~67K SLoC