mimblewimble/grin
62.4
Adequate · 30 September 2026
48.9k
lines of production code
Rust
primary language
2
measurements over time
What this system is
This system is a Rust-based cryptocurrency node implementation that manages blockchain synchronization, transaction processing, and peer-to-peer networking. It provides a JSON-RPC API for node interaction, supports asynchronous Stratum mining, and implements the Dandelion++ protocol for transaction privacy. The architecture utilizes LMDB for storage and includes a terminal user interface for monitoring node status and logs.
How it got here
2016 — Grin 5.5.1 architecture rewrite
15 changes.
This period focused on a comprehensive rewrite of the Grin codebase to version 5.5.1, introducing a new facade-based chain architecture and a robust P2P networking layer. The work involved migrating the storage backend from RocksDB to LMDB, consolidating core consensus and cryptographic modules, and restructuring the project into a modular workspace with updated dependencies.
2017–2020 — API v2 and Dandelion++ implementation
28 changes.
This period focused on upgrading the node API to version 2 with JSON-RPC and authentication, while introducing the Dandelion++ privacy protocol for transaction routing. The work also involved restructuring the codebase into modular components, implementing BIP39/BIP32 key management, and adding comprehensive test coverage including fuzzing for core and P2P modules.
Features
Add seed health check utility and restructure CLI binary
The \grin\ binary now includes a new \seedcheck\ command that allows users to verify the connectivity and health of configured seed nodes for both Mainnet and Testnet, outputting detailed results including DNS resolution status and handshake success. This change also restructures the command-line interface definition into an external YAML file (\grin.yml\) and introduces a \no-tui\ flag (and \GRIN\_NO\_TUI\ environment variable) to force log-only mode, disabling the interactive terminal user interface regardless of configuration settings.
src/bin · high confidence
Added release automation script and Nix development environment
The repository now includes a new bash script in the etc directory to automate the packaging and publishing of all Grin crates to crates.io, streamlining the release process. Additionally, a Nix shell configuration has been added to facilitate building the project on NixOS by providing necessary build inputs like clang and cmake.
etc · high confidence
Automated Rust code formatting via pre-commit hook
A new pre-commit hook has been added to the project to automatically enforce Rust code style. When committing changes, the hook checks all staged .rs files using rustfmt; if any files are not correctly formatted, the hook automatically reformats them and re-stages them before the commit proceeds, ensuring consistent code style without manual intervention.
.hooks · high confidence
Automated build-time versioning and git hook configuration
The build process now automatically configures project git hooks (such as rustfmt) upon compilation and embeds version and build-time information into the binary. This ensures consistent code formatting standards are enforced via the \.hooks\ directory and provides users with accurate version metadata without manual intervention.
src/build · high confidence
Dandelion++ transaction relay and peer seed management
The server now implements the Dandelion++ privacy protocol for transaction propagation, introducing a background monitor that tracks transactions in the 'stem' phase and automatically 'fluffs' (broadcasts) them to the wider network once their embargo timer expires or the epoch ends. Additionally, the peer connection logic has been restructured into a dedicated seed module that handles initial peer discovery via DNS seeds and manages ongoing peer health checks, connection limits, and expiration cleanup to ensure robust network connectivity.
servers/src/grin · high confidence
Introduce BIP39 mnemonic and BIP32 hierarchical deterministic key derivation
The keychain module now supports wallet recovery and hierarchical key management by implementing BIP39 mnemonic phrases and BIP32 extended key derivation. Users can generate a keychain from a seed or a 12/15/18/21/24-word mnemonic list, enabling wallet restoration. The implementation includes a custom BIP32 hasher (\BIP32GrinHasher\) to accommodate Grin's use of Blake2b for certain operations while maintaining compatibility with standard BIP32 test vectors, and provides utilities for base58 encoding/decoding and identifier generation from public keys.
keychain · high confidence
Introduce PIBD segmenter and desegmenter for transaction set sync
The txhashset module now includes a new segmenter and desegmenter infrastructure to support Peer-to-Peer Block Download (PIBD). This adds a BitmapAccumulator to commit to UTXO bitmap fragments via an MMR, a Segmenter to generate kernel, output, rangeproof, and bitmap segments from the local transaction set, and a Desegmenter to reconstruct the txhashset from received segments. These components enable nodes to sync the transaction set incrementally by downloading and verifying specific data segments rather than transferring the entire state at once.
chain/src/txhashset · high confidence
Introduce asynchronous Stratum mining server and block-building logic
The mining subsystem now features a new asynchronous Stratum server implementation that handles mining job distribution and share submission via JSON-RPC 2.0, replacing the previous synchronous model. This update includes a dedicated block-building module that assembles blocks from the transaction pool and manages coinbase key derivation, alongside a test miner loop that integrates with the new async infrastructure to validate and submit mined blocks.
servers/src/mining · high confidence
Introduction of Node API v2 with JSON-RPC and Basic Authentication
The node API has been upgraded to version 2, introducing a new JSON-RPC interface for both the Foreign and Owner endpoints. This change adds Basic Authentication middleware to secure API access, allowing administrators to configure secrets for the Owner API and optionally for the Foreign API. The new API structure replaces the previous HTTP-based implementation with a more robust handler system, including specific routes for block, chain, peer, and pool operations, while maintaining backward compatibility for existing client integrations where applicable.
api/src · high confidence
Introduction of event hooks for network and chain notifications
The server now supports registering callbacks for key blockchain events, allowing external systems to react to activity. New \NetEvents\ and \ChainEvents\ traits in \servers/src/common/hooks.rs\ enable listeners to be notified when transactions or blocks are received, when headers arrive, and when blocks are accepted by the chain (including reorgs and forks). The \NetToChainAdapter\ in \adapters.rs\ now invokes these hooks, and the \ServerConfig\ in \types.rs\ includes a \webhook\_config\ section that allows users to configure HTTP/HTTPS webhooks to receive these events automatically.
servers/src/common · high confidence
Introduction of the Transaction Pool crate with Dandelion privacy and fee-based acceptance
The \pool/src\ crate introduces the core transaction pool implementation, managing both the public transaction pool (txpool) and the private Dandelion stem pool (stempool). This change adds support for Dandelion++ transaction routing, including configurable stem probabilities, embargo timers, and epoch lengths to enhance transaction privacy. The pool now enforces a minimum fee threshold (\accept\_fee\_base\) for transaction acceptance and implements a reorg cache to retain transactions for 30 minutes, ensuring consistency during chain reorganizations. Additionally, it provides logic for aggregating transactions to maximize cut-through and fee efficiency before mining.
pool/src · high confidence
Introduction of the libtx transaction building library
The core library now includes a new \libtx\ module that provides lower-level transaction building functions for wallets. This addition introduces a combinator-based API for constructing transactions, allowing inputs, outputs, and kernels to be added via chained builder functions. It also includes dedicated modules for aggregated signature handling (\aggsig\), range proof creation and verification (\proof\), block reward output generation (\reward\), and serialization utilities for cryptographic types (\secp\_ser\), alongside a new error type definition for transaction-specific failures.
core/src/libtx · high confidence
New TUI with dedicated Logs view and structured menu navigation
The TUI has been restructured into modular components (constants, logs, menu, mining, peers, status, version) with a new main menu allowing navigation between Basic Status, Peers and Sync, Mining, Logs, and Version Info. A new Logs view displays real-time log entries with color-coded severity levels (green for Info, yellow for Warn, red for Error) in a scrollable buffer. The Peers view now includes User Agent and Capabilities columns, and the Mining view displays detailed worker statistics and difficulty history. The UI uses the crossterm backend and sets a 3 FPS refresh rate.
src/bin/tui · high confidence
New node client and server command-line interfaces
This change introduces new command-line capabilities for managing the Grin node. The \client\ module adds a new HTTP-based node client that communicates with the node's Owner API (v2) to expose commands for checking server status, listing connected peers, resetting the chain head, invalidating headers, verifying the chain, and banning/unbanning peers. The \server\ module refactors the server startup logic to support both a new Terminal User Interface (TUI) mode and a standard non-TUI mode, handling graceful shutdowns via SIGINT/SIGTERM in both cases. Additionally, a \config\ command is added to generate default configuration files in the current directory.
src/bin/cmd · high confidence
New utility crate with file, hex, logging, and synchronization helpers
The \util\ crate has been introduced to centralize low-level utilities used across the codebase. It provides file management functions (delete, copy, list, read first line), hex encoding/decoding with a \ToHex\ trait, and a robust logging system backed by \log4rs\ that supports file rotation, stdout output, and TUI integration. The crate also includes a \OneTime\ struct for thread-safe one-time initialization using \parking\_lot\ locks, a \RateCounter\ for tracking data transfer rates, a \ZeroingString\ for secure password handling, and wrappers for ZIP archive creation and extraction.
util/src · high confidence
Project initialization with core documentation, licensing, and build configurations
This change establishes the foundational structure of the repository by adding essential project files. It introduces the Apache 2.0 LICENSE, a Code of Conduct, and a Security Policy outlining responsible disclosure procedures. For contributors, it provides a detailed CONTRIBUTING guide, a .editorconfig for consistent formatting, and a rustfmt.toml configured for Rust 2021 edition with hard tabs. Build and deployment support is added via a Dockerfile for containerized node operation and Nix flake files (flake.nix, flake.lock) for reproducible builds. The .gitignore is expanded to exclude common IDE and build artifacts, while the README is updated to reflect the mainnet launch and current community channels.
(repo-wide) · high confidence
Removals
Genesis generation utility disabled
The \etc/gen\_gen\ crate, which previously automated the generation of the Grin genesis block by mining a Cuckaroo solution and updating \genesis.rs\, has been disabled. The \Cargo.toml\ file has been renamed to \\_Cargo.toml\, preventing the crate from building, and a new \README.md\ documents that the tool no longer builds due to project structure changes.
_etc/gen\gen · high confidence
Removal of grin binary and rustfmt configuration
The grin binary entry point (src/main.rs) and the rustfmt configuration file (rustfmt.toml) have been removed from the project. This eliminates the standalone executable that previously initialized the genesis block and stored it, as well as the formatting rules that enforced hard tabs and overwrite mode.
grin · high confidence
Architecture
Refactored API handlers into dedicated modules
The monolithic API handler implementation has been split into separate, dedicated files (blocks\_api, chain\_api, peers\_api, pool\_api, server\_api, transactions\_api, utils, and version\_api). This structural change organizes the REST API endpoints by domain—such as block retrieval, peer management, transaction pool operations, and chain status—making the codebase easier to navigate and maintain without altering the external API contract.
api/src/handlers · high confidence
Refactored chain synchronization into modular sync components
The synchronization logic in the server has been restructured from a monolithic implementation into distinct, dedicated modules for header, body, and state synchronization. This change introduces separate \HeaderSync\, \BodySync\, and \StateSync\ structs to handle their respective stages of the chain sync process, improving code organization and maintainability while preserving the existing fast-sync and archival-sync behaviors.
servers/src/grin/sync · high confidence
Restructure server crate into modular components
The server source code has been reorganized into distinct modules to improve maintainability and separation of concerns. The \lib.rs\ file now explicitly aggregates core dependencies (API, chain, core, keychain, P2P, pool, store, util) and exposes public interfaces for server configuration, statistics, and DNS seed resolution. New module files (\common.rs\, \grin.rs\, \mining.rs\) group related functionality: \common\ houses shared adapters, hooks, stats, and types; \grin\ manages P2P-specific logic like Dandelion monitoring, seeding, and synchronization; and \mining\ isolates block mining and the Stratum server implementation. This change primarily affects internal code structure and public API exports rather than user-facing behavior.
servers/src · high confidence
Behavioural changes
Complete rewrite of the chain crate with new architecture and PIBD support
The chain crate has been completely rewritten from scratch, replacing the previous implementation with a new facade-based architecture. This introduces a dedicated Chain struct that manages the block processing pipeline, orphan pool, and transaction hashset (TxHashSet) more robustly. Key behavioral changes include the integration of Peer-to-Peer Block Download (PIBD) for faster state synchronization, a new linked-list storage primitive for efficient index management, and a comprehensive error handling system using the thiserror crate. The update also modernizes dependencies, switching to the chrono crate for time handling and adopting the heed library for LMDB storage, while introducing configurable parameters for PIBD segment sizes and timeouts.
chain/src · high confidence
Core module refactoring and consensus parameter consolidation
The core library has been restructured to improve code organization and type safety. Consensus rules, constants, and hard-fork schedules are now centralized in a new \consensus\ module, while global runtime configuration (such as chain type and protocol version) is managed via a new \global\ module. The serialization layer (\ser\) has been updated to use \Result\-based error handling instead of \Option\, introducing specific error types for protocol version mismatches and data corruption. Additionally, the codebase has been migrated from the \time\ crate to \chrono\ for date/time handling, and the \tiny\_keccak\ dependency has been removed in favor of the \secp256k1-zkp\ library for cryptographic operations.
core/src · high confidence
Core types refactored into modular files and hash function replaced with BLAKE2b
The core module has been restructured from a single monolithic file into distinct modules (block, transaction, hash, pmmr, etc.), improving code organization. Additionally, the primary hash function used for blocks, transactions, and outputs has been replaced from SHA3 to BLAKE2b, which affects the resulting block and transaction hashes.
core/src/core · high confidence
Migrate store backend from RocksDB to LMDB
The storage layer in the store crate has switched from RocksDB to LMDB (via the heed library). This change replaces the previous RocksDB-based Store implementation with a new LMDB-backed Store, introducing new modules for managing leaf sets, prune lists, and PMMR backends. Users will experience a change in database file structure and storage engine behavior, requiring a migration from the old RocksDB data format to the new LMDB format.
store/src · high confidence
New modular configuration system with v2 file format and API secret management
The configuration logic has been refactored into a dedicated \config\ crate, introducing a new \grin-server.toml\ file structure with \config\_file\_version = 2\. This change centralizes config parsing and introduces automatic management of API security: the system now generates and validates \.api\_secret\ and \.foreign\_api\_secret\ files to support Basic Auth for the Rest API and v2 Owner API. It also standardizes default paths (using \\~/.grin/\<chain\_type\>/\) and provides structured comments for all configuration options, including server, P2P, logging, and webhook settings.
config · high confidence
P2P networking layer rewritten with new connection and handshake architecture
The peer-to-peer networking module has been completely rewritten to introduce a new connection abstraction (\conn.rs\) that manages TCP streams, timeouts, and I/O via dedicated reader and writer threads. This change introduces a new handshake protocol (\handshake.rs\) that validates peer compatibility by comparing genesis hashes and negotiating protocol versions before establishing a connection. The update also adds a new codec (\codec.rs\) for handling message serialization and deserialization, and restructures the peer management logic (\peer.rs\, \peers.rs\) to integrate with these new components, resulting in a more robust and Rust-idiomatic P2P stack.
p2p/src · high confidence
Proof-of-work module refactored to support multiple Cuckoo-family algorithms
The core proof-of-work implementation has been restructured to support a family of Cuckoo Cycle variants (Cuckaroo, Cuckarood, Cuckaroom, Cuckarooz, and Cuckatoo) alongside a lean miner, replacing the previous single Cuckoo implementation. This change introduces a unified \PoWContext\ trait and a shared \CuckooParams\ structure, allowing the system to verify and solve different graph algorithms required by various hard forks while maintaining a consistent interface for block validation and mining.
core/src/pow · high confidence
Refactored PMMR storage backend into a trait-based architecture
The PMMR (Prunable Merkle Mountain Range) implementation in core/src/core/pmmr has been restructured to decouple the core tree logic from storage details. A new Backend trait defines the interface for storage operations (append, rewind, get, remove), allowing the PMMR to support different storage backends. A new VecBackend implementation provides an in-memory backend for testing and lightweight use cases, while the existing file-based backend continues to support persistent storage. This change enables more flexible storage strategies and improves testability by allowing in-memory PMMRs without disk I/O.
core/src/core/pmmr · high confidence
Removal of secp256k1-zkp ECDH, ECDSA recovery, and Schnorr module implementations
The local source code for the ECDH, ECDSA signature recovery, and Schnorr signature modules within the vendored secp256k1-zkp dependency has been deleted. This change removes the internal implementations and build configurations for these cryptographic features from this location, consistent with the project's shift to using the secp256k1-zkp library as an external repository dependency rather than maintaining these modules locally.
secp256k1zkp/depend/secp256k1-zkp/src/modules/ecdh, secp256k1zkp/depend/secp256k1-zkp/src/modules/recovery, secp256k1zkp/depend/secp256k1-zkp/src/modules/schnorr · high confidence
Removed vendored secp256k1-zkp dependency and build infrastructure
The \secp256k1zkp\ crate no longer bundles the \secp256k1-zkp\ C library as a vendored submodule under \depend/secp256k1-zkp/\. This change removes the entire \depend/\ directory, the \build.rs\ script that previously compiled the C code, and associated build artifacts (Makefiles, autotools configs, Travis CI configs). The project has switched to using \secp256k1\ as an external repository dependency, simplifying the build process by offloading the C compilation to the standard Rust dependency resolver.
secp256k1zkp · high confidence
secp256k1-zkp submodule updated to a new forked version
The secp256k1-zkp cryptographic library submodule has been replaced with a new version from a forked repository. This update removes several internal benchmarking files (such as bench\_ecdh.c and bench\_internal.c) and configuration headers (like basic-config.h) that are no longer part of the library's public interface, reflecting a change in the upstream dependency structure.
secp256k1zkp/depend/secp256k1-zkp · high confidence
Test coverage
Added core test suite for block, transaction, and consensus validation; Added fuzz testing for P2P message deserialization; Added fuzz testing for core serialization; Added fuzz testing for the transaction pool; Added integration tests for the REST API server; Added integration tests for transaction pool block building and reconciliation; Added test coverage for chain bitmap, NRD, and store indices; Added test coverage for store components; Added tests for file and zip utility functions; Added unit tests for P2P capabilities, peer addressing, handshake, and serialization.
Dependencies
Grin 5.5.1 dependency and workspace overhaul
The project has been updated to version 5.5.1, migrating the Rust edition to 2021 and restructuring the workspace to include dedicated crates for API, config, chain, core, keychain, p2p, servers, store, util, and pool. Key dependency upgrades include switching the HTTP stack to Hyper 1.x with Rustls for TLS, updating the TUI backend to Cursive 0.21 with the Crossterm backend, and replacing the RocksDB storage backend with the Heed library. The cryptographic dependencies have also been updated, notably upgrading the secp256k1-zkp crate to version 0.7.15 and the croaring bitmap library to 1.0.1.
(dependencies) · high confidence
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 65 → 62 (-2.3)
- Rubric changed (rubric-2026.09.11 → rubric-2026.09.18) — scores are not directly comparable.
Lenses
- Code Health 85 → 86 (+0.2)
- Architecture 100 → 93 (-6.6)
- Maturity 61 → 58 (-3.1)
- Readiness 58 → 54 (-4.1)
- Security 64 → 69 (+4.8)
- Performance 100 (new)
Resolved (7)
- Documentation: no installation or build instructions (README.md)
- Documentation: no licence statement (README.md)
- Documentation: no usage examples (README.md)
- Hotspot: chain/src/txhashset/desegmenter.rs (chain/src/txhashset/desegmenter.rs)
- Hotspot: servers/src/grin/seed.rs (servers/src/grin/seed.rs)
- Hotspot: src/bin/grin.rs (src/bin/grin.rs)
- Off-boarding risk: anonymized user #1
New (38)
- Concentrated knowledge decay
- Flaky test: grin_chain::store_indices.test_store_indices
- Inconsistent method naming for retrieving headers. Chain uses 'get_header_by_height', while Foreign uses 'get_header' with optional height/hash/commit params. This suggests different retrieval strategies but confusingly similar names.
- Inconsistent parameter naming between Chain and ChainStore. Both use 'h' for the hash parameter, which is a poor, non-descriptive name. Same issue as get_block.
- Inconsistent parameter naming between Chain and ChainStore. Both use 'h' for the hash parameter, which is a poor, non-descriptive name. While consistent with each other, it is inconsistent with other methods in the same types that use descriptive names (e.g., 'hash', 'commit').
- Inconsistent parameter naming between Owner and OwnerRpc. Owner uses 'addr', while OwnerRpc uses 'peer_addr'. Same issue as get_peers.
- Inconsistent parameter naming between Owner and OwnerRpc. Owner uses 'addr', while OwnerRpc uses 'peer_addr'. Same issue as get_peers.
- Inconsistent parameter naming between Owner and OwnerRpc. Owner uses 'addr', while OwnerRpc uses 'peer_addr'. While the type is the same, the semantic name differs, which is confusing for developers switching between the two interfaces.
- Inconsistent parameter naming for boolean flags in get_outputs. Foreign uses '_include_merkle_proof' (with leading underscore, likely an internal/unused arg indicator), while ForeignRpc uses 'include_merkle_proof'. This creates confusion about whether the underscore is significant or just a naming inconsistency.
- Inconsistent parameter type for 'hash' between Foreign and ForeignRpc. Foreign uses Hash (likely a struct/type), while ForeignRpc uses String. This forces callers to convert types depending on which API surface they use.
- Inverted test pyramid
- Low cohesion: BIP32GrinHasher (LCOM4 4) (keychain/src/extkey_bip32.rs)
- Low cohesion: Foreign (LCOM4 4) (api/src/foreign.rs)
- Low cohesion: Identifier (LCOM4 4) (keychain/src/types.rs)
- Low cohesion: P2PConfig (LCOM4 5) (p2p/src/types.rs)
- Medium vulnerability: RUSTSEC-2026-0285 (Cargo.lock)
- Most significant orphaned file (chain/src/txhashset/txhashset.rs)
- Most significant orphaned file (core/src/core/transaction.rs)
- Most significant orphaned file (servers/src/mining/stratumserver.rs)
- Off the main sequence: grin_util
- …and 18 more
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
mimblewimble/grin was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 30 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit d5f32350ab548736c17c1db7ff51457917fe4e96 — the exact code this score is about.
- Scored under rubric-2026.09.18 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer preprod-cb25ca4feafa.