agorix
AirdropMarketsCollectionsLeaderboardActivity
Agorix · Decentralized Marketplace
Independent · Resilient · Community-Run

A cross-chain marketplace, run by the community.

Discover, list, and trade across Bitcoin, Ethereum, and Solana on an open, community-run network.

Marketplace
CollectionsMarketsLeaderboardActivity
Network
GovernanceExplorerAirdropDocs
Account
ProfileSettings
Legal
Terms of ServicePrivacy PolicyYour Privacy Choices
agorix.io — Lasting Access
CID: 0xA60R1X · v0.1
AirdropMarketsCollections
D
Protocol Docs
Protocol TruthWitness Selection & AttestationEvent System & GossipWire ProtocolReward Pool and Epochs
Docs/Protocol/Witness Selection & Attestation
Protocol

Witness Selection & Attestation

How witnesses get picked using deterministic seeded selection with SHA-256 ranking. Unpredictable assignment that prevents front-running and collusion.

#Witness Selection & Attestation

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.

#The Selection Algorithm

Witnesses are selected by computing a SHA-256 ranking score for every eligible candidate, then taking the top N:

typescript
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);
}

#Seed Construction

The seed combines two values that are both unknown at the time the session begins:

text
seed = sessionCommitHash + nextBlockHash
  • sessionCommitHash: The SHA-256 hash of the SESSION_COMMIT event, which includes the buyer's intent and a timestamp.
  • nextBlockHash: The hash of the next Bitcoin block after session creation. This is unknown to all parties at session creation time.

Because 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.

#Witness Scaling Formula

The number of witnesses scales logarithmically with total network size. This balances security (more witnesses = harder to corrupt) against overhead (fewer witnesses = faster finalization):

text
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 FormulaClamped Result
3 nodes2.343 (minimum)
5 nodes4.134
10 nodes6.566
20 nodes8.998
50 nodes12.1912
100 nodes14.6114
200 nodes17.0417
500 nodes20.2320 (maximum)
1000 nodes22.6620 (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.

#Supermajority Threshold

Settlement requires a supermajority of witnesses to attest the same verdict:

text
threshold = ceil((2/3) * witnessCount)
Witness CountSupermajority NeededCan Tolerate
321 faulty
642 faulty
1073 faulty
14104 faulty
20146 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.

#Attestation Flow

  • A purchase session is created, producing a SESSION_COMMIT event.
  • The next blockchain block confirms, providing the second seed component.
  • Every node independently computes the witness set from the seed.
  • Each selected witness independently runs validateSaleTx() on the transaction.
  • Each witness signs their verdict (VALID or INVALID) with their Ed25519 key.
  • TX_ATTESTATION events are gossiped across the network.
  • When supermajority VALID attestations are collected, a TX_FINALIZED event is emitted.
  • If supermajority is not reached within the timeout window, the session expires.

#Misbehavior Detection and Strikes

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.

#Strike Escalation

Strikes accumulate and trigger escalating suspensions:

Strike CountSuspension Duration
1st strike24 hours
2nd strike72 hours (3 days)
3rd strike168 hours (7 days)
4th strikePermanent 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).

#Strike Decay

Strikes are not permanent (except the 4th). Clean behavior causes strikes to decay:

  • Decay rate: 1 strike removed per 30 days of clean operation
  • Clean operation: No new strikes during the decay period
  • Reset on new strike: The 30-day clock resets if a new strike is earned

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.

PreviousProtocol TruthNext Event System & Gossip

On this page

  • Witness Selection & Attestation
  • The Selection Algorithm
  • Seed Construction
  • Witness Scaling Formula
  • Supermajority Threshold
  • Attestation Flow
  • Misbehavior Detection and Strikes
  • Strike Escalation
  • Strike Decay