diff --git a/.github/workflows/cron-daily-kani.yml b/.github/workflows/cron-daily-kani.yml index 9b1e7ecaf5..b1e69f5378 100644 --- a/.github/workflows/cron-daily-kani.yml +++ b/.github/workflows/cron-daily-kani.yml @@ -13,4 +13,4 @@ jobs: - name: 'Run Kani on your code.' uses: model-checking/kani-github-action@v1.1 with: - args: "--package bitcoin --package bitcoin-units" + args: "--package bitcoin-dogecoin --package bitcoin-units" diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index f251705458..5e851b6279 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -302,4 +302,4 @@ jobs: - name: "Build Kani proofs" uses: model-checking/kani-github-action@v1.1 with: - args: "--only-codegen --package bitcoin --package bitcoin-units" + args: "--only-codegen --package bitcoin-dogecoin --package bitcoin-units" diff --git a/Cargo-minimal.lock b/Cargo-minimal.lock index d838e74f39..1272ebdcff 100644 --- a/Cargo-minimal.lock +++ b/Cargo-minimal.lock @@ -46,7 +46,7 @@ dependencies = [ ] [[package]] -name = "bitcoin" +name = "bitcoin-dogecoin" version = "0.32.5-doge.0" dependencies = [ "base58ck", @@ -73,7 +73,7 @@ dependencies = [ name = "bitcoin-fuzz" version = "0.0.1" dependencies = [ - "bitcoin", + "bitcoin-dogecoin", "honggfuzz", "serde", "serde_cbor", diff --git a/Cargo-recent.lock b/Cargo-recent.lock index a0bbe752b6..a577965186 100644 --- a/Cargo-recent.lock +++ b/Cargo-recent.lock @@ -45,7 +45,7 @@ dependencies = [ ] [[package]] -name = "bitcoin" +name = "bitcoin-dogecoin" version = "0.32.5-doge.0" dependencies = [ "base58ck", @@ -72,7 +72,7 @@ dependencies = [ name = "bitcoin-fuzz" version = "0.0.1" dependencies = [ - "bitcoin", + "bitcoin-dogecoin", "honggfuzz", "serde", "serde_cbor", diff --git a/Cargo.toml b/Cargo.toml index 7cf9a0f32d..a0a4dbdc38 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ resolver = "2" [patch.crates-io.base58ck] path = "base58" -[patch.crates-io.bitcoin] +[patch.crates-io.bitcoin-dogecoin] path = "bitcoin" [patch.crates-io.bitcoin_hashes] diff --git a/README.md b/README.md index b7ecd9b82e..c322c80556 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,18 @@

Rust Dogecoin

- Rust Bitcoin logo by Hunter Trujillo, see license and source files under /logo + Rust Dogecoin logo by DFINITY Foundation, see license and source files under /logo

Library with support for de/serialization, parsing and executing on data-structures - and network messages related to Dogecoin. + and network messages related to Bitcoin and Dogecoin.

- Crate Info + Crate Info Apache License 2.0 - CI Status - API Docs + CI Status + API Docs Rustc Version 1.56.1+ - kani

diff --git a/bitcoin/CHANGELOG.md b/bitcoin/CHANGELOG.md index 4b3a3f9651..9d5d47aa54 100644 --- a/bitcoin/CHANGELOG.md +++ b/bitcoin/CHANGELOG.md @@ -3,9 +3,46 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -# 0.32.5-doge.0 - Unreleased - -Planned initial release of the Dogecoin crate. Not yet available. +# 0.32.5-doge.0 - 2025-11-03 + +Initial release of the rust-dogecoin crate, a fork of rust-bitcoin adapted for Dogecoin. + +### rust-bitcoin v0.32.5 modifications + +- **Scrypt Proof-of-Work**: Add scrypt-based PoW validation (`block_hash_with_scrypt()` and `validate_pow_with_scrypt()`) to support Dogecoin's PoW algorithm. +- **Difficulty Adjustment Algorithms**: + - Pre-Digishield algorithm (blocks 0-144,999) with variable transition thresholds based on block height ranges + - Digishield algorithm (blocks 145,000+) + - Methods `min_transition_threshold_dogecoin()` and `max_transition_threshold_dogecoin()` +- **Generic Network Messages**: Make `RawNetworkMessage` and `NetworkMessage` generic over `Header` and `Block` types to support AuxPoW blocks +- Updated license to Apache-2.0 for new Dogecoin-specific code + +### New Dogecoin module (`bitcoin/src/dogecoin/`) + +- **Core Types** (`mod.rs`): + - `Header`: Dogecoin block header with optional AuxPoW data + - `Block`: Block structure supporting both legacy and AuxPoW blocks + - `Network`: Dogecoin mainnet, Testnet, Regtest + - Helper methods for AuxPoW bit detection, chain ID extraction, and legacy block identification + +- **AuxPoW Support** (`auxpow.rs`): + - AuxPow validation (coinbase script validation, merkle branch verification, chain ID checks) + - Error types for AuxPow validation failures + +- **Consensus Parameters** (`params.rs`): + - Dogecoin PoW parameters and methods: target spacing, max attainable target, pow target timespan + - Digishield and AuxPoW activation height + - Chain ID for merged mining + - BIP activation heights + +- **Constants** (`constants.rs`): + - Genesis block definitions for mainnet, testnet, and regtest + - Prefixes for P2PKH and P2SH addresses + +- **Address Handling** (`address/`): + - Base58 address encoding/decoding with Dogecoin-specific prefixes + - Support for P2PKH and P2SH address types + - Network validation and address parsing # 0.32.5 - 2024-11-27 diff --git a/bitcoin/Cargo.toml b/bitcoin/Cargo.toml index c110ee6a4d..ea4fda180e 100644 --- a/bitcoin/Cargo.toml +++ b/bitcoin/Cargo.toml @@ -1,8 +1,8 @@ [package] -name = "bitcoin" +name = "bitcoin-dogecoin" version = "0.32.5-doge.0" -license = "CC0-1.0" -repository = "https://github.com/rust-dogecoin/rust-dogecoin/" +license = "Apache-2.0 OR CC0-1.0" +repository = "https://github.com/dfinity/rust-dogecoin" description = "General purpose library for using and interoperating with Bitcoin and Dogecoin." categories = ["cryptography::cryptocurrencies"] keywords = [ "crypto", "bitcoin", "dogecoin"] @@ -11,6 +11,9 @@ edition = "2021" rust-version = "1.56.1" exclude = ["tests", "contrib"] +[lib] +name = "bitcoin" + [features] default = [ "std", "secp-recovery" ] std = ["base58/std", "bech32/std", "hashes/std", "hex/std", "internals/std", "io/std", "secp256k1/std", "units/std"] diff --git a/bitcoin/embedded/Cargo.toml b/bitcoin/embedded/Cargo.toml index b12f41550b..7beae92c7a 100644 --- a/bitcoin/embedded/Cargo.toml +++ b/bitcoin/embedded/Cargo.toml @@ -15,7 +15,7 @@ cortex-m-rt = "0.6.10" cortex-m-semihosting = "0.3.3" panic-halt = "0.2.0" alloc-cortex-m = "0.4.1" -bitcoin = { path="../", default-features = false, features = ["secp-lowmemory"] } +bitcoin = { package = "bitcoin-dogecoin", path="../", default-features = false, features = ["secp-lowmemory"] } [[bin]] name = "embedded" diff --git a/bitcoin/src/lib.rs b/bitcoin/src/lib.rs index c335874e97..a863e435e2 100644 --- a/bitcoin/src/lib.rs +++ b/bitcoin/src/lib.rs @@ -1,10 +1,10 @@ // SPDX-License-Identifier: CC0-1.0 -//! # Rust Bitcoin Library +//! # Rust Dogecoin Library //! -//! This is a library that supports the Bitcoin network protocol and associated -//! primitives. It is designed for Rust programs built to work with the Bitcoin -//! network. +//! This is a library that supports both the Bitcoin and Dogecoin network protocol +//! and associated primitives. It is designed for Rust programs built to work with +//! the Bitcoin and Dogecoin network. //! //! Except for its dependency on libsecp256k1 (and optionally libbitcoinconsensus), //! this library is written entirely in Rust. It illustrates the benefits of diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml index f76d618991..10915e03e8 100644 --- a/fuzz/Cargo.toml +++ b/fuzz/Cargo.toml @@ -11,7 +11,7 @@ cargo-fuzz = true [dependencies] honggfuzz = { version = "0.5.55", default-features = false } -bitcoin = { path = "../bitcoin", features = [ "serde" ] } +bitcoin = { package = "bitcoin-dogecoin", path = "../bitcoin", features = [ "serde" ] } serde = { version = "1.0.103", features = [ "derive" ] } serde_json = "1.0" diff --git a/logo/README.md b/logo/README.md index 71a563dba4..efbb520e30 100644 --- a/logo/README.md +++ b/logo/README.md @@ -1,32 +1,19 @@ -# Rust Bitcoin Logo +# Rust Dogecoin Logo + +This logo is based on the [rust-bitcoin logo](https://github.com/rust-bitcoin/rust-bitcoin/tree/master/logo) and incorporates the Dogecoin "Ð" sign inside the Rust meshed gear. ## Files Included are: -- [rust-bitcoin-inkscape.svg](./rust-bitcoin-inkscape.svg) - The Inkscape source file with the things used to make the logo in case adjustments are desired -- [rust-bitcoin-optimized.svg](./rust-bitcoin-optimized.svg) - An optimized SVG for embedding or rendering at any size desired -- [rust-bitcoin.png](./rust-bitcoin.png) - The PNG logo rendered at 300px used by this project -- [rust-bitcoin-large.png](./rust-bitcoin-large.png) - A larger size 1024px x 1024px for convenience for embedding in presentations - -## Author - -Hunter Trujillo, @cryptoquick on [Twitter](https://twitter.com/cryptoquick), [GitHub](https://github.com/cryptoquick), and Telegram. +- [rust-doge.svg](./rust-doge.svg) - An SVG of the Rust Dogecoin logo for embedding or rendering at any size desired +- [rust-doge@4x.png](./rust-doge@4x.png) - A high-resolution PNG of the Rust Dogecoin logo render at 600px x 600px +- [rust-btc+doge.svg](./rust-btc+doge.svg) - An SVG of the Rust Bitcoin logo together with the Rust Dogecoin logo +- [rust-btc+doge@4x.png](./rust-btc+doge@4x.png) - A high-resolution PNG of the Rust Bitcoin + Dogecoin logo render at 1440px x 680px ## License Licensed in the public domain under [CC0 1.0 Universal Public Domain Dedication](https://creativecommons.org/publicdomain/zero/1.0/), and the author of this work rescinds all claims to copyright or coercion or acts of force from any nation state over this work for any purpose -Bitcoin Logo is licensed under the CC Public Domain Dedication: and - Rust Logo is licensed under CC-BY, which allows reuse and modifications for any purpose, as long as distributors give appropriate credit and indicate changes have been made. See here: -## Acknowledgements - -Acknowledgement for the runners up in this PR: https://github.com/rust-bitcoin/rust-bitcoin/pull/891#issuecomment-1074476858 - -In particular, the Rust Bitcoin Wizard gear was an incredibly inspired piece of art. Also, the meshed gears design was beloved by some but not all. - -Thank you to the Rust Bitcoin maintainers and community, your timely responses and guidance was appreciated. - -Also, thank you to the voters on the Rust in Bitcoin Telegram group: . diff --git a/logo/rust-bitcoin-inkscape.svg b/logo/rust-bitcoin-inkscape.svg deleted file mode 100644 index 9b504a344c..0000000000 --- a/logo/rust-bitcoin-inkscape.svg +++ /dev/null @@ -1,244 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/logo/rust-bitcoin-large.png b/logo/rust-bitcoin-large.png deleted file mode 100644 index f0cce3403f..0000000000 Binary files a/logo/rust-bitcoin-large.png and /dev/null differ diff --git a/logo/rust-bitcoin-optimized.svg b/logo/rust-bitcoin-optimized.svg deleted file mode 100644 index 31cf374ba7..0000000000 --- a/logo/rust-bitcoin-optimized.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/logo/rust-bitcoin.png b/logo/rust-bitcoin.png deleted file mode 100644 index 0f59dd168e..0000000000 Binary files a/logo/rust-bitcoin.png and /dev/null differ diff --git a/logo/rust-btc+doge.svg b/logo/rust-btc+doge.svg new file mode 100644 index 0000000000..83e4b1f902 --- /dev/null +++ b/logo/rust-btc+doge.svg @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/logo/rust-btc+doge@4x.png b/logo/rust-btc+doge@4x.png new file mode 100644 index 0000000000..7781d631bb Binary files /dev/null and b/logo/rust-btc+doge@4x.png differ diff --git a/logo/rust-doge.svg b/logo/rust-doge.svg new file mode 100644 index 0000000000..e5c9666a31 --- /dev/null +++ b/logo/rust-doge.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/logo/rust-doge@4x.png b/logo/rust-doge@4x.png new file mode 100644 index 0000000000..1d481dd905 Binary files /dev/null and b/logo/rust-doge@4x.png differ