Library with support for de/serialization, parsing and executing on data-structures and network messages related to Bitcoin and Dogecoin.
This library is a fork of rust-bitcoin, adapted to support the Dogecoin network. For reference, see the original rust-bitcoin README.
The goal of this project is to provide Dogecoin-compatible types, consensus rules, and utilities, following the architecture of rust-bitcoin, in particular:
- Scrypt PoW: Scrypt-based proof-of-work validation (instead of SHA-256d used in Bitcoin)
- AuxPoW/Merged Mining: AuxPow validation and Dogecoin's merged mining with other chains
- Difficulty Adjustment: Dogecoin difficulty adjustment algorithms (pre-Digishield and Digishield)
- Network Parameters: Consensus parameters for mainnet, testnet, and regtest
- Addresses: Dogecoin-specific base58 addresses (P2PKH and P2SH)
- Genesis Blocks: Genesis block definitions for mainnet, testnet, and regtest
The following core files have been modified from the upstream rust-bitcoin library:
-
bitcoin/src/blockdata/block.rs: Add scrypt-based proof-of-work validation (block_hash_with_scrypt()andvalidate_pow_with_scrypt()) to support Dogecoin's scrypt hashing algorithm. -
bitcoin/src/pow.rs: Implement Dogecoin's difficulty adjustment algorithms:- Pre-Digishield (blocks 0-144,999) with variable transition thresholds based on block height ranges
- Digishield (blocks 145,000+)
- Helper methods
min_transition_threshold_dogecoin()andmax_transition_threshold_dogecoin()for proper difficulty bounds
-
bitcoin/src/p2p/message.rs: GenericRawNetworkMessageandNetworkMessageoverHeaderandBlocktypes to support both Bitcoin and Dogecoin block and header formats (which can include AuxPoW information).
2. Dogecoin-Specific module (bitcoin/src/dogecoin/)
A Dogecoin module has been added with the following components:
-
mod.rs: Dogecoin types including:Header: Dogecoin block header with optional AuxPoW informationBlock: Dogecoin block structure supporting both legacy and merged-mined blocksNetwork: Dogecoin network enum (mainnet, testnet, regtest)
-
auxpow.rs: Implementation of Auxiliary Proof-of-Work (merged mining) validation -
params.rs: Dogecoin consensus parameters for all networks (mainnet, testnet, regtest), such as Digishield and AuxPoW activation height, BIP activation heights, target spacing, max attainable targets, etc -
constants.rs: Dogecoin-specific constants, such as Genesis block definition, and address prefixes -
address/: Dogecoin address handling with support for P2PKH and P2SH address types
Note: Advanced Bitcoin features such as Taproot, SegWit v1, and PSBT v2 are not applicable to Dogecoin and are not supported in this fork.
This library should always compile with any combination of features on Rust 1.56.1.
To build with the MSRV you will likely need to pin a bunch of dependencies, see ./contrib/test.sh
for the current list.
This project is a fork of rust-bitcoin, originally licensed under CC0 v1.0 Universal.
This fork is licensed under the Apache License, Version 2.0, except where otherwise noted.
We use the SPDX license list and SPDX IDs.