How witnesses get picked using deterministic seeded selection with SHA-256 ranking. Unpredictable assignment that prevents front-running and collusion.
For every transaction, a set of independent nodes are selected to verify and attest. The selection is deterministic but unpredictable. You cannot collude if you do not know who will be picked, and you cannot know who will be picked until a future blockchain block is finalized.
Witnesses are selected by computing a SHA-256 ranking score for every eligible candidate, then taking the top N:
function selectWitnesses(
seed: string,
candidates: NodeRecord[],
count: number,
): NodeRecord[] {
return candidates
.filter(c => c.pubkey !== uiAgentPubkey) // UI agent never witnesses
.filter(c => !c.suspended) // Struck nodes excluded
.filter(c => c.stakeAmount >= minStake) // Must be bonded
.map(c => ({
node: c,
rank: sha256(seed + c.pubkey), // Deterministic score
}))
.sort((a, b) => a.rank.localeCompare(b.rank))
.slice(0, count)
.map(r => r.node);
}The seed combines two values that are both unknown at the time the session begins:
seed = sessionCommitHash + nextBlockHashBecause the seed depends on a future block hash, no participant can predict or influence the witness selection. The hosting node, the buyer, the seller -- none of them know who will be selected until the block confirms.
The number of witnesses scales logarithmically with total network size. This balances security (more witnesses = harder to corrupt) against overhead (fewer witnesses = faster finalization):
witnessCount = floor(3.50 * ln(N) - 1.50)Where N is the number of eligible (non-suspended, bonded) nodes. The result is clamped to the range [3, 20].
| Network Size (N) | Raw Formula | Clamped Result |
|---|---|---|
| 3 nodes | 2.34 | 3 (minimum) |
| 5 nodes | 4.13 | 4 |
| 10 nodes | 6.56 | 6 |
| 20 nodes | 8.99 | 8 |
| 50 nodes | 12.19 | 12 |
| 100 nodes | 14.61 | 14 |
| 200 nodes | 17.04 | 17 |
| 500 nodes | 20.23 | 20 (maximum) |
| 1000 nodes | 22.66 | 20 (maximum) |
The minimum of 3 ensures Byzantine fault tolerance even in tiny networks (3 witnesses can tolerate 1 dishonest node). The maximum of 20 caps overhead -- beyond 500 nodes, adding more witnesses provides diminishing security returns.
Settlement requires a supermajority of witnesses to attest the same verdict:
threshold = ceil((2/3) * witnessCount)| Witness Count | Supermajority Needed | Can Tolerate |
|---|---|---|
| 3 | 2 | 1 faulty |
| 6 | 4 | 2 faulty |
| 10 | 7 | 3 faulty |
| 14 | 10 | 4 faulty |
| 20 | 14 | 6 faulty |
A minority of compromised witnesses cannot force an invalid transaction through. With BFT-standard 2/3 supermajority, up to 1/3 of witnesses can be faulty or malicious without affecting correctness.
validateSaleTx() on the transaction.The protocol distinguishes between dishonesty and downtime. This distinction is critical.
Wrong attestation (strike-worthy): A witness signs VALID for a transaction that is provably invalid (or vice versa). Other nodes can independently verify the correct verdict and prove the witness was wrong. This earns a strike.
Timeout (not strike-worthy): A witness fails to respond within the attestation window. The witness is excluded from the current session's tally, but does not receive a strike. Downtime is an infrastructure problem, not dishonesty. The protocol punishes lying, not being offline.
Strikes accumulate and trigger escalating suspensions:
| Strike Count | Suspension Duration |
|---|---|
| 1st strike | 24 hours |
| 2nd strike | 72 hours (3 days) |
| 3rd strike | 168 hours (7 days) |
| 4th strike | Permanent ban |
During suspension, a node is excluded from witness selection and earns no fees. After the 4th strike, the node is permanently banned from the network and must re-register with a new identity (losing all reputation and stake history).
Strikes are not permanent (except the 4th). Clean behavior causes strikes to decay:
A node with 2 strikes that operates cleanly for 60 days returns to 0 strikes. A node that earns a 3rd strike at day 29 resets the clock and still has 3 strikes.