Skip to content

refactor: bitcoin rpc porting #6329

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

Merged
merged 69 commits into from
Aug 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
bca8621
refactor: create BitcoinRpcClient, #6250
fdefelici Jul 7, 2025
85f3fe0
refactor: rpc list_unspent, #6250
fdefelici Jul 8, 2025
b61355a
test: add list_unspent mock test, #6250
fdefelici Jul 8, 2025
69cdc3e
refactor: extract rcp_transport module, #6250
fdefelici Jul 8, 2025
1121105
refactor: reviewed rpc endpoint, #6250
fdefelici Jul 9, 2025
4ce8085
refactor: add import_descriptor and get_descriptor_info, #6250
fdefelici Jul 9, 2025
b855f25
refactor: add stop rpc, #6250
fdefelici Jul 9, 2025
6164471
test: add rpc integration tests, #6250
fdefelici Jul 10, 2025
fed6853
test: add integration tests, #6250
fdefelici Jul 11, 2025
71e1c90
test: enhance bitcoin core controller to support custom arg, #6250
fdefelici Jul 11, 2025
27dd024
test: add get_transaction inte test, #6250
fdefelici Jul 11, 2025
6e824a4
fix: merge conflict with develop
fdefelici Jul 11, 2025
6d2d27c
test: improve descriptor tests, #6250
fdefelici Jul 12, 2025
5a0ea11
Merge branch 'develop' of https://github.com/fdefelici/stacks-core in…
fdefelici Jul 21, 2025
48400c9
chore: add docs for testing api, #6250
fdefelici Jul 21, 2025
d71dcd4
chore: add copyright, #6250
fdefelici Jul 21, 2025
14f8792
feat: complete rpc_transport implementation, #6250
fdefelici Jul 22, 2025
4bb1962
chore: improve rpc api and docs, #6250
fdefelici Jul 23, 2025
85ca874
chore: add docs, #6250
fdefelici Jul 23, 2025
f284412
test: add test for bitcoin rpc auth, #6250
fdefelici Jul 24, 2025
6d8a634
feat: add invalidate_block rpc, #6250
fdefelici Jul 24, 2025
523667a
feat: complete implementation and docs, #6250
fdefelici Jul 24, 2025
8d6fa55
chore: cleaning, #6250
fdefelici Jul 24, 2025
99c60dc
Merge branch 'develop' into refactor/bitcoin-rpc
fdefelici Jul 24, 2025
a7d3907
chore: make BitcoinCoreController::config private and update doc, #6250
fdefelici Jul 24, 2025
cc3a1db
chore: reorganize in rpc folder, #6250
fdefelici Jul 24, 2025
a29a8ac
test: configure integration tests with ignore and BITCOIND_TEST, #6250
fdefelici Jul 24, 2025
32f901e
chore: revert ParsedUTXO mod, #6250
fdefelici Jul 24, 2025
919e07b
refactor: move bitcoin_rpc_client test facilities in dedicated module…
fdefelici Jul 28, 2025
a0365c2
refactor: move tests module in its own file tests.rs, #6250
fdefelici Jul 28, 2025
70699f4
refactor: split rpc unit and integration tests, #6250
fdefelici Jul 28, 2025
cb84735
refactor: remove reqwest and use stacks http module, #6250
fdefelici Jul 28, 2025
50f0d69
test: improve error message, #6250
fdefelici Jul 28, 2025
c92c859
test: improve duplicate wallet creation, #6250
fdefelici Jul 29, 2025
795d412
crc: reorganize file structure, #6250
fdefelici Jul 30, 2025
ecb8f92
crc: update get_raw_transaction api, #6250
fdefelici Aug 5, 2025
129b6a4
crc: update generate_block api, #6250
fdefelici Aug 5, 2025
4c249d2
crc: update get_new_address api, #6250
fdefelici Aug 6, 2025
513bd17
crc: update send_to_address api, #6250
fdefelici Aug 6, 2025
bb11e0d
crc: update invalidate_block api, #6250
fdefelici Aug 6, 2025
dfb4ec0
crc: update get_blockchain_info api, #6250
fdefelici Aug 6, 2025
8e335b0
crc: update get_transaction api, #6250
fdefelici Aug 6, 2025
3f07344
crc: update generate_to_address api, #6250
fdefelici Aug 6, 2025
625794f
crc: update send_raw_transaction api, #6250
fdefelici Aug 7, 2025
a12e6e6
Merge branch 'develop' into refactor/bitcoin-rpc
fdefelici Aug 8, 2025
3e7cb27
Merge branch 'fix/clippy-issue' into refactor/bitcoin-rpc
fdefelici Aug 8, 2025
4114e6e
crc: update list_unspent api, #6250
fdefelici Aug 8, 2025
5224137
refactor: use Txid taking into account bitcoin endiness, #6250
fdefelici Aug 8, 2025
f42264a
test: add send_raw_transaction rebroadcast test, #6250
fdefelici Aug 11, 2025
2834f8c
crc: update get_block_hash api, #6250
fdefelici Aug 11, 2025
6e4d6f5
crc: RpcError expose punctual error types, #6250
fdefelici Aug 11, 2025
4426fe6
crc: error shortcut + thiserror, #6250
fdefelici Aug 11, 2025
791bd39
crc: use const for default max_fee_rate, #6250
fdefelici Aug 11, 2025
59a247f
crc: remove ssl argument + improve BitcoinRpcClientError, #6250
fdefelici Aug 11, 2025
881e5fd
crc: add utxo address field and improve test scenarios, #6250
fdefelici Aug 11, 2025
16ee5fd
crc: fix typo in test assertion, #6250
fdefelici Aug 12, 2025
ebf676b
crc: fix typo in RPC_VERSION const, #6250
fdefelici Aug 12, 2025
932a98c
Merge branch 'develop' into refactor/bitcoin-rpc
fdefelici Aug 12, 2025
68f3044
crc: fix list_unspent maximum_count unlimited default, #6250
fdefelici Aug 12, 2025
62260f6
crc: rpc error tag in doc, #6250
fdefelici Aug 13, 2025
98a66f4
crc: rpc transport tag in doc, #6250
fdefelici Aug 13, 2025
284577e
crc: BitcoinRcpClient::new comment, #6250
fdefelici Aug 13, 2025
062f83a
crc: list_unspent availability doc, #6250
fdefelici Aug 13, 2025
46ce0e4
crc: get_descriptor_info doc nit, #6250
fdefelici Aug 13, 2025
ec2db90
crc: import_descriptors doc nit, #6250
fdefelici Aug 13, 2025
2a95955
crc: import_descriptors response doc nit, #6250
fdefelici Aug 14, 2025
db9e9b9
Merge branch 'develop' into refactor/bitcoin-rpc
fdefelici Aug 14, 2025
2fd677b
refactor: using new BitcoinAddress::from_string supporting regtest hr…
fdefelici Aug 14, 2025
cff3c9b
refactor: remove duplication related to BitcoinAddress deserializatio…
fdefelici Aug 14, 2025
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
25 changes: 23 additions & 2 deletions stacks-common/src/deps_common/bitcoin/network/serialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ use std::{error, fmt, io};
use crate::address;
use crate::deps_common::bitcoin::network::encodable::{ConsensusDecodable, ConsensusEncodable};
use crate::deps_common::bitcoin::util::hash::Sha256dHash;
use crate::util::hash::to_hex as hex_encode;
use crate::util::hash::{hex_bytes, to_hex as hex_encode};
use crate::util::HexError;

/// Serialization error
#[derive(Debug)]
Expand Down Expand Up @@ -67,6 +68,8 @@ pub enum Error {
UnrecognizedNetworkCommand(String),
/// Unexpected hex digit
UnexpectedHexDigit(char),
/// Invalid hex input
InvalidHex(HexError),
}

impl fmt::Display for Error {
Expand Down Expand Up @@ -106,6 +109,7 @@ impl fmt::Display for Error {
write!(f, "unrecognized network command: {nwcmd}")
}
Error::UnexpectedHexDigit(ref d) => write!(f, "unexpected hex digit: {d}"),
Error::InvalidHex(ref e) => fmt::Display::fmt(e, f),
}
}
}
Expand All @@ -123,7 +127,8 @@ impl error::Error for Error {
| Error::UnsupportedWitnessVersion(..)
| Error::UnsupportedSegwitFlag(..)
| Error::UnrecognizedNetworkCommand(..)
| Error::UnexpectedHexDigit(..) => None,
| Error::UnexpectedHexDigit(..)
| Error::InvalidHex(..) => None,
}
}
}
Expand All @@ -142,6 +147,13 @@ impl From<io::Error> for Error {
}
}

#[doc(hidden)]
impl From<HexError> for Error {
fn from(error: HexError) -> Self {
Error::InvalidHex(error)
}
}

/// Objects which are referred to by hash
pub trait BitcoinHash {
/// Produces a Sha256dHash which can be used to refer to the object
Expand Down Expand Up @@ -193,6 +205,15 @@ where
}
}

/// Deserialize an object from a hex-encoded string
pub fn deserialize_hex<T>(data: &str) -> Result<T, Error>
where
for<'a> T: ConsensusDecodable<RawDecoder<Cursor<&'a [u8]>>>,
{
let bytes = hex_bytes(data)?;
deserialize(&bytes)
}

/// An encoder for raw binary data
pub struct RawEncoder<W> {
writer: W,
Expand Down
1 change: 1 addition & 0 deletions stacks-node/src/burnchains/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
pub mod bitcoin_regtest_controller;
pub mod mocknet_controller;
pub mod rpc;

use std::time::Instant;

Expand Down
Loading
Loading