On this page
21 — Block application and rewards
Out of scope the validity checks before application (19); the selection draws and the skipped-blocksmith list (20 §5); the score road, the missing state, suspension and expulsion in full (36); the per-block processors between the fee scale and the prune (22); receipts and their selection (23); the admission timer, the queue, key changes, claims, exits and the roll call (09); the genesis premine and the derived pool (06 §8); snapshots (26); the full schema of every table (07)
§0 The area in one paragraph
Applying a valid block is one database transaction in a fixed order: the pre-transaction sweeps
run, the block's transactions are normalised and executed one by one, its receipts are stored, the
skipped blocksmiths are recorded, the block is stored, and in storing it the reward pool of the
block is paid: the coinbase the emission curve grants for the seconds elapsed since the previous
block (exactly the schedule), plus every fee the block kept (the overpay is refunded), plus a
per-block slice of the longevity pool, plus whatever waited in the lottery carry, drawn by
lottery among the registered nodes that earn at the block (not missing, not suspended, mature)
in proportion to their score, one draw per second of the previous gap, each winner an equal
share — or split evenly when no holder has a weighable score; a reward nobody can take waits in the
carry for the next block. Then the registry step (key changes, claims, the roll call's close, held
exits, the admission clock and the queue), the liveness step that moves every score by the score
road and expels a node at score zero (never below three; paused while the chain is in survival
mode, 19 §10), the leave step, the fee scale, every periodic processor, the prune, and the
transaction commits; a step that cannot read what it decides on refuses the block. After the commit
the mempool drops the block's transactions and the block is relayed. Every amount here is an
integer; the emission curve and the lottery's scaled scores alone are computed in IEEE double
precision, identically on every node, and floored.
1. The order of application
Purpose. An implementation must apply a valid block's effects in exactly this order, because later steps read what earlier steps wrote.
Inputs. The validated block, its previous block, the state.
Output and effect. Under the chain lock, inside one database transaction:
- The tip re-check, the one-transaction-per-account check and the batch ceiling (
19§4); transaction normalisation and the duplicate checks. - The mempool's reservations are undone (
04§7). - The pre-transaction sweeps (
22): escrow expiry (12), liquid-payment completion (08), due solo apps and channel settlements (16), unstarted apps closing themselves (16§3a), order expiry (15). - The blocksmith's owner account is read from the registry as of the block (a failed read refuses
the block); the exchange's taker fee (
15) is paid to it only when the blocksmith earns at this block (§2), otherwise into the lottery carry. Then every transaction is executed in order (08§1; an error refuses the block; a governance or bridge transaction in a block judged in survival mode is such an error,19§10). - The published receipts are processed and stored (
23); a self-produced block skips their re-validation. - For height > 1 the skipped-blocksmith step (
20§5; it writes rows from height 40; no score moves here); a failed registry read or row write refuses the block. - The archive's storage-epoch reward (
11,26), before the lottery slices the longevity pool. - The block is stored (the block row, its transactions, its receipts, its Merkle tree), the
exact-coinbase check (
19§2 step 14) runs, and the reward lottery of §2 is paid. - The block's survival flag is stored (
19§10). - Unless the block is genesis: the registry step of §4, the liveness step (§3,
36: the score road, suspensions, the expulsions at zero), the leave step (held exits that end,09§5); a failure of any of the three refuses the block. - The fee-scale count (
17§3). - The processors of
22in their order: own-dataset billing, token expiry, account rent, triggers, schedules, gateway pruning, storage rent, market rent, longevity rent, the per-period longevity payout (which does nothing while rulelongevity_continuousis active, every live chain), storage proofs, oracle resolution, bridge deposits, bridge withdrawals, the price count, release governance (17). A step that could not read what it decides on (including every list read: the accounts due for rent, the due triggers and schedules, the tokens to settle, the gateways to prune, the datasets to bill, the apps and settlements to resolve, the markets and orders, the attestations, the group and token-holding lookups) refuses the block after the last of them. - The rule edge records (
29§4c); a consensus-parameter or row read that failed during the apply refuses the block (19§4); then the readiness gate advances: with block h applied the window for h + 1 is complete, and a gated bundle whose tally passes gets effective height h + 1 and (rulereadiness_decision_state) its decision rowreadiness_bundle_decision(bundle_id,effective_height= h + 1,height= h,latest; versioned bybundle_id), written inside this block's transaction (29); a row that cannot be written refuses the block. - Pruning (
13§8). - A storage fault noted anywhere above (every write the storage itself failed during the apply,
whether or not its step checked the result,
19§4), or a failed read after step 13, refuses the block; the readiness gate forgets a decision step 13 made (its row rolls back with the block); the pool's remaining reservations go back on; commit. A commit that fails is a local fault: the block is not applied on this node and the gate forgets the decision step 13 made, exactly as on the refusals above (the row never reached the disk), so the next attempt at the block decides again.
After the commit: the block's transactions leave the mempool, the registry cache is refreshed,
receipts are batched (23), the snapshot scheduler is told (26), the block is broadcast when it
was produced here.
How to compute it. As stated. A consequence an implementation must reproduce: the lottery (step 8) reads the scores in force before the block's own liveness step (step 10), so a blocksmith's score change from block h first weighs in the lottery of block h + 1.
Rule activation. readiness_decision_state (step 13), active from height 0 on every chain;
none for the order itself.
Rejections and errors. 19 §4.
Vector. computed. INPUT: node 715ea8e2… (owner account
00000000b6675786bedf28b3e7dcd8bac9bf99758b3a64604570bffd12fd10cbf20b39ea) produces block 12,513
with 10 unlinked receipts on a registry of 11 (P = 12, unit 2,880); its stored score in force
before block 12,513 = 2,208,841,765,235; the block's receipt delta (§3 vector 1) = +238,715,277.
EXPECTED OUTPUT: the lottery of block 12,513 weighs it at 2,208,841,765,235; its stored score
after block 12,513 = 2,209,080,480,512, the value the lottery of block 12,514 and of block 12,515
(§2 vector 2) weighs it at.
Test cases · §1
3 cases · 3 valid · 2 reference
Block 12,513's receipt delta (10 unlinked receipts, n = 11, P = 12, unit 2,880)
Loading the test widget…
The lottery of block 12,513 weighs its blocksmith before the block's own score change
2,208,841,765,235 + 238,715,277 = 2,209,080,480,512: the score change of block h first weighs in the lottery of h + 1.
A stated value: there is nothing to compute. A compatible node shows the same value.
- weighed_at_12513
2208841765235- score_after_12513
2209080480512- weighed_at_12514_and_12515
2209080480512
Step 13: the readiness decision row written in block h's transaction
The tally that qualifies a bundle is 29's.
A stated value: there is nothing to compute. A compatible node shows the same value.
- row
readiness_bundle_decision (bundle_id, effective_height = h + 1, height = h, latest), versioned by bundle_id- rule
readiness_decision_state- a row that cannot be written
refuses the block- a refusal or a failed commit after step 13
the gate forgets the decision; the next attempt decides again
Defects to match. None known.
2. The coinbase, the pool and the lottery
Purpose. An implementation must compute exactly what a block emits, the amount its lottery pays, who holds a ticket, who wins and what each winner receives.
Inputs.
- From the chain's metadata (written by the genesis builder,
06§8):genesis_timestamp(i64, s; 1,793,509,027 in both shipped genesis files), the derived poolcoinbase_total_distribution(i64, atomic units: the target supply less the genesis accounts and node balances; the testnet file's is 2,068,282,231,333,333,06§8),coinbase_number_rewards_per_second(1 in both files; default 1),coinbase_max_number_rewards_per_block(600 in both; default 600). COINBASE_SMOOTHING_PER_WINNER= 100,000,000 (1 ZBC); the RNG prefixzbc-coinbase(12 ASCII bytes, no terminator).- The block:
height,timestamp,total_coinbase,total_fee; the previous block'stimestampand 64-byteblock_seed; the previous-previous block'stimestamp. - The ledger rows the block wrote before the lottery (table
account_ledger, below). - The longevity pool account
00000000 ‖ "ZBCLONGV" ‖ 24 × 00=000000005a42434c4f4e4756+ 48 hex zeros (36 bytes), its balance; the longevity billing period (longevity_billing_period_blockswhen positive, elsemain_snapshot_interval: testnet 172,800, devnet 240). - The lottery carry account
00000000 ‖ "ZBCCARRY" ‖ 24 × 00=000000005a42434341525259+ 48 hex zeros, its balance. - The registered nodes in force at the block's height with their owner accounts, registration
heights and stored scores (tables
node_registry,participation_score); who earns at the block (tablenode_liveness, the unit clock, the roll call,20§7).
Data used. account_ledger: one row per balance movement — account_address (bytes, the
canonical account), balance_change (i64, signed), block_height (u32), transaction_id (i64; 0
for block-level rows), event_type (i32), timestamp (i64, the block's timestamp). Read here: "the
sum of balance_change over the rows with block_height = h and event_type = e" (0 when none; a
failed read refuses the block). participation_score: versioned rows (node_id, height, score,
latest), key (node_id, height); "the score in force at h" = the row of that node with the
greatest height ≤ h; a registered node without one counts 0 here. node_registry: versioned rows (id,
height, registration_status, account_address, registration_height, …); "the registered nodes in force
at h" = for each id the row with the greatest height ≤ h, kept when its status is Registered (0),
in ascending id order. Balances are written as new versions of the account's row at the block
height (07).
Output and effect.
Emission. D(t) for a timestamp t, computed in IEEE-754 double precision exactly in this order:
Tq = 473,040,000 (15 × 365 × 86,400); smin = 1 / (1 + exp(−3)); smax = 1 / (1 + exp(−6));
τ = (double)(t − genesis_timestamp) / (double)Tq, clamped to [0, 1]; x = τ × (6 − 3) + 3;
sx = 1 / (1 + exp(−x)); y = (sx − smin) × (1 / (smax − smin)) (a multiplication by the
reciprocal, not a division); D(t) = floor(y × (double)pool) as i64. A block's total_coinbase must
equal D(block.timestamp) − D(previous.timestamp), and 0 at height 1 (checked at store, 19 §2
step 14). An empty block carries the schedule's coinbase like any other.
The amount R (every block above genesis): R = total_fee + total_coinbase − Σ(event 22 rows of the block) − Σ(event 70 rows of the block), floored at 0. Event 22 (the fee refund, positive) takes
out every overpay refunded at settlement (04 §5); event 70 rows (a multisig inner fee, negative)
add the inner fee; event 45 survival payments go to the longevity pool instead (13 §10) and are
not in the formula. No part of a fee goes to the blocksmith as blocksmith. A fee paid out of a node's
lock or stake (a queued node's attendance, the fee of an exit or a claim whose lock is held) is
credited to the longevity pool (event 80) and the payer carries the pair event 22 +fee / event 47
−fee, so the formula takes it out of the lottery again.
The longevity slice (height > 1, rule longevity_continuous): slice = floor(balance / (period − height mod period)) of the longevity pool's balance; when > 0 it is debited from the pool
with a ledger row event 39 (−slice, transaction_id 0) and added to R.
Nothing to do: when R ≤ 0 and the carry's balance ≤ 0, nothing is written.
The carry: carry(x) = when x > 0, credit x to the lottery carry with a row event 75 (+x). At
height 1: carry(R) and stop (block 1 draws nobody; its fees wait for block 2).
Ticket holders: the registered nodes in force at the block's height, in ascending node id, each with its
owner account, registration height and score in force (§ Data used), kept when it earns at the
block (20 §7: not missing and not suspended as of the previous block, mature, and during the roll
call answered). No holder → carry(R) and stop. Otherwise the carry's whole balance, when > 0, is
debited (row event 75, −carried) and added to R; then R ≤ 0 → stop.
Draws. count = the number of holders. Each holder's scaled = floor((double)score / (double)count); holders with scaled ≤ 0 are dropped from the draw list; total = Σ scaled.
When the draw list is empty: under rule small_n_measurement R is split evenly among all
holders in id order — share = floor(R / count), the first holder also the remainder R − share × count, each amount > 0 credited as below — else carry(R). Otherwise:
gap= previous.timestamp − previous-previous.timestamp (ruledraw_count_previous_gap; a missing previous-previous block refuses the block:"Previous-previous block not found for the lottery's draw count at height H").n = min(gap × rewards_per_second, max_rewards_per_block, count).f = floor(R / 100,000,000); whenf > n:n = min(f, max_rewards_per_block, count).n ≤ 0→carry(R)and stop.- The generator
RNG("zbc-coinbase", previous block_seed)of20§1; for each of the n drawsr(a non-negative 63-bit value):w = r mod total; the winner is the first entry of the draw list whose range[c, c + scaled)contains w,cthe sum of the scaled scores before it. Repeats are allowed. - Each winner, in draw order, receives
floor(R / n); the last draw alsoR mod n. Each amount is credited through the ordinary balance path (a group member's credit lands on its group,18; a new account's rent clock starts,13) with a ledger row event 8 (transaction_id0, the block's timestamp) on the canonical account.
The blocksmith receives nothing as blocksmith: a blocksmith that earns holds a ticket like any other.
How to compute it. As stated. The only floating-point consensus values are D(t) and the
scaled scores, both floored to integers; an implementation must use IEEE-754 binary64 with
round-to-nearest and the same exp.
Rule activation. longevity_continuous, draw_count_previous_gap, payout_instant,
small_n_measurement, registry_as_of_prev, balance_credit_full_row, liveness_miss_rule,
survival_field are active from height 0 on every chain. The exact coinbase, the carry and the
earning filter have no rule.
Rejections and errors. At store time the block is refused: "Negative total_coinbase",
"total_coinbase exceeds emission schedule: got X, max Y", "total_coinbase below emission schedule: got X, schedule Y", "Previous block not found for the coinbase schedule at height H"; a
failed read or credit refuses the block.
Vector.
- Emission,
computed(the testnet genesis file's values). INPUT:genesis_timestamp1,793,509,027;pool2,068,282,231,333,333 (06§8). EXPECTED OUTPUT: D(1,793,509,027) = 0; D(1,793,509,042) = 197,732,213 (but block 1 carries 0); D(1,793,509,057) = 395,464,421; D(1,793,509,072) = 593,196,609; D(1,793,509,087) = 790,928,787; D(1,793,713,987) = 2,700,224,364,208; D(1,793,714,002) = 2,700,421,863,911; D(genesis + 473,040,000) = D(genesis + 473,040,015) = 2,068,282,231,333,333 (the curve ends: later blocks carry 0). So a block 1 at 1,793,509,042 carries 0; a block 2 at 1,793,509,057 carries 197,732,208; a block 3 at 1,793,509,072 carries 197,732,188; a block 4 at 1,793,509,087 carries 197,732,178; a block at 1,793,714,002 whose previous block is at 1,793,713,987 carries 197,499,703. INVALID: that last block carrying 197,499,704 →"total_coinbase exceeds emission schedule: got 197499704, max 197499703"; carrying 197,499,702 →"total_coinbase below emission schedule: got 197499702, schedule 197499703". - The lottery,
computed(a block 12,515 at 1,793,715,877; its previous block 12,514 at 1,793,715,862 with seed5def70d845c3e055d003019a9ab7dcefa9ccf3d9f14293e260e0386716382f5222e4ecf47cf6d783e782e46dbafd89289adebfd4e25221b41de2a9f8292908af; block 12,513 at 1,793,715,847). INPUT:total_coinbase197,497,578,total_fee0, no event 22/70 rows, longevity slice 0, carry 0 → R = 197,497,578; 11 holders, every one earning, in id order with owner account (00000000+ key-hash prefix shown) and stored score:bccb8082…2,225,858,754,283;ed52418c…2,249,423,362,312;860b8c72…2,223,205,604,473;80e91fec…2,209,973,957,702;0515b3d6…2,222,646,328,706;b6675786…2,209,080,480,512;fb8e0c57…2,243,714,656,977;ca81cff8…2,196,844,617,491;939101b4…2,231,717,509,202;5020059b…2,218,683,655,093;d2cd46bd…2,215,014,260,260. COMPUTED: scaled = 202,350,795,843; 204,493,032,937; 202,109,600,406; 200,906,723,427; 202,058,757,155; 200,825,498,228; 203,974,059,725; 199,713,147,044; 202,883,409,927; 201,698,514,099; 201,364,932,750; total 2,222,378,471,541; gap 15 → n = min(15, 600, 11) = 11; f = 1 ≤ 11. The 11 draws r and w = r mod total: 8,778,447,010,925,468,843 → 933,633,673,400 (0515b3d6); 6,010,454,828,737,276,730 → 1,139,156,040,656 (b6675786); 6,866,204,055,350,416,126 → 1,311,517,602,592 (fb8e0c57); 3,148,200,190,990,825,048 → 1,071,990,559,858 (b6675786); 4,429,788,006,861,009,633 → 1,005,163,309,809 (0515b3d6); 828,186,449,630,277,317 → 1,555,561,222,880 (ca81cff8); 8,166,851,389,441,144,879 → 1,645,138,961,095 (939101b4); 8,337,968,000,549,027,991 → 1,781,073,601,830 (939101b4); 8,901,607,159,676,471,792 → 1,312,248,817,211 (fb8e0c57); 6,306,752,707,003,477,552 → 407,704,037,653 (860b8c72); 4,552,051,560,414,898,027 → 407,105,370,088 (860b8c72). EXPECTED OUTPUT: eleven event-8 rows at height 12,515, ten of 17,954,325 and the last (860b8c72…) 17,954,328 = 17,954,325 + 3. - The pool,
computed. INPUT:total_coinbase197,497,578,total_fee5,000,000, event-22 rows +2,500,000, no event-70 row, longevity pool balance 1,000,000,000 at height 12,515 with period 172,800, carry 0, the 11 holders of vector 2. EXPECTED OUTPUT: slice = floor(1,000,000,000 / (172,800 − 12,515)) = floor(1,000,000,000 / 160,285) = 6,238 (row event 39, −6,238 on the pool); R = 197,497,578 + 5,000,000 − 2,500,000 + 6,238 = 200,003,816; f = 2 ≤ 11, so n = 11; ten shares of 18,182,165 and the last 18,182,166 (200,003,816 = 11 × 18,182,165 + 1). - The carry,
computed. INPUT: block 1 withtotal_fee5,000,000 (no refund). EXPECTED OUTPUT: one row event 75 +5,000,000 on the carry, no event-8 row. INPUT: block 2 with coinbase C and no fee, one earning holder. EXPECTED OUTPUT: a row event 75 −5,000,000 on the carry and R = C + 5,000,000 drawn by the holders. A block whose every registered node is missing →carry(R).
Test cases · §2
17 cases · 14 valid · 3 invalid
The emission curve with the testnet genesis file's timestamp and pool
Loading the test widget…
The coinbase of a block 1 at 1,793,509,042 (previous block at 1,793,509,027)
Loading the test widget…
The coinbase of a block 2 at 1,793,509,057 (previous block at 1,793,509,042)
Loading the test widget…
The coinbase of a block 3 at 1,793,509,072 (previous block at 1,793,509,057)
Loading the test widget…
The coinbase of a block 4 at 1,793,509,087 (previous block at 1,793,509,072)
Loading the test widget…
The coinbase of a block 12400 at 1,793,714,002 (previous block at 1,793,713,987)
Loading the test widget…
That last block carrying 197,499,704
Loading the test widget…
That last block carrying 197,499,702
Loading the test widget…
A negative total_coinbase
Loading the test widget…
After the curve ends a block carries 0
Loading the test widget…
The lottery of a block 12,515 over eleven holders
Loading the test widget…
Fees, a refund and the longevity slice at block 12,515
Loading the test widget…
Block 1's fees wait in the carry
Loading the test widget…
Block 2 takes the carry into its draw
Loading the test widget…
A block whose every registered node is missing carries R
Loading the test widget…
No holder with a weighable score: R is split evenly in id order
Loading the test widget…
Defects to match. (1) Draws are with replacement: in vector 2, five holders took two shares
each. (2) The fee-based raise means a block with R ≥ 1 ZBC draws floor(R / 10⁸) times when that
exceeds the gap count, up to the holder count. (3) A holder whose score is below count has scaled
0 and cannot win. (4) The longevity slice divides by the blocks left in the period, so a pool smaller
than the blocks left pays nothing until the divisor falls. (5) scaled is the floor of a
double-precision quotient, not of the integer quotient: for very large holder counts the double can
round up to the next integer; an implementation must divide in double.
3. Participation scores (what a block applies)
Purpose. An implementation must move the blocksmith's score, charge the skipped nodes and expel
at score zero exactly as the chain does in the block's liveness step (the score road in full is
36).
Inputs. The block's published receipts (a receipt is linked when its rmr_linked field is
non-empty and not 32 zero bytes, else unlinked); the draw set the block was drawn over (n = its
size, 20 §1); the active registry at the previous block (|R|, rule receipt_count_active); the
skipped list (20 §5); the genesis parameters (both live genesis files): score_loss_per_unit_bps
500, score_unit_floor_blocks 2,880 (devnet 120), score_climb_ratio 8 (default 8),
maturity_units 4, liveness_miss_limit 4, default_participation_score 2,000,000,000,000 (20 %),
linked_receipt_score 1, unlinked_receipt_score 1, decrease_score_divider 2,
block_time_interval 15 (default 10), batch_receipt_lookback_height 40; MAX_PARTICIPATION_SCORE
10,000,000,000,000; the priority peers per node P = max_assigned_peers (testnet 12, devnet 8; 5 when
absent; never below 2, 23 §7); LIVENESS_FLOOR_ACTIVE 3; the survival flag of the
block (19 §10).
Data used. participation_score (§2): a changed score is written as a new row (node_id,
height = the block height, score), the node's previous rows losing latest. node_liveness:
versioned rows key (node_id, height) with misses, produced, suspended_height,
suspension_since, last_seen_height, last_block_height, missing_clock, admitted_clock,
last_miss_height, latest; a touched node gets a new row at the block height. score_unit_clock:
one row per applied block (height primary key, clock, unit); "the clock at h" = the row with
the greatest height ≤ h. A pop-off deletes every row of the three tables above the target and
restores latest on the newest remaining row per node (24).
Output and effect. In the liveness step (§1 step 10):
- The unit is
unit = max(n, unit_floor); the clock advances byfloor(10¹² / unit). - The blocksmith: its score becomes its effective score (when it is missing: the stored
score less the loss over its stretch,
loss = min(10¹³, floor(ticks × LossPerUnit / 10¹²)),ticks= clock −missing_clock,LossPerUnit= floor(10¹³ / 10,000) × 500 = 500,000,000,000; floored at 0) plus, from height 40, the receipt delta below; the new score is written when the blocksmith was missing or the height is ≥ 40. Its misses reset,produced+= 1,last_seen_height=last_block_height= h, its missing stretch ends, a suspension lifts. - A ping lifts its sender's suspension (on probation, misses kept) and moves its "last seen";
a receipt moves its signer's "last seen" only (
36). - Each distinct skipped node (not the blocksmith) is charged one miss: missing from now on (its
missing_clock= the clock when it was not missing), suspended atliveness_miss_limitconsecutive misses unless it produced within the suspension floor (36). - Unless the block's survival flag is true (
19§10): every registered node whose effective score is ≤ 0 is an expulsion candidate, ordered least recently seen first, then lower score, then lower id; candidates are expelled while more than 3 registered nodes would remain, the rest are held by the floor (and suspended, rulefloor_on_draw_set). An expelled node's score becomes 0 and its liveness row is reset (§4 for the registry side).
Every score is clamped to [0, 10¹³].
The receipt delta. receipt_score = linked × linked_receipt_score + unlinked × unlinked_receipt_score. cap = min(n − 1, P) (rule small_n_measurement; 0 when n = 0).
With cap > 0: pivot = floor(cap / 2), half = max(1, floor(cap / 2)), cap_eff = cap; with
cap = 0: pivot = floor((P − 1) / 2), half = floor(P / 2), cap_eff = P (testnet 5, 6, 12).
ClimbPerUnit = floor(LossPerUnit / max(1, score_climb_ratio)) = 62,500,000,000.
- At or above the pivot:
full = cap_eff × max(1, min(linked_receipt_score, unlinked_receipt_score))(the full set is one receipt per priority peer, of either kind);span = max(1, full − pivot);got = min(receipt_score, full) − pivot;delta = floor(got × ClimbPerUnit × n / (span × unit))in 128-bit integers, at most 10¹³. A block with the full set climbs exactlyClimbPerUnit × n / unit; more receipts than the full set climb no further; fewer climb in proportion. - Below the pivot:
drift = floor(floor(10¹³ / blocks_per_week) / decrease_score_divider)withblocks_per_week = floor(604,800 / block_time_interval)(40,320 at 15 s → drift 124,007,936);delta = −min(10¹³, floor((pivot − receipt_score) × max(0, |R|) × drift / half)).
How to compute it. As stated; 36 gives the clock, the missing state, the suspension floor and
the expulsion order in full.
Rule activation. receipt_count_active, small_n_measurement, liveness_miss_rule,
one_round_formula, floor_spares_recent, floor_on_draw_set and survival_mode (the
expulsion pause, 19 §10) are active from height 0 on every chain. The score road itself has no
rule.
Rejections and errors. A failure of the liveness step (an unreadable draw set, registry, row, clock or survival flag, a blocksmith list that cannot be computed, a sign that cannot be recorded) refuses the block (§1 step 10).
Vector.
computed(n = 11, unit 2,880, |R| 11, P = 12). INPUT: the blocksmith of block 12,513 with 10 unlinked receipts, not missing, stored score 2,208,841,765,235. COMPUTED: cap = min(10, 12) = 10, pivot 5, full 10, span 5, got = min(10, 10) − 5 = 5, delta = floor(5 × 62,500,000,000 × 11 / (5 × 2,880)) = 238,715,277. EXPECTED OUTPUT: new score 2,209,080,480,512. A blocksmith at 2,214,775,544,983 with 10 receipts goes to 2,215,014,260,260 (+238,715,277).computed, the same parameters (P = 12): 12 receipts → +238,715,277 (no further than the full set of 10); 9 → +190,972,222; 7 → +95,486,111; 5 → 0 (the pivot); 4 → −floor(1 × 11 × 124,007,936 / 5) = −272,817,459; 1 → −1,091,269,836; 0 → −1,364,087,296. Devnet (unit floor 120, n = 11, P = 8: cap 8, pivot 4, full 8, span 4), full set → floor(4 × 62,500,000,000 × 11 / (4 × 120)) = +5,729,166,666. A chain of 3 registered nodes (n = 3, cap 2, pivot 1, half 1, full 2, span 1, unit 2,880): 2 receipts → +65,104,166; 0 receipts → −372,023,808.- The unit clock and the loss,
computed(unit 2,880). INPUT: a node missing since clock c. EXPECTED OUTPUT: each block advances the clock by 347,222,222; after one block its effective score is 173,611,111 lower; after 2,880 blocks (ticks 999,999,999,360) 499,999,999,680 lower. - Expulsion,
computed. INPUT: 4 registered nodes, two of them at effective score 0 after the step, last seen at heights 900 and 950, survival flag false. EXPECTED OUTPUT: the registered node last seen at 900 is expelled; the other is held by the floor (3 must remain) and suspended. With the survival flag true: no candidate, nobody expelled, no row changed by this rule.
Test cases · §3
15 cases · 15 valid
12 receipts on a registry of 11 (P = 12, unit 2,880)
Loading the test widget…
9 receipts on a registry of 11 (P = 12, unit 2,880)
Loading the test widget…
7 receipts on a registry of 11 (P = 12, unit 2,880)
Loading the test widget…
5 receipts on a registry of 11 (P = 12, unit 2,880)
Loading the test widget…
4 receipts on a registry of 11 (P = 12, unit 2,880)
Loading the test widget…
1 receipts on a registry of 11 (P = 12, unit 2,880)
Loading the test widget…
0 receipts on a registry of 11 (P = 12, unit 2,880)
Loading the test widget…
Devnet: a full receipt set (unit floor 120, n = 11, P = 8)
Loading the test widget…
A chain of 3 registered nodes: 2 receipts
Loading the test widget…
A chain of 3 registered nodes: no receipt
Loading the test widget…
The unit clock at unit 2,880 and the loss per block
Loading the test widget…
The loss after 2,880 blocks missing
Loading the test widget…
Four registered nodes, two at score 0 last seen at 900 and 950
Loading the test widget…
The same in survival mode
Loading the test widget…
Same last seen: the lower score first, then the lower id
Loading the test widget…
Defects to match. (1) blocks_per_week derives from block_time_interval with 10 s as the
default, so a chain without the parameter drifts at another rate (drift 82,671,957). (2) With
linked_receipt_score = unlinked_receipt_score = 1 (both shipped genesis files) the two kinds weigh the same.
4. Registry changes at the block boundary
Purpose. An implementation must apply the registry changes due at each block in this order.
Inputs. The registry, the scores, the queue (09); the admission clock row
(node_admission_timestamp: versioned rows timestamp, block_height, latest); the pending key
changes, claims, roll-call answers and exit holds; LIVENESS_FLOOR_ACTIVE 3; node_lock_at_risk_bps
1,000; max_node_admittance_per_cycle 1 (both shipped genesis files).
Output and effect. After the block is stored (height > 0), the registry step, in order:
- The node-key changes due at this block take effect (
09§4). - The claims due execute (
09§6). - At the roll call's last block the genesis registered nodes that never answered leave the registry (
09). - The exit holds due at this height come back to their owners (
09§5). - The admission clock: when no row exists it is seeded at the genesis timestamp +
node_admission_genesis_delay(height 0). - The queue's attendance is evaluated at its window (
09§9, rulesqueue_attendance,attendance_tail). - A queued node that produced this block (every active node was suspended) is admitted by it.
- When
block.timestamp ≥the next admission timestamp: a new clock row is written (re-anchored at the block's timestamp when the block is at least one admission delay late, ruleadmission_timer_reanchor) and up tomax_node_admittance_per_cyclequeued nodes are admitted (09§8–§10; a node registered in this block is skipped).
Then the liveness step (§3) with the expulsion at score zero: an expelled registered node gets a new
registry row with status Deleted; its lock is returned to its owner account less the at-risk share
floor(lock × node_lock_at_risk_bps / 10,000), which is credited to the longevity pool (event 76);
the owner's refund carries a ledger row event 4; its liveness record is reset (a key that registers
again is a newcomer). Then the leave step: the registered nodes whose exit hold ends at this block leave the
registry (09 §5). A failure of any step refuses the block.
Rule activation. liveness_miss_rule, queue_attendance, attendance_tail, claim_two_step,
node_key_rotation, admission_timer_reanchor, one_node_per_owner (a second registration by
an owner that already holds a node is a paid no-op, 09) and survival_mode (the expulsion
pause, 19 §10) are active from height 0 on every chain.
Rejections and errors. A failed step refuses the block (log "Node registry step failed at height H: … (block refused)", "Leave step failed at height H: … (block refused)").
Vector. computed. INPUT: an expelled registered node with lock 100,000,000,000 (1,000 ZBC),
node_lock_at_risk_bps 1,000. EXPECTED OUTPUT: the longevity pool +10,000,000,000 (event 76), the
owner account +90,000,000,000 (event 4), a Deleted registry row at the block height. INPUT: a chain of 4
registered nodes where two of them reach score 0 in one block. EXPECTED OUTPUT: only the one seen least recently is
expelled (3 must remain).
Test cases · §4
1 case · 1 valid
An expelled registered node's lock of 1,000 ZBC
Loading the test widget…
Defects to match. None known.
5. Ledger rows and the consensus/local split
| Event | Row | Written by |
|---|---|---|
| 8 | winner +share (an even-split holder +share) | the lottery, transaction_id 0 |
| 39 | longevity pool −slice | the longevity slice into the lottery (the winners' side is event 8) |
| 75 | carry +R / −carried | the lottery carry: a block with no holder, no score or no draw; block 1 |
| 76 | longevity pool +share | the at-risk lock share of an expelled node (§4) |
| 80 | longevity pool +fee | a fee paid out of a lock or stake (§2; paired with 22 / 47 on the payer) |
| 4 | owner +refund | an expulsion's refund (§4) |
| 22, 47, 45, 70 | per 04, 13, 12 |
read back by the pool formula |
ZBC is never burned: nothing writes a burn row for ZBC (the burn tally counts only wrapper coins and
user tokens, 14, 34).
Consensus: the emission curve and the exact total_coinbase, the pool formula, the carry, the
ticket holders and their order, the scaled scores and the draws, the share arithmetic, the score
road and its clamps, the expulsion and admission rules, the order of §1. Local: the ledger rows
except as inputs to the pool (04 §5), the score audit table, the post-commit steps.
Test cases · §5
1 case · 1 valid · 1 reference
The ledger events of block application
A stated value: there is nothing to compute. A compatible node shows the same value.
- 4
expulsion refund- 8
lottery share- 39
longevity slice- 75
carry- 76
at-risk share- 80
fee from a lock
A question about this chapter, or a statement that does not match the network? Discuss on zoobc.pro.