Contractless builds as both executable tools and a Rust library crate named `blockchain`. The library artifact is `libblockchain.rlib`, and it exposes the same major modules used by the node, CLI tools and internal tests.
This file is a developer map. It is not meant to replace generated Rust documentation. Many functions are public because the crate is split across modules, not because every public function is a stable external API.
## Build Targets
The package builds node binaries, standalone CLI tools and the `blockchain` library crate.
Default testnet build:
```bash
cargo build --release
```
Explicit testnet build:
```bash
cargo build --release --features testnet
```
Mainnet has a feature flag, but mainnet builds are disabled during the testnet phase:
The crate root also re-exports many dependency types and functions used throughout the project. This keeps internal modules consistent, but external developers should prefer the stable public modules above instead of relying on dependency re-exports as an API contract.
## Useful Entry Points
### Wallets
Useful for tools that need to load wallets, derive addresses or sign data.
Common areas:
-`wallets::structures::Wallet`
-`wallets::structures::SavedWallet`
- address conversion functions in the wallet modules
- transaction signing and verification functions
Typical uses:
- create or load encrypted wallets
- convert long addresses to short addresses
- validate short or vanity addresses
- sign transaction hashes
- verify signatures
### Blocks and Transactions
Useful for tools that need to construct, decode or inspect transactions.
Useful for tools that inspect block synchronization behavior.
Common areas:
-`torrent`
-`orphans`
-`records::staged_torrents`
Typical uses:
- read and decode torrent metadata
- validate torrent data before block download
- inspect staged torrent candidates
- understand orphan correction and replay behavior
### Records and Storage
Useful for tools that inspect local chain state or database-backed records.
Common areas:
-`records::record_chain`
-`records::balance_sheet`
-`records::wallet_registry`
-`records::postgres`
-`records::memory`
-`records::network_mapping`
Typical uses:
- read saved chain records
- inspect balance sheets
- resolve registered wallets or vanity addresses
- query or maintain PostgreSQL-backed lookup records
- inspect in-memory connection state
## Adding New Public API
Before making a new function public, check whether it is public for one of these reasons:
- another module must call it
- a CLI tool needs it
- an external developer should reasonably use it
- Rustdoc should expose it as part of a stable integration surface
If a function only wraps one other function and adds no validation, conversion, ownership boundary or domain meaning, prefer calling the original function directly.
## Adding New CLI Tools
Standalone CLI tools live in `src/bin`.
When adding a tool:
- use `common::cli_prompts` for user prompts
- use `standalone_tools::connections` for RPC client requests
- keep RPC payloads binary across the TCP stream
- print human-readable or JSON-decoded output only after the binary response is received