Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up #2

Closed
wants to merge 42 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
a3aec66
START FORK OF CRATE
tcharding May 1, 2024
2d06bca
CI: Fix pinning
tcharding May 1, 2024
dcaa5ca
Add verifymessage feature
tcharding May 1, 2024
0f14603
Allow deprecated in main lib module
tcharding Apr 30, 2024
32cac11
Run the formatter
tcharding Apr 30, 2024
c94ee49
Re-write CI
tcharding Apr 29, 2024
29db859
Depend on bitcoin v0.32.0
tcharding Apr 29, 2024
217d243
Add a justfile
tcharding May 1, 2024
d348ee0
Add rand feature
tcharding May 1, 2024
fab8c1a
Upgrade jsonrpc dependency to v0.18.0
tcharding Apr 30, 2024
8cb3d72
Use minreq_http feature of jsonrpc
tcharding May 1, 2024
addeac6
client: Remove stale changelog file
tcharding May 1, 2024
2fcb19c
Remove explicit json version
tcharding May 1, 2024
bef44ef
integration_test: Do not depend on bitcoin
tcharding May 1, 2024
1243b37
Format with nightly toolchain
tcharding May 1, 2024
9d73e37
Bump version to 0.19.0
tcharding May 1, 2024
8b166f0
CI: Install rustfmt
tcharding May 1, 2024
2c09286
Use SPDX licence identifiers
tcharding May 1, 2024
4850011
Use second level markdown heading
tcharding May 1, 2024
98b3075
Remove old fashion lib stuff
tcharding May 1, 2024
b4987da
Exclude integration_test code from being published
tcharding May 1, 2024
96f9e5c
Set edition and rust-version
tcharding May 1, 2024
b23b9d8
Remove stale comment
tcharding May 1, 2024
ef3c08b
Set resolver = 2 in workspace manifest
tcharding May 1, 2024
d639641
Re-export json crate only as terse name
tcharding May 1, 2024
fe54f79
Use single line for members
tcharding May 1, 2024
29307de
Fix up headings in crate readmes
tcharding May 1, 2024
939d05e
Remove macro_use
tcharding May 1, 2024
039104a
Copy lint allows from rust-bitcoin
tcharding May 1, 2024
db081d5
Remove unneeded explicit ref
tcharding May 1, 2024
bc6011a
Remove explicit reference
tcharding May 1, 2024
06f5797
Remove redundant imports
tcharding May 1, 2024
088a2b3
Feature gate import
tcharding May 1, 2024
98935b7
Remove redundant field names
tcharding May 1, 2024
73d30bc
Remove useless lint attribute
tcharding May 1, 2024
4c571bc
Implement From instead of Into
tcharding May 1, 2024
71d9365
Elide unnecessary lifetime
tcharding May 1, 2024
f049bca
Use iter instead of into_iter
tcharding May 1, 2024
e7c2444
Use cloned instead of to_vec
tcharding May 1, 2024
f8fc939
Remove useless conversion
tcharding May 1, 2024
1c89c1a
Allow many arguments
tcharding May 1, 2024
811b9f4
Format code
tcharding May 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
141 changes: 84 additions & 57 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -1,62 +1,89 @@
on: [push, pull_request]
on:
push:
branches:
- master
- 'test-ci/**'
pull_request:

name: Continuous integration

jobs:
tests:
name: Tests
runs-on: ubuntu-latest
strategy:
matrix:
include:
- rust: stable
env:
RUSTFMTCHK: true
- rust: nightly
env:
RUSTFMTCHK: false
- rust: 1.56.1
env:
RUSTFMTCHK: false
steps:
- name: Checkout Crate
uses: actions/checkout@v2
- name: Checkout Toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- name: Running test script
env: ${{ matrix.env }}
run: ./contrib/test.sh
Stable:
name: Test - stable toolchain
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: "Checkout repo"
uses: actions/checkout@v4
- name: "Select toolchain"
uses: dtolnay/rust-toolchain@stable
- name: "Run test script"
run: ./contrib/run_task.sh stable

integrations-tests:
name: Integration Tests
runs-on: ubuntu-latest
strategy:
matrix:
rust: [stable]
bitcoinversion:
[
"0.18.0",
"0.18.1",
"0.19.0.1",
"0.19.1",
"0.20.0",
"0.20.1",
"0.21.0",
]
steps:
- name: Checkout Crate
uses: actions/checkout@v2
- name: Checkout Toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- name: Running test script
env:
BITCOINVERSION: ${{ matrix.bitcoinversion }}
run: ./contrib/test.sh
Nightly:
name: Test - nightly toolchain
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: "Checkout repo"
uses: actions/checkout@v4
- name: "Select toolchain"
uses: dtolnay/rust-toolchain@nightly
- name: "Run test script"
run: ./contrib/run_task.sh nightly

MSRV:
name: Test - 1.56.1 toolchain
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: "Checkout repo"
uses: actions/checkout@v4
- name: "Select toolchain"
uses: dtolnay/rust-toolchain@stable
with:
toolchain: "1.56.1"
- name: "Run test script"
run: ./contrib/run_task.sh msrv

Format:
name: Format - nightly toolchain
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: "Checkout repo"
uses: actions/checkout@v4
- name: "Select toolchain"
uses: dtolnay/rust-toolchain@nightly
- name: "Install rustfmt"
run: rustup component add rustfmt
- name: "Check formatting"
run: cargo +nightly fmt --all -- --check

Integration:
name: Integration Tests - stable toolchain
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
bitcoin_version:
[
"0.18.0",
"0.18.1",
"0.19.0.1",
"0.19.1",
"0.20.0",
"0.20.1",
"0.21.0",
]
steps:
- name: "Checkout repo"
uses: actions/checkout@v4
- name: "Select toolchain"
uses: dtolnay/rust-toolchain@stable
- name: Running test script
run: ./contrib/run_task.sh integration ${{ matrix.bitcoin_version }}
13 changes: 10 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Unreleased

- MSRV changed from 1.48.0 to 1.56.1
# 0.19.0

- Change MSRV from 1.48.0 to 1.56.1 [#334](https://github.com/rust-bitcoin/rust-bitcoincore-rpc/pull/334)
- Implement `verifymessage` RCP call (and add "verifymessage" feature)
- [#326](https://github.com/rust-bitcoin/rust-bitcoincore-rpc/pull/326)
- [#343](https://github.com/rust-bitcoin/rust-bitcoincore-rpc/pull/343)
- Upgrade `bitcoin` dependency to `v0.32.0` [#337](https://github.com/rust-bitcoin/rust-bitcoincore-rpc/pull/337)
- Upgrade `jsonrpc` dependency to `v0.18.0` [#339](https://github.com/rust-bitcoin/rust-bitcoincore-rpc/pull/339)
- Use `jsonrpc` "minreq_http" feature [#341](https://github.com/rust-bitcoin/rust-bitcoincore-rpc/pull/341)
- Add "rand" feature [#342](https://github.com/rust-bitcoin/rust-bitcoincore-rpc/pull/342)

# 0.18.0

Expand Down
8 changes: 2 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
[workspace]

members = [
"json",
"client",
"integration_test",
]
members = ["client", "json", "integration_test"]
resolver = "2"
29 changes: 19 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
[![Status](https://travis-ci.org/rust-bitcoin/rust-bitcoincore-rpc.png?branch=master)](https://travis-ci.org/rust-bitcoin/rust-bitcoincore-rpc)

# Rust RPC client for Bitcoin Core JSON-RPC

This crate is explicitly provided for integration testing, it is not designed to be used in production systems.

This is a Rust RPC client library for calling the Bitcoin Core JSON-RPC API. It provides a layer of abstraction over
[rust-jsonrpc](https://github.com/apoelstra/rust-jsonrpc) and makes it easier to talk to the Bitcoin JSON-RPC interface
[rust-jsonrpc](https://github.com/apoelstra/rust-jsonrpc) and makes it easier to talk to the Bitcoin JSON-RPC interface.

`rust-jsonrpc` will never be `async`, therefore neither will this crate.

This git package compiles into two crates.
1. [bitcoincore-rpc](https://crates.io/crates/bitcoincore-rpc) - contains an implementation of an rpc client that exposes
the Bitcoin Core JSON-RPC APIs as rust functions.
1. `core-rpc` - contains an implementation of an rpc client that exposes the Bitcoin Core JSON-RPC APIs as rust functions.

2. `core-rpc-json` - contains rust data structures that represent the json responses from the
Bitcoin Core JSON-RPC APIs. bitcoincore-rpc depends on this.

2. [bitcoincore-rpc-json](https://crates.io/crates/bitcoincore-rpc-json) - contains rust data structures that represent
the json responses from the Bitcoin Core JSON-RPC APIs. bitcoincore-rpc depends on this.
## Usage

# Usage
Given below is an example of how to connect to the Bitcoin Core JSON-RPC for a Bitcoin Core node running on `localhost`
and print out the hash of the latest block.

Expand All @@ -36,7 +38,8 @@ fn main() {

See `client/examples/` for more usage examples.

# Supported Bitcoin Core Versions
## Supported Bitcoin Core Versions

The following versions are officially supported and automatically tested:
* 0.18.0
* 0.18.1
Expand All @@ -46,5 +49,11 @@ The following versions are officially supported and automatically tested:
* 0.20.1
* 0.21.0

# Minimum Supported Rust Version (MSRV)
## Minimum Supported Rust Version (MSRV)

This library should always compile with any combination of features on **Rust 1.56.1**.

## Licensing

The code in this project is licensed under the [Creative Commons CC0 1.0 Universal license](LICENSE).
We use the [SPDX license list](https://spdx.org/licenses/) and [SPDX IDs](https://spdx.dev/ids/).
11 changes: 0 additions & 11 deletions client/CHANGELOG.md

This file was deleted.

30 changes: 20 additions & 10 deletions client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,33 +1,43 @@
[package]
name = "bitcoincore-rpc"
version = "0.18.0"
version = "0.19.0"
authors = [
"Steven Roose <[email protected]>",
"Jean Pierre Dudey <[email protected]>",
"Dawid Ciężarkiewicz <[email protected]>",
"Tobin C. Harding <[email protected]>",
]
license = "CC0-1.0"
homepage = "https://github.com/rust-bitcoin/rust-bitcoincore-rpc/"
repository = "https://github.com/rust-bitcoin/rust-bitcoincore-rpc/"
description = "RPC client library for the Bitcoin Core JSON-RPC API."
keywords = ["crypto", "bitcoin", "bitcoin-core", "rpc"]
readme = "README.md"
edition = "2018"
edition = "2021"
rust-version = "1.56.1"
exclude = ["integration_test"]

[lib]
name = "bitcoincore_rpc"
path = "src/lib.rs"
[features]
verifymessage = ["bitcoincore-rpc-json/verifymessage"]
rand = ["bitcoincore-rpc-json/rand"]

[dependencies]
bitcoincore-rpc-json = { version = "0.18.0", path = "../json" }
bitcoincore-rpc-json = { path = "../json" }

log = "0.4.5"
jsonrpc = "0.14.0"
jsonrpc = { version = "0.18.0", features = ["minreq_http"] }

# Used for deserialization of JSON.
serde = "1"
serde_json = "1"
serde = "1.0.156"
serde_json = "1.0.96"

[dev-dependencies]
tempfile = "3.3.0"
tempfile = "3.6.0"

[[example]]
name = "retry_client"
required-features = ["verifymessage"]

[[example]]
name = "test_against_node"
required-features = []
5 changes: 2 additions & 3 deletions client/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
bitcoincore-rpc
===============
# bitcoincore-rpc

Rust client library for the Bitcoin Core daemon's JSON-RPC API.

Expand All @@ -11,6 +10,6 @@ in the interface of this crate.

please see the parent README for the current MSRV.

# License
## License

All code is licensed using the CC0 license, as per the LICENSE file.
10 changes: 1 addition & 9 deletions client/examples/retry_client.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
// To the extent possible under law, the author(s) have dedicated all
// copyright and related and neighboring rights to this software to
// the public domain worldwide. This software is distributed without
// any warranty.
//
// You should have received a copy of the CC0 Public Domain Dedication
// along with this software.
// If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
//
// SPDX-License-Identifier: CC0-1.0

extern crate bitcoincore_rpc;
extern crate jsonrpc;
Expand Down
15 changes: 4 additions & 11 deletions client/examples/test_against_node.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
// To the extent possible under law, the author(s) have dedicated all
// copyright and related and neighboring rights to this software to
// the public domain worldwide. This software is distributed without
// any warranty.
//
// You should have received a copy of the CC0 Public Domain Dedication
// along with this software.
// If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
//
// SPDX-License-Identifier: CC0-1.0

//! A very simple example used as a self-test of this library against a Bitcoin
//! Core node.
Expand Down Expand Up @@ -37,8 +29,9 @@ fn main_result() -> Result<(), Error> {

let bitcoin_block: bitcoin::Block = rpc.get_by_id(&best_block_hash)?;
println!("best block hash by `get`: {}", bitcoin_block.header.prev_blockhash);
let bitcoin_tx: bitcoin::Transaction = rpc.get_by_id(&bitcoin_block.txdata[0].txid())?;
println!("tx by `get`: {}", bitcoin_tx.txid());
let bitcoin_tx: bitcoin::Transaction =
rpc.get_by_id(&bitcoin_block.txdata[0].compute_txid())?;
println!("tx by `get`: {}", bitcoin_tx.compute_txid());

Ok(())
}
Expand Down
Loading