Skip to content

Commit

Permalink
init: project initalize
Browse files Browse the repository at this point in the history
  • Loading branch information
Xavier committed Jun 19, 2024
1 parent 4032d04 commit 925b409
Show file tree
Hide file tree
Showing 25 changed files with 6,006 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# see https://editorconfig.org for more options, and setup instructions for yours editor

[*]
indent_style = space
indent_size = 4
63 changes: 63 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
on: [push, 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.41.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
- run: cargo update -p serde --precise 1.0.152
- name: Running test script
env: ${{ matrix.env }}
run: ./contrib/test.sh

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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
target
Cargo.lock
1 change: 1 addition & 0 deletions .rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use_small_heuristics = "Off"
206 changes: 206 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
# 0.17.0

- add `list_wallet_dir` rpc
- add `join_psbt` rpc
- add `get_raw_change_address` rpc
- add `create_psbt` rpc
- add `combine_raw_transaction` rpc
- add `decode_raw_transaction` rpc
- add `import_descriptors` rpc
- add `get_mempool_info` rpc
- add `get_index_info` rpc
- change return type of `unload_wallet`
- update `jsonrpc` dependency to 0.14.0
- update `bitcoin` dependency to 0.30.0

# 0.16.0

- MSRV changed from 1.29 to 1.41.1
- bump bitcoin crate version to 0.29.0
- moved to Rust edition 2018
- make get_tx_out_set_info compatible with v22+
- add `submit_block`, `submit_block_bytes`, `submit_block_hex`

# 0.15.0

- bump bitcoin crate version to 0.28.0
- add `get_block_stats`
- add `add_node`
- add `remove_node`
- add `onetry_node`
- add `disconnect_node`
- add `disconnect_node_by_id`
- add `get_added_node_info`
- add `get_node_addresses`
- add `list_banned`
- add `clear_banned`
- add `add_ban`
- add `remove_ban`
- make `Auth::get_user_pass` public
- add `ScriptPubkeyType::witness_v1_taproot`

# 0.14.0

- add `wallet_conflicts` field in `WalletTxInfo`
- add `get_chain_tips`
- add `get_block_template`
- implement `From<u64>` and `From<Option<u64>>` for `ImportMultiRescanSince`
- bump rust-bitcoin dependency to 0.27
- bump json-rpc dependency to 0.12.0
- remove dependency on `hex`

# 0.13.0

- add `wallet_process_psbt`
- add `unlock_unspent_all`
- compatibility with Bitcoin Core v0.21
- bump rust-bitcoin dependency to 0.26
- implement Deserialize for ImportMultiRescanSince
- some fixes for some negative confirmation values

# 0.12.0

- bump `bitcoin` dependency to version `0.25`, increasing our MSRV to `1.29.0`
- test against `bitcoind` `0.20.0` and `0.20.1`
- add `get_balances`
- add `get_mempool_entry`
- add `list_since_block`
- add `get_mempool_entry`
- add `list_since_block`
- add `uptime`
- add `get_network_hash_ps`
- add `get_tx_out_set_info`
- add `get_net_totals`
- partially implement `scantxoutset`
- extend `create_wallet` and related APIs
- extend `GetWalletInfoResult`
- extend `WalletTxInfo`
- extend testsuite
- fix `GetPeerInfoResult`
- fix `GetNetworkInfoResult`
- fix `GetTransactionResultDetailCategory`
- fix `GetMempoolEntryResult` for bitcoind prior to `0.19.0`
- fix `GetBlockResult` and `GetBlockHeaderResult`

# 0.11.0

- fix `minimum_sum_amount` field name in `ListUnspentQueryOptions`
- add missing "orphan" variant for `GetTransactionResultDetailCategory`
- add `ImportMultiRescanSince` to support "now" for `importmulti`'s
`timestamp` parameter
- rename logging target to `bitcoincore_rpc` instead of `bitcoincore_rpc::client`
- other logging improvements

# 0.10.0

- rename `dump_priv_key` -> `dump_private_key` + change return type
- rename `get_block_header_xxx` methods to conform with `get_block_xxx` methods
- rename `get_raw_transaction_xxx` methods to conform with `get_block_xxx` methods
- rename `GetBlockHeaderResult` fields
- rename `GetMiningInfoResult` fields
- represent difficulty values as `f64` instead of `BigUint`
- fix `get_peer_info`
- fix `get_transaction`
- fix `get_balance`
- fix `get_blockchain_info` and make compatible with both 0.18 and 0.19
- fix `get_address_info`
- fix `send_to_address`
- fix `estimate_smart_fee`
- fix `import_private_key`
- fix `list_received_by_address`
- fix `import_address`
- fix `finalize_psbt`
- fix `fund_raw_transaction`
- fix `test_mempool_accept`
- fix `stop`
- fix `rescan_blockchain`
- add `import_address_script`
- add `get_network_info`
- add `version`
- add `Error::UnexpectedStructure`
- add `GetTransactionResultDetailCategory::Immature`
- make `list_unspent` more ergonomic
- made all exported enum types implement `Copy`
- export `jsonrpc` dependency.
- remove `num_bigint` dependency

# v0.9.1

- Add `wallet_create_funded_psbt`
- Add `get_descriptor_info`
- Add `combine_psbt`
- Add `derive_addresses`
- Add `finalize_psbt`
- Add `rescan_blockchain`

# v0.7.0

- use `bitcoin::PublicKey` instead of `secp256k1::PublicKey`
- fix get_mining_info result issue
- fix test_mempool_accept issue
- fix get_transaction result issues
- fix bug in fund_raw_transaction
- add list_transactions
- add get_raw_mempool
- add reconsider_block
- add import_multi
- add import_public_key
- add set_label
- add lock_unspent
- add unlock_unspent
- add create_wallet
- add load_wallet
- add unload_wallet
- increased log level for requests to debug

# v0.6.0

- polish Auth to use owned Strings
- fix using Amount type and Address types where needed
- use references of sha256d::Hashes instead of owned/copied

# v0.5.1

- add get_tx_out_proof
- add import_address
- add list_received_by_address

# v0.5.0

- add support for cookie authentication
- add fund_raw_transaction command
- deprecate sign_raw_transaction
- use PrivateKey type for calls instead of string
- fix for sign_raw_transaction
- use 32-bit integers for confirmations, signed when needed

# v0.4.0

- add RawTx trait for commands that take raw transactions
- update jsonrpc dependency to v0.11.0
- fix for create_raw_transaction
- fix for send_to_address
- fix for get_new_address
- fix for get_tx_out
- fix for get_raw_transaction_verbose
- use `secp256k1::SecretKey` type in API

# v0.3.0

- removed the GetTransaction and GetScript traits
(those methods are now directly implemented on types)
- introduce RpcApi trait
- use bitcoin_hashes library
- add signrawtransactionwithkey command
- add testmempoolaccept command
- add generate command
- improve hexadecimal byte value representation
- bugfix getrawtransaction (support coinbase txs)
- update rust-bitcoin dependency v0.16.0 -> v0.18.0
- add RetryClient example

# v0.2.0

- add send_to_address command
- add create_raw_transaction command
- Client methods take self without mut
10 changes: 10 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[workspace]

members = [
"json",
"client",
"integration_test",
]

[patch.crates-io]
bitcoin = { git = "https://github.com/SCV-Soft/rust-bgeo" }
50 changes: 50 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
[![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 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

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.

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
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.

It assumes that the node has password authentication setup, the RPC interface is enabled at port `8332` and the node
is set up to accept RPC connections.

```rust
extern crate bitcoincore_rpc;

use bitcoincore_rpc::{Auth, Client, RpcApi};

fn main() {

let rpc = Client::new("http://localhost:8332",
Auth::UserPass("<FILL RPC USERNAME>".to_string(),
"<FILL RPC PASSWORD>".to_string())).unwrap();
let best_block_hash = rpc.get_best_block_hash().unwrap();
println!("best block hash: {}", best_block_hash);
}
```

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

# Supported Bitcoin Core Versions
The following versions are officially supported and automatically tested:
* 0.18.0
* 0.18.1
* 0.19.0.1
* 0.19.1
* 0.20.0
* 0.20.1
* 0.21.0

# Minimum Supported Rust Version (MSRV)
This library should always compile with any combination of features on **Rust 1.41.1**.
11 changes: 11 additions & 0 deletions client/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CHANGELOG
=========

# v0.2.0

- updated dependencies:
- bitcoin: 0.15 -> 0.16
- secp256ka: 0.11 -> 0.12
- Client methods take `&self` instead of `&mut self`
- added `create_raw_transaction`
- updated `get_new_address` to Core 0.16 spec
30 changes: 30 additions & 0 deletions client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[package]
name = "ord-bitcoincore-rpc"
version = "0.17.2"
authors = [
"Steven Roose <[email protected]>",
"Jean Pierre Dudey <[email protected]>",
"Dawid Ciężarkiewicz <[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"

[lib]
name = "bitcoincore_rpc"
path = "src/lib.rs"

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

log = "0.4.5"
jsonrpc = "0.14.0"

# Used for deserialization of JSON.
serde = "1"
serde_json = "1"
bitcoin-private = "0.1.0"
Loading

0 comments on commit 925b409

Please sign in to comment.