5. Proof-of-work: challenge generation and verification
A blockchain proof must be bound to candidate block data. A trusted generator that constructs N by multiplying secret primes would already possess the solution, which would be undesirable for an open mining competition.
FACTOR instead derives a pseudorandom integer W from candidate block-header information using a construction named gHash. A miner can look for an eligible composite in a bounded neighborhood of W and submit a factor that meets consensus requirements. Miners can explore different candidate block inputs to obtain new neighborhoods.
For the reviewed main-branch CheckProofOfWork implementation, let d = nBits, the required candidate integer bit length, and delta = wOffset. The mathematical acceptance conditions include:
- 1 <= d <= 1023 at the proof-checking function level; contextual difficulty rules impose additional constraints.
- N = W + delta.
- abs(delta) <= 16*d.
- L(N) = d.
- The submitted factor p is nonzero and L(p) = ceil(d/2).
- q is reconstructed by integer division and p*q must equal N exactly.
- p <= q.
- Both p and q must pass the configured probable-primality checks.
The resulting factors are used to verify the proof, while all other applicable block-validation and chain-selection rules must also be satisfied. This is a description of the inspected implementation, not a substitute for the consensus code.
Equal factor bit lengths are not a universal acceptance requirement. Put b = ceil(d/2). For odd d = 2b − 1 the other conditions force L(q) = b; for even d = 2b they permit L(q) = b or b + 1. The structural example 253 = 11 × 23 has d = 8, L(p) = 4 and L(q) = 5. It is not a claimed block or a gHash test vector. The smaller illustration 77 = 7 × 11 fails the submitted-factor-width requirement at d = 7 because L(7) = 3 rather than 4.
Hash functions have not been removed from the blockchain. They remain important for block and transaction identification, cryptographic commitments and challenge derivation. Integer factoring replaces hash-target searching as the defining expensive computational component of consensus.
Source: https://github.com/ProjectFactor/FACTOR/blob/main/src/pow.cpp
Versioned limit clarification: Core e224c5277e3ce23677804e0eea6f5c836d30e5eb, pow.cpp rejects nBits = 0 and nBits > 1,023 in CheckProofOfWork. Its ASERT adjustment instead selects even nBits and the mainnet parameter configuration sets nBitsMin = 32 and nBitsMax = 1,022. Values above the ASERT table ceiling trigger its protective halt behavior. Thus the proof-checker ceiling, the configured adjustment ceiling and an observed active network difficulty are three different quantities. IFaaS's 4,159-bit integer serialization bound is a fourth, unrelated limit. A release configuration alone does not establish mainnet activation.
6. Consensus, difficulty adjustment and network security
FACTOR inherits substantial elements of the Bitcoin Core architecture, while modifying consensus to accommodate mathematical proof of work. Compatibility with the Bitcoin Core design does not imply identical consensus rules, chain history, monetary policy or network interoperability.
The reviewed mainnet configuration targets a block interval of 1,800 seconds (30 minutes). Individual block intervals are stochastic and can depart substantially from the target. The source also contains network-specific configurations; testnet and other networks need not use mainnet parameters.
Difficulty adjustment attempts to keep block production near its target as factorization capacity changes. The v6.0.43 release describes a custom ASERT-inspired adjustment mechanism. In the reviewed implementation, the algorithm works in a precomputed log2(compute) space and maps estimated computational difficulty to allowable even nBits values. A simplified representation of the adjustment before table quantization is:
log2(C_target) = log2(C_anchor) + (h*T - t)/H
where C is modeled computational cost, h is the block-height difference from the anchor, T is the target interval, t is elapsed time relative to the anchor and H is the configured half-life. Main-branch mainnet parameters specify H = 172,800 seconds (two days). Blocks arriving ahead of schedule increase modeled difficulty; blocks behind schedule decrease it. The code also includes bounds and a protective halt condition for difficulty beyond its supported maximum. Consult the exact implementation and active deployment state before relying on this formula operationally.
A software release or a deployment start time does not establish that a consensus upgrade has activated on mainnet. Activation depends on the relevant versioned rules and observed network state.
As with any PoW chain, security depends on the distribution of effective computational capacity, validation behavior, network conditions and the incentives of participants. Factorization progress could change the threat model. Network decentralization, resistance to reorganizations and attack costs require empirical assessment; the mathematical puzzle alone does not guarantee these properties.
Sources: https://github.com/ProjectFactor/FACTOR/blob/main/src/pow.cpp ; https://github.com/ProjectFactor/FACTOR/blob/main/src/chainparams.cpp ; https://github.com/ProjectFactor/FACTOR/releases
Exact header and challenge construction
The reviewed CBlockHeader serializes 218 bytes, in this order:
| Field | Bytes |
|---|---|
| nP1, submitted unsigned factor | 128 |
| hashPrevBlock | 32 |
| hashMerkleRoot | 32 |
| nNonce, unsigned | 8 |
| wOffset, signed | 8 |
| nVersion | 4 |
| nTime | 4 |
| nBits, integer challenge bit length | 2 |
The inherited integral serializers are little-endian; displayed hash strings do not specify internal byte order. GetHash identifies the serialized block header and is distinct from gHash.
gHash builds a 72-byte password from previous-block bytes, Merkle-root bytes and nonce, plus a 10-byte salt from version, difficulty and time. It first derives 256 bytes with scrypt (N = 4096, r = 2, p = 1). Mainnet configures one further hash round combining scrypt, population-count-dependent BLAKE2b/SHA3-512, integer roots, next-prime and modular-inverse operations, and data-dependent modular exponentiation/hash branches including Whirlpool. It then retains d low bits and sets the highest retained bit to obtain W. The submitted factor and offset are not challenge inputs.
This is a construction overview, not a portable implementation recipe. Scalar inputs use raw memcpy and GMP imports use native word endianness; the branch population count explicitly reads eight bytes. Exact byte semantics and cross-platform vectors matter. Mainnet configures 50 probable-primality rounds; these checks are not primality certificates.
Difficulty arithmetic and chainwork
The ASERT compute table has 511 committed Q32.32 entries for even d = 2 through 1022. Its model is log2(C(d)) = 0.0301 × log2(3.8) × d + 2 × log2(d). In the adjustment equation above, h and t are differences from the anchor to the parent itself: no extra +1 or anchor-parent time is inserted. Being one half-life behind halves modeled compute before quantization; it does not halve nBits.
For real BIP9 activation the anchor is the final LOCKED_IN block; always-active networks use block 1. Integer arithmetic, truncation toward zero and the committed table determine results. The nearest table entry is selected, ties toward lower/easier difficulty. A target strictly greater than the maximum table entry causes nBits = 1024, which proof checking rejects; equality at the maximum is allowed. This protective halt is neither a normal accepted difficulty nor a quantum detector.
Mainnet configures ASERT bit 24, a 672-block period with threshold 639, a signaling window from 2026-03-01 to 2027-03-01, and a 172,800-second half-life. The interim path uses bit 25, a 42-block period with threshold 40 and at most 1,344 active blocks. These configurations do not prove activation. Earlier interval algorithms remain distinct; consult the engineering specification rather than applying ASERT bounds to every historical path.
Chain selection uses accumulated work, not block count alone. With submitted-factor bit length b ≥ 16, GetBlockProof computes a = sqrt(2 × b × log2(b)), k = floor(a), f = floor(1024 × (a − k)), then work = (1 << k) + (f << (k − 11)). For b < 16 it returns zero. This floating-point ECM-inspired scoring proxy is separate from the ASERT table, measured energy and Bitcoin's inverse-target formula.
Contextual checks require the exact next difficulty, time strictly greater than the parent and all applicable deployment and transaction rules. At this revision the ordinary future-time allowance is 30 seconds; regtest differs. Maximum block weight is 80,000,000. These are reviewed source facts, not a measurement of current network state.
Engineering references
- Mathematical consensus and difficulty adjustment.
- Reviewed implementation: header layout, proof and ASERT, committed compute table, chainwork.
