12 releases
0.1.12 | Jul 31, 2024 |
---|---|
0.1.11 | Jul 19, 2024 |
0.1.8 | Apr 2, 2024 |
0.1.7 | Dec 22, 2023 |
0.1.0 | Apr 30, 2021 |
#90 in #input-output
682 downloads per month
175KB
2.5K
SLoC
rawtx-rs
A rust-bitcoin based crate making information about Bitcoin transactions accessible.
This includes, for example:
- Detecting input and output types
- SegWit and MulitSig spending
- Explicit BIP-125 Opt In RBF signaling
- BIP-69 compliant
- and more..
In its current state, this crate should be considerd as 'unfinished' and 'under development'.
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
lib.rs
:
rawtx-rs makes information about Bitcoin transactions accessible.
Examples
// The first Bitcoin mainnet transaction between Satoshi and Hal
// f4184fc596403b9d638783cf57adfe4c75c605f6356fbc91338530e9831e9e16
// as rust-bitcoin's bitcoin::Transaction.
let tx_info = tx::TxInfo::new(&tx).unwrap();
assert_eq!(tx_info.input_infos[0].in_type, input::InputType::P2pk);
assert_eq!(tx_info.output_infos[0].out_type, output::OutputType::P2pk);
assert_eq!(tx_info.output_infos[1].out_type, output::OutputType::P2pk);
assert!(!tx_info.is_spending_segwit());
assert!(tx_info.is_bip69_compliant());
// Random mainnet transaction spending SegWit and MultiSig
// 7874eb36dfff6d4d38f9dbe013bceed0c31de4da1dee4a507b9abd0540aa0af4
// as rust-bitcoin's bitcoin::Transaction.
let tx_info = tx::TxInfo::new(&tx).unwrap();
assert_eq!(tx_info.input_infos[0].in_type, input::InputType::P2shP2wsh);
assert_eq!(tx_info.output_infos[0].out_type, output::OutputType::P2sh);
assert_eq!(tx_info.output_infos[1].out_type, output::OutputType::P2sh);
assert!(tx_info.is_spending_segwit());
assert!(tx_info.is_bip69_compliant());
assert!(tx_info.is_signaling_explicit_rbf_replicability());
assert!(tx_info.is_spending_multisig());
let multisig_info = tx_info.input_infos[0].multisig_info.as_ref().unwrap();
// 2 of 4 multisig
assert_eq!(multisig_info.m_of_n, (2, 4));
Dependencies
~7MB
~87K SLoC