Skip to content

Commit 25f2814

Browse files
committed
Merge remote-tracking branch 'rpc/master'
2 parents 051501c + e87845a commit 25f2814

26 files changed

+8111
-11
lines changed

.editorconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# see https://editorconfig.org for more options, and setup instructions for yours editor
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 4

.github/workflows/rust.yml

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- rust: nightly
2323
env:
2424
# TODO: running with DO_BENCH: true causes the test to fail
25-
# DO_BENCH: true
25+
# DO_BENCH: true
2626
AS_DEPENDENCY: true
2727
DO_NO_STD: false
2828
DO_DOCS: true
@@ -86,3 +86,61 @@ jobs:
8686
# run: cd hashes/embedded && cargo run --target thumbv7m-none-eabi
8787
# - name: Run hashes/embedded with alloc
8888
# run: cd hashes/embedded && cargo run --target thumbv7m-none-eabi --features=alloc
89+
90+
rpc-tests:
91+
name: Tests
92+
runs-on: ubuntu-latest
93+
strategy:
94+
matrix:
95+
include:
96+
- rust: stable
97+
env:
98+
RUSTFMTCHK: true
99+
- rust: nightly
100+
env:
101+
RUSTFMTCHK: false
102+
- rust: 1.29.0
103+
env:
104+
PIN_VERSIONS: true
105+
steps:
106+
- name: Checkout Crate
107+
uses: actions/checkout@v2
108+
- name: Checkout Toolchain
109+
uses: actions-rs/toolchain@v1
110+
with:
111+
profile: minimal
112+
toolchain: ${{ matrix.rust }}
113+
override: true
114+
- name: Running test script
115+
env: ${{ matrix.env }}
116+
run: ./contrib/test.sh
117+
118+
integrations-tests:
119+
name: Integration Tests
120+
runs-on: ubuntu-latest
121+
strategy:
122+
matrix:
123+
rust: [stable]
124+
bitcoinversion:
125+
[
126+
"0.18.0",
127+
"0.18.1",
128+
"0.19.0.1",
129+
"0.19.1",
130+
"0.20.0",
131+
"0.20.1",
132+
"0.21.0",
133+
]
134+
steps:
135+
- name: Checkout Crate
136+
uses: actions/checkout@v2
137+
- name: Checkout Toolchain
138+
uses: actions-rs/toolchain@v1
139+
with:
140+
profile: minimal
141+
toolchain: ${{ matrix.rust }}
142+
override: true
143+
- name: Running test script
144+
env:
145+
BITCOINVERSION: ${{ matrix.bitcoinversion }}
146+
run: ./contrib/test.sh

.rustfmt.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
use_small_heuristics = "Off"

CHANGELOG.md

Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,3 +353,189 @@ See `Transaction::verify` and `Script::verify` methods.
353353

354354
* Remove `num` dependency at Matt's request; agree this is obnoxious to require all
355355
downstream users to also have a `num` dependency just so they can use `Uint256::from_u64`.
356+
357+
### Dashcore RPC
358+
359+
# 0.15.0
360+
361+
- bump bitcoin crate version to 0.28.0
362+
- add `get_block_stats`
363+
- add `add_node`
364+
- add `remove_node`
365+
- add `onetry_node`
366+
- add `disconnect_node`
367+
- add `disconnect_node_by_id`
368+
- add `get_added_node_info`
369+
- add `get_node_addresses`
370+
- add `list_banned`
371+
- add `clear_banned`
372+
- add `add_ban`
373+
- add `remove_ban`
374+
- make `Auth::get_user_pass` public
375+
- add `ScriptPubkeyType::witness_v1_taproot`
376+
377+
# 0.14.0
378+
379+
- add `wallet_conflicts` field in `WalletTxInfo`
380+
- add `get_chain_tips`
381+
- add `get_block_template`
382+
- implement `From<u64>` and `From<Option<u64>>` for `ImportMultiRescanSince`
383+
- bump rust-bitcoin dependency to 0.27
384+
- bump json-rpc dependency to 0.12.0
385+
- remove dependency on `hex`
386+
387+
# 0.13.0
388+
389+
- add `wallet_process_psbt`
390+
- add `unlock_unspent_all`
391+
- compatibility with Bitcoin Core v0.21
392+
- bump rust-bitcoin dependency to 0.26
393+
- implement Deserialize for ImportMultiRescanSince
394+
- some fixes for some negative confirmation values
395+
396+
# 0.12.0
397+
398+
- bump `bitcoin` dependency to version `0.25`, increasing our MSRV to `1.29.0`
399+
- test against `bitcoind` `0.20.0` and `0.20.1`
400+
- add `get_balances`
401+
- add `get_mempool_entry`
402+
- add `list_since_block`
403+
- add `get_mempool_entry`
404+
- add `list_since_block`
405+
- add `uptime`
406+
- add `get_network_hash_ps`
407+
- add `get_tx_out_set_info`
408+
- add `get_net_totals`
409+
- partially implement `scantxoutset`
410+
- extend `create_wallet` and related APIs
411+
- extend `GetWalletInfoResult`
412+
- extend `WalletTxInfo`
413+
- extend testsuite
414+
- fix `GetPeerInfoResult`
415+
- fix `GetNetworkInfoResult`
416+
- fix `GetTransactionResultDetailCategory`
417+
- fix `GetMempoolEntryResult` for bitcoind prior to `0.19.0`
418+
- fix `GetBlockResult` and `GetBlockHeaderResult`
419+
420+
# 0.11.0
421+
422+
- fix `minimum_sum_amount` field name in `ListUnspentQueryOptions`
423+
- add missing "orphan" variant for `GetTransactionResultDetailCategory`
424+
- add `ImportMultiRescanSince` to support "now" for `importmulti`'s
425+
`timestamp` parameter
426+
- rename logging target to `bitcoincore_rpc` instead of `bitcoincore_rpc::client`
427+
- other logging improvements
428+
429+
# 0.10.0
430+
431+
- rename `dump_priv_key` -> `dump_private_key` + change return type
432+
- rename `get_block_header_xxx` methods to conform with `get_block_xxx` methods
433+
- rename `get_raw_transaction_xxx` methods to conform with `get_block_xxx` methods
434+
- rename `GetBlockHeaderResult` fields
435+
- rename `GetMiningInfoResult` fields
436+
- represent difficulty values as `f64` instead of `BigUint`
437+
- fix `get_peer_info`
438+
- fix `get_transaction`
439+
- fix `get_balance`
440+
- fix `get_blockchain_info` and make compatible with both 0.18 and 0.19
441+
- fix `get_address_info`
442+
- fix `send_to_address`
443+
- fix `estimate_smart_fee`
444+
- fix `import_private_key`
445+
- fix `list_received_by_address`
446+
- fix `import_address`
447+
- fix `finalize_psbt`
448+
- fix `fund_raw_transaction`
449+
- fix `test_mempool_accept`
450+
- fix `stop`
451+
- fix `rescan_blockchain`
452+
- add `import_address_script`
453+
- add `get_network_info`
454+
- add `version`
455+
- add `Error::UnexpectedStructure`
456+
- add `GetTransactionResultDetailCategory::Immature`
457+
- make `list_unspent` more ergonomic
458+
- made all exported enum types implement `Copy`
459+
- export `jsonrpc` dependency.
460+
- remove `num_bigint` dependency
461+
462+
# v0.9.1
463+
464+
- Add `wallet_create_funded_psbt`
465+
- Add `get_descriptor_info`
466+
- Add `combine_psbt`
467+
- Add `derive_addresses`
468+
- Add `finalize_psbt`
469+
- Add `rescan_blockchain`
470+
471+
# v0.7.0
472+
473+
- use `bitcoin::PublicKey` instead of `secp256k1::PublicKey`
474+
- fix get_mining_info result issue
475+
- fix test_mempool_accept issue
476+
- fix get_transaction result issues
477+
- fix bug in fund_raw_transaction
478+
- add list_transactions
479+
- add get_raw_mempool
480+
- add reconsider_block
481+
- add import_multi
482+
- add import_public_key
483+
- add set_label
484+
- add lock_unspent
485+
- add unlock_unspent
486+
- add create_wallet
487+
- add load_wallet
488+
- add unload_wallet
489+
- increased log level for requests to debug
490+
491+
# v0.6.0
492+
493+
- polish Auth to use owned Strings
494+
- fix using Amount type and Address types where needed
495+
- use references of sha256d::Hashes instead of owned/copied
496+
497+
# v0.5.1
498+
499+
- add get_tx_out_proof
500+
- add import_address
501+
- add list_received_by_address
502+
503+
# v0.5.0
504+
505+
- add support for cookie authentication
506+
- add fund_raw_transaction command
507+
- deprecate sign_raw_transaction
508+
- use PrivateKey type for calls instead of string
509+
- fix for sign_raw_transaction
510+
- use 32-bit integers for confirmations, signed when needed
511+
512+
# v0.4.0
513+
514+
- add RawTx trait for commands that take raw transactions
515+
- update jsonrpc dependency to v0.11.0
516+
- fix for create_raw_transaction
517+
- fix for send_to_address
518+
- fix for get_new_address
519+
- fix for get_tx_out
520+
- fix for get_raw_transaction_verbose
521+
- use `secp256k1::SecretKey` type in API
522+
523+
# v0.3.0
524+
525+
- removed the GetTransaction and GetScript traits
526+
(those methods are now directly implemented on types)
527+
- introduce RpcApi trait
528+
- use bitcoin_hashes library
529+
- add signrawtransactionwithkey command
530+
- add testmempoolaccept command
531+
- add generate command
532+
- improve hexadecimal byte value representation
533+
- bugfix getrawtransaction (support coinbase txs)
534+
- update rust-bitcoin dependency v0.16.0 -> v0.18.0
535+
- add RetryClient example
536+
537+
# v0.2.0
538+
539+
- add send_to_address command
540+
- add create_raw_transaction command
541+
- Client methods take self without mut

Cargo.toml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,22 @@
22
members = ["dash", "hashes", "internals", "fuzz"]
33
resolver = "2"
44

5+
6+
57
[patch.crates-io.dashcore_hashes]
68
path = "hashes"
9+
10+
11+
[workspace]
12+
13+
members = [
14+
"json",
15+
"client",
16+
"integration_test",
17+
]
18+
19+
20+
21+
[workspace.package]
22+
version = "0.17.0"
23+

README.md

Lines changed: 59 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<img alt="Rust Dash logo by Rostislav Gorbachenko, UX engineer at Dash Core Group, see license and source files under /logo" src="./logo/rust-dash-together.png" width="300" />
55

66
<p>Library with support for de/serialization, parsing and executing on data-structures
7-
and network messages related to Dash Core payment chain.
7+
and network messages related to Dash Core payment chain. Core RPC client.
88
</p>
99

1010
<p>
@@ -29,36 +29,85 @@ Supports (or should support)
2929
* Private keys and address creation, de/serialization and validation (including full BIP32 support)
3030
* PSBT creation, manipulation, merging and finalization
3131
* Pay-to-contract support as in Appendix A of the [Blockstream sidechains whitepaper](https://www.blockstream.com/sidechains.pdf)
32+
* JSONRPC interaction with Dash Core
3233

33-
For JSONRPC interaction with Dash Core, it is recommended to use
34-
[rust-dashcore-rpc](https://github.com/dashevo/rust-dashcore-rpc).
34+
# Known limitations
3535

36-
## Known limitations
37-
38-
### Consensus
36+
## Consensus
3937

4038
This library **must not** be used for consensus code (i.e. fully validating
4139
blockchain data). It technically supports doing this, but doing so is very
4240
ill-advised because there are many deviations, known and unknown, between
4341
this library and the Dash Core reference implementation. In a consensus
4442
based cryptocurrency such as Dash it is critical that all parties are
45-
using the same rules to validate data, and this library does not and might
43+
using the same rules to validate data, and this library does not and might
4644
never implement the same rules as Core.
4745

4846
Given the complexity of both C++ and Rust, it is unlikely that this will
4947
ever be fixed, and there are no plans to do so. Of course, patches to
5048
fix specific consensus incompatibilities are welcome.
5149

52-
### Support for 16-bit pointer sizes
50+
## Support for 16-bit pointer sizes
5351

5452
16-bit pointer sizes are not supported and we can't promise they will be.
5553
It will be dependent on rust-bitcoin implementing them first.
5654

57-
## Documentation
55+
# Usage
56+
Given below is an example of how to connect to the Dash Core JSON-RPC for a Dash Core node running on `localhost`
57+
and print out the hash of the latest block.
58+
59+
It assumes that the node has password authentication setup, the RPC interface is enabled at port `8332` and the node
60+
is set up to accept RPC connections.
61+
62+
```rust
63+
extern crate dashcore_rpc;
64+
65+
use dashcore_rpc::{Auth, Client, RpcApi};
66+
67+
fn main() {
68+
69+
let rpc = Client::new(
70+
"localhost:19998",
71+
Auth::UserPass("<FILL RPC USERNAME>".to_string(),
72+
"<FILL RPC PASSWORD>".to_string())).unwrap();
73+
let best_block_hash = rpc.get_best_block_hash().unwrap();
74+
println!("best block hash: {}", best_block_hash);
75+
}
76+
```
77+
78+
See `client/examples/` for more usage examples.
79+
80+
# Supported Dash Core Versions
81+
The following versions are officially supported and automatically tested:
82+
* 0.18.0
83+
* 0.18.1
84+
* 0.19.0.1
85+
* 0.19.1
86+
* 0.20.0
87+
* 0.20.1
88+
* 0.21.0
89+
90+
# Minimum Supported Rust Version (MSRV)
91+
This library should always compile with any combination of features on **Rust 1.29**.
92+
93+
Because some dependencies have broken the build in minor/patch releases, to
94+
compile with 1.29.0 you will need to run the following version-pinning command:
95+
```
96+
cargo update --package "cc" --precise "1.0.41"
97+
cargo update --package "log:0.4.x" --precise "0.4.13" # x being the highest patch version, currently 14
98+
cargo update --package "cfg-if" --precise "0.1.9"
99+
cargo update --package "serde_json" --precise "1.0.39"
100+
cargo update --package "serde" --precise "1.0.98"
101+
cargo update --package "serde_derive" --precise "1.0.98"
102+
cargo update --package "byteorder" --precise "1.3.4"
103+
```
104+
105+
106+
# Documentation
58107

59108
Documentation can be found on [dashcore.readme.io/docs](https://dashcore.readme.io/docs).
60109

61-
## Contributing
110+
# Contributing
62111

63112
Contributions are generally welcome. If you intend to make larger changes please
64113
discuss them in an issue before PRing them to avoid duplicate work and

0 commit comments

Comments
 (0)