Scruple · XSL · ℈
Protocol
specification.
The frozen consensus rules of Scruple, from wire formats and sighash construction to RandomX epoch rotation and per-block LWMA difficulty. Complete enough to implement a second node.
Version: 1.0 (Mainnet Candidate)
Status: Frozen Consensus Rules — Production Launch Specification
Units: 1 ℈ (1 XSL) = 100,000,000 grains (10^8)
1. Design Goals & Frozen Consensus Constants
Scruple is a minimalist, post-quantum, CPU-mineable UTXO cryptocurrency designed for long-term ossification, bounded hardware requirements, and fair public launch.
| Parameter | Value | Notes |
|---|---|---|
| Name / Ticker / Symbol | Scruple / XSL / ℈ (U+2108) |
Base unit: grains |
| Subdivisions | 100,000,000 (10^8) grains / XSL |
u64 amounts |
Block Subsidy (BLOCK_REWARD) |
100,000,000 grains (1 XSL) |
Fixed tail emission forever; no halvings, no premine (~105,120 XSL/year) |
Target Block Time (T) |
300 seconds (5 minutes) |
Mainnet, Testnet, and Devnet |
Maximum Block Size (MAX_BLOCK_SIZE) |
1,000,000 bytes (1 MB decimal) |
Hard cap on full serialized block bytes; 1:1 weight (no witness discount) |
Maximum Transaction Size (MAX_TX_SIZE) |
100,000 bytes |
Full serialized transaction bytes |
Maximum Inputs / Outputs / Auth (MAX_TX_IO) |
1,024 |
Per transaction |
| Maximum Transactions per Block | 10,000 |
Wire decode upper bound |
Consensus Minimum Output (CONSENSUS_MIN_OUTPUT) |
1 grain (0.00000001 XSL) |
Strict consensus floor on all normal and coinbase outputs (non-consensus mempool/wallet dust policy DUST_FLOOR = 5,000 grains) |
Block Version (BLOCK_VERSION) |
1 |
Strict equality required |
Address Versions (ADDR_VERSION_SQISIGN_L1 / ADDR_VERSION_MULTISIG_SQISIGN_L1) |
1 / 2 |
Checksummed Bech32m (xsl1p.../xsl1z... Mainnet, txsl1... Testnet, dxsl1... Devnet) & legacy xsl1:<64-hex> / xsl2:<64-hex> |
Max Multisig Keys (MAX_MULTISIG_KEYS) |
15 |
Upper bound N per v2 multisig output / TxAuth::Multisig |
| Coinbase Maturity | Mainnet: 24 (6 (2 |
Spendable when spend_height >= outpoint.height + coinbase_maturity |
LWMA Window (LWMA_WINDOW) |
60 blocks |
Per-block difficulty adjustment |
RandomX Epoch Length (RANDOMX_EPOCH_LENGTH) |
2,048 blocks |
Automatic PoW seed rotation (~7.1 days) |
RandomX Epoch Lag (RANDOMX_EPOCH_LAG) |
64 blocks |
Stabilization window before new seed activates |
Max Future Block Time (MAX_FUTURE_BLOCK_TIME) |
1,200 seconds (20 minutes) |
Relative to local node wall clock |
| Mainnet Initial / Max Target Bits | 0x1e0fffff / 0x1f7fffff |
Compact Bitcoin-style nBits |
| Testnet Initial / Max Target Bits | 0x1f0fffff / 0x207fffff |
Fast public testnet start (~4k RandomX hashes), then LWMA adapts |
| Devnet Initial / Max Target Bits | 0x200fffff / 0x207fffff |
Fast local testing target |
P2P Protocol Magic (p2p_magic) |
Mainnet: "XSL1" (58534C31) · Testnet: "XSLT" (58534C54) · Devnet: "XSLD" (58534C44) |
Per-network 4-byte transport frame prefix; cross-network peers reject immediately |
| Default P2P / RPC Ports | Mainnet & Devnet: 18333 / 18332 · Testnet: 28333 / 28332 |
Used automatically when --p2p / --rpc are omitted |
No general-purpose scripting VM, no OP_RETURN, and no witness discount exist in consensus.
2. Cryptographic Primitives & Domain Separation
2.1 Domain-Separated BLAKE3
All consensus hashing uses BLAKE3-256 with explicit ASCII domain prefix concatenation:
H(domain, data) = BLAKE3(domain || data)
| Domain Tag (ASCII bytes) | Input (data) |
Purpose |
|---|---|---|
scruple-addr-v1 |
pubkey (83 B) |
32-byte v1 single-key address hash |
scruple-addr-v2 |
threshold (1 B) || n (1 B) || pubkey_0 (83 B) || ... || pubkey_{n-1} (83 B) |
32-byte v2 M-of-N multisig address hash (1 <= threshold <= n <= 15, strictly ascending pubkeys) |
scruple-txid-v1 |
encode_body(tx) |
Non-malleable transaction ID (excludes auth) |
scruple-wtxid-v1 |
encode(tx) |
Full witness transaction ID (includes auth) |
scruple-sighash-v1 |
txid || Σ(utxo.txid || encode(utxo.output)) |
Reorg-safe signature digest |
scruple-merkle-leaf |
leaf_hash (32 B) |
Binary Merkle tree leaf node |
scruple-merkle-node |
left_32 || right_32 (64 B) |
Binary Merkle tree internal node |
scruple-block-root-v1 |
tx_root_32 || wt_root_32 (64 B) |
Dual Merkle root committed in block header |
scruple-header-v1 |
header_bytes (85 B) |
Canonical 32-byte block hash / identifier |
scruple-genesis-v1 |
genesis_seed || genesis_timestamp (u64_le) |
Genesis block prev_hash commitment & burn output |
scruple-rx-genesis |
genesis_seed || genesis_timestamp (u64_le) |
RandomX Epoch-0 seed hash |
scruple-hd-v1 |
master_seed (64 B) || index (u32_le) |
Deterministic HD child seed derivation (wallet standard) |
scruple-rbf-shrink-v1 |
old_txid (32 B) || new_txid (32 B) |
Non-consensus Ownership-Proven FSS-RBF change-shrink proof (MSG_TX_BUMP) |
2.2 SQIsign Round-3 Level 1 (Compressed Format)
Scruple uses pure-Rust NIST Round-3 SQIsign Security Level 1:
- Public Key (
PK_LEN): exactly83bytes (PublicKey::<Level1>::to_bytes()). - Compressed Signature (
SIG_LEN): exactly176bytes (Signature::compress().to_bytes()). - Tagged Auth Footprint:
260bytes (1 B tag + 83 B pk + 176 B sig) per uniquev1signing address;4 + 83*N + 177*Mbytes per uniquev2M-of-N multisig address (e.g.607bytes for 2-of-3). - Address Derivation (
v1Single-Key):addr_hash = BLAKE3("scruple-addr-v1" || pubkey_83) bech32m = bech32m_encode(hrp, witness_ver=1, addr_hash) // xsl1p... / txsl1p... / dxsl1p... legacy = "xsl1:" || lowercase_hex(addr_hash) - Address Derivation (
v2Native M-of-N Multisig): Requires1 <= threshold <= N <= 15(MAX_MULTISIG_KEYS) and strictly ascendingpubkeys[0] < pubkeys[1] < ... < pubkeys[N-1](lexicographical byte order):
Bech32m (BIP-350) carries a 6-character BCH checksum and network HRP (addr_hash = BLAKE3("scruple-addr-v2" || u8(threshold) || u8(N) || pubkeys[0] || ... || pubkeys[N-1]) bech32m = bech32m_encode(hrp, witness_ver=2, addr_hash) // xsl1z... / txsl1z... / dxsl1z... legacy = "xsl2:" || lowercase_hex(addr_hash)xslMainnet,txslTestnet,dxslDevnet) so typos and cross-network sends are rejected client-side; legacyxsl1:/xsl2:hex remains accepted for backward compatibility. - Non-SUF-CMA Immunity: Because SQIsign signatures are not strongly unforgeable under chosen message attacks (an observer could potentially transform one valid signature into another valid signature for the same message), Scruple completely excludes the
authsection fromtxid, while still committing to full signatures viawtxidinside the block header'smerkle_root.
3. Canonical Binary Wire Format
Every consensus object has a single canonical byte representation. Non-canonical encodings and trailing bytes are consensus-invalid and MUST be rejected during decoding.
3.1 Primitive Types
u8: 1 byte unsigned integer.u32_le: 4-byte little-endian unsigned integer.u64_le: 8-byte little-endian unsigned integer.varint: Canonical unsigned LEB128 (u64):- Emits 7 bits per byte (LSB first); bit 7 (
0x80) is1on all bytes except the final byte. - Strict minimality rule: A multi-byte varint MUST NOT end in a
0x00byte (e.g.[0x80, 0x00]is rejected asNonCanonicalVarint). - Overflow rule: At most 10 bytes; in the 10th byte (
shift == 63), payload bits MUST be<= 1(otherwiseVarintOverflow).
- Emits 7 bits per byte (LSB first); bit 7 (
- EOF rule: Decoding a standalone
TransactionorBlockMUST consume every byte in the buffer; any trailing bytes are rejected (TrailingBytes).
3.2 Block Header (85 Bytes Fixed)
| Offset | Length | Field | Type | Description |
|---|---|---|---|---|
0 |
1 |
version |
u8 |
Must be 1 (BLOCK_VERSION) |
1 |
32 |
prev_hash |
[u8; 32] |
Parent block's block_hash (genesis_commitment(params) for genesis) |
33 |
32 |
merkle_root |
[u8; 32] |
Dual txid/wtxid Merkle commitment |
65 |
8 |
timestamp |
u64_le |
Unix timestamp (seconds) |
73 |
4 |
target_bits |
u32_le |
Compact PoW target (nBits) |
77 |
8 |
nonce |
u64_le |
PoW nonce |
- Block Identifier:
block_hash = BLAKE3("scruple-header-v1" || header[0..85]). - PoW Input: RandomX hashes the exact same 85-byte serialized header (
header[0..85]).
3.3 Compact OutPoint
Instead of 36-byte (txid, vout) pointers, Scruple references UTXOs by their immutable chain position (~3–5 bytes on-chain):
OutPoint :=
height : varint(u64) // block height creating the UTXO
tx_index : varint(u32) // transaction index within that block (0 = coinbase)
out_index : varint(u32) // output index within that transaction
Ordering of OutPoint is lexicographical on (height, tx_index, out_index).
3.4 Output
Output :=
addr_version : u8 // must be 1 (xsl1 single-key) or 2 (xsl2 M-of-N multisig)
addr_hash : [u8; 32] // scruple-addr-v1 or scruple-addr-v2 commitment
amount : varint(u64) // grains; consensus >= 1 (mempool/wallet policy >= 5,000)
Ordering of Output is lexicographical on (addr_version, addr_hash, amount).
3.5 TxAuth (Tagged Canonical Encoding)
Each TxAuth entry begins with a 1-byte version tag matching the spent output's addr_version:
TxAuth :=
tag : u8
if tag == 1: // SingleSig (260 bytes fixed)
pubkey : [u8; 83] // SQIsign Round-3 Level 1 public key
sig : [u8; 176] // SQIsign Round-3 Level 1 compressed signature
else if tag == 2: // Multisig (4 + 83*n + 177*m bytes)
threshold : u8 // 1 <= threshold <= n
n : u8 // 1 <= n <= 15 (MAX_MULTISIG_KEYS)
pubkeys : [u8; 83][n] // strictly ascending lexicographical order
m : u8 // must equal threshold (m == threshold)
sigs : (signer_idx: u8, sig: [u8; 176])[m] // strictly ascending signer_idx < n
else:
INVALID
Strict canonical decode rules (enforced during wire decoding AND consensus validation):
- Unknown
tagvalues (anything other than1or2) are rejected. - For
tag == 2,threshold == 0,n == 0,n > 15,threshold > n, andm != thresholdare rejected. - Remaining input bytes MUST cover
n * 83 + 1 + threshold * 177before allocating vectors. pubkeysMUST be strictly ascending (pubkeys[i-1] < pubkeys[i], forbidding duplicates and permutations).signer_idxvalues MUST satisfysigner_idx < nand be strictly ascending (signer_idx[i-1] < signer_idx[i], forbidding duplicate signer reuse and permutation malleability).
3.6 Transaction
TransactionBody :=
flag : u8 // 1 = coinbase, 0 = normal spend
if flag == 1:
coinbase_height : varint(u64)
else if flag == 0:
input_count : varint(usize <= 1024)
inputs : OutPoint[input_count]
else:
INVALID
output_count : varint(usize <= 1024)
outputs : Output[output_count]
Transaction :=
body : TransactionBody
if flag == 0:
auth_count : varint(usize <= 1024)
auth : TxAuth[auth_count]
Coinbase transactions (flag == 1) serialize no inputs and no auth trailer.
3.7 Block
Block :=
header : BlockHeader (85 bytes)
tx_count : varint(usize <= 10000)
transactions : Transaction[tx_count]
Total serialized Block length MUST satisfy block.to_bytes().len() <= 1,000,000.
4. Transaction Identifiers, Sighash, Merkle Tree & Canonical Sorting
4.1 Non-Malleable txid and Witness wtxid
txid(tx) = BLAKE3("scruple-txid-v1" || encode_body(tx))
wtxid(tx) = BLAKE3("scruple-wtxid-v1" || encode(tx))
4.2 Reorg-Safe Sighash (Zero Extra On-Chain Bytes)
Because compact OutPoint(height, tx_index, out_index) pointers are positional, a deep chain reorganization could otherwise map the same coordinates to a different UTXO. Scruple eliminates this completely with zero extra on-chain bytes by binding every spent UTXO's exact creating txid and full Output into the signed digest:
sighash(tx, spent_utxos) = BLAKE3(
"scruple-sighash-v1"
|| txid(tx)
|| spent_utxos[0].txid || encode(spent_utxos[0].output)
|| spent_utxos[1].txid || encode(spent_utxos[1].output)
|| ...
|| spent_utxos[m-1].txid || encode(spent_utxos[m-1].output)
)
This simultaneously guarantees:
- 100% Reorg Safety: A signature cannot be replayed against a different UTXO at the same
(height, tx_index, out_index). - Exact Fee Commitment: Every input amount and every output amount (via
txid) is cryptographically bound, protecting hardware/offline signers against fee-drain attacks.
4.3 Dual Block Merkle Root
Given a non-empty list of 32-byte leaves L[0..k]:
- Transform each leaf:
N[i] = BLAKE3("scruple-merkle-leaf" || L[i]). - While
N.len() > 1, pair adjacent nodes(left, right)(duplicating the last node ifN.len()is odd) and replace withBLAKE3("scruple-merkle-node" || left || right). - For an empty list, return
[0u8; 32].
The block header commits to both txid and wtxid trees:
tx_root = merkle_root([tx.txid() for tx in block.transactions])
wt_root = merkle_root([tx.wtxid() for tx in block.transactions])
merkle_root = BLAKE3("scruple-block-root-v1" || tx_root || wt_root)
4.4 Mandatory Canonical Sorting & Signature Deduplication
Every non-coinbase transaction MUST satisfy all of the following consensus rules:
- Size & Bounds:
encode(tx).len() <= 100,000;1 <= inputs.len() <= 1,024;1 <= outputs.len() <= 1,024;1 <= auth.len() <= inputs.len(). - Strict Ascending Inputs: For all
i,inputs[i] < inputs[i+1]. This guarantees canonical ordering and forbids duplicate inputs in a single pass. - Non-Decreasing Outputs: For all
i,outputs[i] <= outputs[i+1]. Eliminates change-position wallet fingerprinting. - Output Validity: Every output has
addr_versionin{1, 2},amount >= 1(CONSENSUS_MIN_OUTPUT), andsum(outputs.amount)does not overflowu64. (Mempool relay and wallet builders enforce the higher non-consensus policy floorDUST_FLOOR = 5,000grains.) - UTXO Resolution & Maturity: Every
OutPointexists in the active UTXO set; ifutxo.is_coinbase, thenspend_height >= outpoint.height + coinbase_maturity;sum(inputs.amount)does not overflowu64andsum(inputs.amount) >= sum(outputs.amount). - Deduplicated, Strictly Sorted Auth (Mixed
v1/v2Supported): Compute the sorted unique set of(addr_version, addr_hash)pairs across all spent UTXOs. For everyaintx.auth, validate its canonical structure (forv2multisig:1 <= threshold <= pubkeys.len() <= 15, strictly ascendingpubkeys,sigs.len() == threshold, strictly ascendingsigner_idx < pubkeys.len()) and derive(a.addr_version(), a.addr_hash()). The resulting list MUST be strictly ascending (auth_addr[i] < auth_addr[i+1]) and MUST equal the sorted unique spent(addr_version, addr_hash)set 1-to-1. Spending multiple UTXOs belonging to the samexsl1:orxsl2:address requires only oneTxAuthentry, and a single transaction may cleanly mixxsl1:andxsl2:inputs. - SQIsign Verification: For every
aintx.auth, verify oversighash:SingleSig:verify_compressed(a.pubkey, sighash, a.sig)MUST succeed.Multisig: for allM = a.thresholdpairs(signer_idx, sig)ina.sigs,verify_compressed(a.pubkeys[signer_idx], sighash, sig)MUST succeed.
- Fee:
fee = sum(inputs.amount) - sum(outputs.amount).
4.5 Block Validation Rules
For a candidate block at height = parent.height + 1:
block.to_bytes().len() <= 1,000,000.header.version == 1.header.prev_hashrefers to a known valid block (parent).- Timestamp:
header.timestamp > MTP_11(parent)(whereMTP_11is the element atlen / 2of the sorted timestamps of up to 11 consecutive ancestors ending atparent), andheader.timestamp <= local_unix_time + 1,200. - Difficulty:
header.target_bits == next_target_bits(params, recent_headers(parent, 61)). - Proof-of-Work:
RandomX(seed(height, parent), header[0..85]) <= bits_to_target(header.target_bits). - Merkle Root:
transactionsis non-empty andheader.merkle_root == Block::compute_merkle_root(&transactions). - Coinbase (
transactions[0]):coinbase_height == Some(height),inputsandauthare empty,1 <= outputs.len() <= 1,024, every output hasaddr_versionin{1, 2}(allowing mining directly to anxsl2:multisig vault) andamount >= 1(CONSENSUS_MIN_OUTPUT), andsum(cb.outputs) <= BLOCK_REWARD + total_fees(checkedu64). - Non-Coinbase Transactions (
transactions[1..]): Validated sequentially against the pre-block UTXO set atspend_height = height. Spent inputs are removed immediately upon validating each transaction (preventing intra-block double spends), while newly created coinbase and transaction outputs are inserted into the UTXO set only after all transactions in the block succeed (prohibiting intra-block unconfirmed chaining). - Fork Choice: Cumulative work
cum_work(B) = cum_work(parent) + work_from_bits(B.target_bits)(saturatingU256). The active chain is the valid chain with strictly greatestcum_work.
5. RandomX Proof-of-Work & Epoch Rotation
5.1 Compact Target (target_bits) and Work
target_bits is a 32-bit unsigned compact encoding:
exp = bits >> 24— MUST satisfy1 <= exp <= 32.mant = bits & 0x00ff_ffff— MUST satisfymant != 0and(mant & 0x0080_0000) == 0.- The 3 big-endian bytes of
mantare placed starting at byte index32 - expof a 32-byte zero-initialized big-endian buffer (truncated at index 32 ifexp < 3), yielding a 256-bit unsigned integertarget. - A 32-byte RandomX hash
H(interpreted as a big-endian 256-bit unsigned integer) satisfies PoW iffH <= target. - Block work is defined deterministically as:
(withwork(target) = floor(2^256 / (target + 1)) = floor((2^256 - 1 - target) / (target + 1)) + 1work(2^256 - 1) = 1).
5.2 Automatic Epoch Rotation (No PoW Hard Forks)
RandomX uses a 32-byte seed key that rotates every 2,048 blocks with a 64-block lag so nodes can pre-initialize the next epoch's cache/dataset without stalling:
if height < 2048 + 64: // heights 1 ..= 2111
seed = genesis_randomx_seed(params)
else: // height >= 2112
seed_height = floor((height - 64) / 2048) * 2048
seed = ancestor_block_hash(parent, seed_height)
Because seed is looked up along the candidate header's own ancestor chain, competing forks compute their RandomX keys deterministically without consensus ambiguity.
- Validating nodes run RandomX in Light Mode (~256 MB RAM).
- Solo miners may enable Full-Memory Mode (~2 GB shared
RandomXDatasetacrossNworker threads) for ~10x higher CPU hashrate on identical consensus rules.
6. Per-Block LWMA Difficulty Adjustment
Difficulty is recalculated for every block using an integer Linearly Weighted Moving Average (LWMA) over up to LWMA_WINDOW = 60 preceding intervals (N + 1 headers H[0..=N] ordered oldest to newest, where H[N] is the parent tip):
- If
headers.len() < 2(i.e. mining Block 1 on top of Genesis): returnparams.initial_target_bits. - Let
N = min(headers.len() - 1, 60)andT = 300. - Initialize
prev_ts = H[0].timestamp. Fork = 1 ..= N:this_ts_k = max(H[k].timestamp, prev_ts.saturating_add(1))dt_k = clamp(this_ts_k - prev_ts, 1, 6 * T)(clamped to[1, 1800]seconds with monotonicprev_tsto resist timestamp-alternation manipulation).prev_ts = this_ts_kweighted_solvetimes += k * dt_k(saturatingu64).sum_work += work_from_bits(H[k].target_bits)(saturatingU256).
- Compute target work using exact 320-bit intermediate multiplication (
U256::mul_div_u64) to prevent intermediate overflow:expected_weighted = T * N * (N + 1) / 2 avg_work = floor(sum_work / N) next_work = floor((avg_work * expected_weighted) / max(weighted_solvetimes, 1)) - Convert back to target:
raw_target = max_target if next_work == 0 = max(floor((2^256 - 1) / next_work), 1) otherwise - Apply single-block smooth clamp relative to the tip (
tip_target = min(bits_to_target(H[N].target_bits), max_target)):min_step = min(max(floor(tip_target / 2), 1), max_target) max_step = max(min(tip_target * 2, max_target), min_step) clamped = min(clamp(raw_target, min_step, max_step), max_target) - Return
target_to_bits(clamped).
All arithmetic is exact unsigned integer math (u64 / U256) with zero floating-point operations.
7. Deterministic Genesis Block & Epoch-0 Seed
Each network (mainnet, testnet, devnet) derives a deterministic, hardcoded Genesis Block (Height 0) and RandomX Epoch-0 Seed (Heights 1..=2111) directly from its network seed and genesis timestamp with zero external dependencies.
7.1 Genesis Commitment & Epoch-0 Seed Derivation
Let genesis_seed be the ASCII network seed ("scruple-mainnet-genesis-v1" for Mainnet, "scruple-testnet-genesis-v1" for Testnet, "scruple-devnet-genesis-v1" for Devnet) and genesis_timestamp be the u64 Unix timestamp (little-endian; 1796256000):
genesis_preimage = genesis_seed || genesis_timestamp (u64_le)
genesis_commitment = BLAKE3("scruple-genesis-v1" || genesis_preimage)
genesis_randomx_seed = BLAKE3("scruple-rx-genesis" || genesis_preimage)
The deterministic Genesis Block (Height 0) is constructed as:
transactions = [Transaction::new_coinbase(height=0, reward_addr=genesis_commitment, amount=100_000_000)](unspendable burn output; never inserted into the active UTXO set)header.version = 1header.prev_hash = genesis_commitmentheader.merkle_root = Block::compute_merkle_root(&transactions)header.timestamp = genesis_timestampheader.target_bits = params.initial_target_bitsheader.nonce = 0genesis_hash = header.block_hash() = BLAKE3("scruple-header-v1" || header[0..85])
7.2 Inspecting the Genesis Block
Run the deterministic genesis inspector locally for any network:
scruple genesis --network mainnet
Confirm that the printed genesis_hash and randomx_epoch0_seed match the running node (scruple info) bit-for-bit.
8. Non-Consensus Node Policy & Transport Overview
The following rules are local node/network policy (not consensus-critical, so nodes may tune limits without forking):
- Mempool Anti-DoS, Policy Dust, Ownership-Proven FSS-RBF & 0-Conf Protection:
- Minimum relay fee rate:
1 grain / byte(MIN_RELAY_FEE_PER_BYTE). - Mempool/wallet dust floor:
5,000grains (DUST_FLOOR,0.00005 XSL), enforced on mempool acceptance and wallet coin selection while keeping consensus minimum output at1grain so fee-market changes never require a consensus fork. - Bounded mempool memory cap:
50,000,000bytes (MAX_MEMPOOL_BYTES), evicting lowest fee-rate transactions when full, plus a 72-hour expiration TTL (DEFAULT_MEMPOOL_TTL_SECS = 259,200) and periodic 5-minute rebroadcast of aged unconfirmed transactions. - Ownership-Proven First-Seen-Safe RBF (
MSG_TX_BUMP = 12): Stuck unconfirmed transactions can be fee-bumped without compromising 0-conf commerce. ATxBump { tx, shrink_proofs }replaces conflicting mempool transaction(s) iff: (a)txstrictly raises both the fee rate (>= max_old_rate + 1 gr/B) and total fee (>= sum_old_fees + new_size * 1 gr/B); (b) every output of every conflicted mempool transaction is preserved at>=its original amount (exact multiset match), EXCEPT any output reduced or removed MUST be accompanied by a validTxAuthsignature overBLAKE3("scruple-rbf-shrink-v1" || old_txid || new_txid)proving the output recipient (i.e. the sender's own change key) authorized shrinking it (capped atMAX_RBF_SHRINK_PROOFS = 4). A sender with a single UTXO can shrink their own change to bump the fee, or add extra confirmed UTXOs (0 shrink proofs) for 1-output Send Max txs, while merchants' 0-conf outputs can never be reduced, redirected, or removed on honest nodes. - Zero-Conf Double-Spend Proofs (
MSG_DSPROOF = 13): Whenever a node receives a cryptographically valid conflicting transaction that attempts an unauthorized double-spend (without valid FSS-RBF shrink proofs), it rejects the conflict, constructs a compactDoubleSpendProof { outpoint, original_txid, conflicting_tx }, broadcasts it to all peers viaMSG_DSPROOF, and exposes"double_spend_detected": trueonget_txand thedsproofsRPC endpoint.
- Minimum relay fee rate:
- Persistent Storage, Pruning, Ever-Seen Address Index & Transaction Index:
- Disk-backed embedded database (
redb) storing headers, height index, cumulative work, active UTXO set, raw block bytes, per-block undo logs (for fast, bounded-RAM restarts and reorgs), a compactseen_addrstable (32 B per ever-confirmedaddr_hash, surviving spends and pruning so HD gap-limit recovery never stops early across 20+ spent addresses), and an optionaltx_indextable (txid [32 B] -> (height u64_le, tx_index u32_le)). - Optional pruning (
--prune <N>, CLI/GUI minimum288blocks) retains all headers, the full active UTXO set, andseen_addrswhile discarding raw block bodies and undo logs older than the most recentNblocks. - Optional
--txindexmaintainstx_indexatomically across tip extensions and chain reorganizations (backfilling from unpruned blocks on startup if needed) and is mutually exclusive with--prune/ pruned databases.
- Disk-backed embedded database (
- P2P Transport, Discovery & Privacy:
- Framed TCP (
[4B p2p_magic][1B kind][4B len_le][payload],MAX_FRAME_LEN = MAX_BLOCK_SIZE + 128) wherep2p_magicis per-network ("XSL1"Mainnet,"XSLT"Testnet,"XSLD"Devnet), so peers from different networks reject each other immediately at the 4-byte framing header. - Persistent peer connections with
Ping/Pongkeepalives, bounded slots (MAX_OUTBOUND = 8,MAX_INBOUND = 32),/16IPv4 and/32IPv6 outbound subnet diversity for all gossiped/DNS/persisted peers (while operator-specified--peer/ RPCadd_peertargets bypass subnet diversity to permit home-LAN full-mesh clusters),GetPeers/Peersgossip, headers-first sync with global cross-peer in-flight block deduplication (GetHeaders→Headers→GetBlock→Block), and misbehavior ban scoring (threshold100→ 1-hour IP ban). - External Address Advertisement (
--external-addr): Advertises a public numericIP:port(e.g.<PUBLIC_IP>:18333on mainnet or<PUBLIC_IP>:28333on testnet; numeric IP required for peer gossip) inMSG_HELLOinstead of the local bind address (essential when binding0.0.0.0:<port>on a VPS) and treats the advertised address and its resolved IPs as self in self-dial checks. - DNS Seed Bootstrapping &
peers.jsonPersistence: Built-in DNS seeds (seed{1,2,3}.scruple.money:18333on Mainnet,seed{1,2,3}.testnet.scruple.money:28333on Testnet, disabled via--no-dns-seeds) are resolved asynchronously viaToSocketAddrson startup and periodically when isolated (0connected peers), expanding all returnedA/AAAArecords into candidate peers; DNS failures log gently and never panic or ban. Healthy non-banned peers are persisted atomically to<data-dir>/peers.json(mode0600, capped at256entries) periodically and on clean shutdown, and reloaded on restart. - Dandelion++ & Fast-Fluff POS Mode: Originated transactions enter a stem phase routed along a per-epoch (10-minute) relay peer with an embargo timer (20 seconds) that automatically falls back to fluff broadcast if the transaction is not observed fluffed (and defers flushing while a node has
0peers so locally submitted transactions are never silently dropped during brief disconnects). Senders may passfast_fluff: true(CLI--fast-fluff) onsubmit_txto bypass stem delay for instant 0-conf POS commerce.
- Framed TCP (
- JSON-RPC Authentication & Explorer Endpoints:
- Local HTTP JSON-RPC server generates a fresh 32-byte random hex
.cookiefile (Unix mode0600) in--data-diron every node startup/restart (replacing any previous token) and requires validX-Scruple-Cookieor HTTP Basic (__cookie__:<hex>) authentication using constant-time comparison on every request. inforeports chain/mempool/peer status includingtxindex: bool,clock_skew_warnings: u64, anddsproof_count: usize.seen_addresses({"addr_hashes": [...]}) returns the subset of address hashes ever confirmed on-chain (including spent/pruned outputs) or currently present in the mempool.bump_tx({"bump_hex": "<hex>"}) validates and relays an Ownership-Proven FSS-RBFTxBump.dsproofslists active 0-conf double-spend proofs;get_txalso reports"double_spend_detected": bool.get_tx({"txid": "<64-hex>"}) returns decoded transaction details, resolved input prevouts (address,amount),fee,fee_per_byte,confirmations,double_spend_detected, andraw_hexfor mempool transactions (always available) and confirmed transactions (requires--txindex).get_block({"height": <u64>}or{"hash": "<64-hex>"}, optional"verbose": true) returns block metadata and raw hex; whenverbose: true, also includes decoded"txs"with resolved inputs, outputs, and fees.get_headers(optional"from_height", optional"count"defaulting to100and capped at2000; omittingfrom_heightreturns the most recentcountheaders ending at tip) returns{ tip_height, headers }including per-block PoWwork(64-char hex),tx_count, andbytes.
- Local HTTP JSON-RPC server generates a fresh 32-byte random hex
- HD Encrypted Wallet Standard:
- 24-word BIP-39 mnemonic (from OS RNG or Bring-Your-Own-Entropy dice rolls
scruple-byoe-dice-v1, coin flipsscruple-byoe-coins-v1, 64-char hexscruple-byoe-hex-v1, or textscruple-byoe-text-v1) → 64-byte seed →child_seed = BLAKE3("scruple-hd-v1" || master_seed_64 || index_u32_le)→ChaCha20Rng::from_seed(child_seed)→ deterministic SQIsign Round-3 Level 1 keypairs, supporting gap-limit (DEFAULT_GAP_LIMIT = 20) UTXO recovery across all receiving and change addresses. - Optional at-rest encryption using Argon2id KDF (
m=19456 KiB, t=2, p=1) + ChaCha20-Poly1305 AEAD with atomic0600file writes and secret zeroization on drop, pending outgoing UTXO tracking, per-UTXO freezing (frozen_outpoints), address/UTXO labeling (labels), and exact byte-rate coin control & Send Max sweeps.
- 24-word BIP-39 mnemonic (from OS RNG or Bring-Your-Own-Entropy dice rolls