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
Proof of AccessNetwork Fee RoutingRelease VerificationMPC Treasury SecurityPSBT SecurityNode AuthenticationRate LimitingBundle Integrity VerificationTransaction Session Reconciliation
Docs/Security & Verification/Bundle Integrity Verification
Security & Verification

Bundle Integrity Verification

Multi-layer defense ensuring every node serves identical, untampered code. SRI enforcement, content probing, manifest consensus, and IP discrimination detection.

#Bundle Integrity Verification

The marketplace uses a defense-in-depth strategy to ensure every user loads the exact same code from every node. A compromised node that serves tampered JavaScript could steal wallet keys, redirect payments, or manipulate transaction parameters.

#Threat Model

AttackDescriptionDefense Layer
Direct code injectionNode serves modified JS bundlesSRI enforcement, release manifest
Two-directory attackNode maintains clean code for audits, tampered code for usersContent probing (browser-style requests)
IP discriminationNode detects auditing node IPs and serves clean code to them onlyClient bundle attestation + SRI
Gateway collusionGateway + node collude to serve tampered contentSession attestation, multi-gateway verification

#Layer 1: Subresource Integrity (SRI)

The gateway sits between the serving node and the browser. When proxying HTML navigation responses, the gateway:

  • Parses all <script src="..."> and <link rel="stylesheet"> tags in the response.
  • Fetches each referenced asset from the serving node.
  • Computes SHA-256 of the actual content.
  • Injects integrity="sha256-..." crossorigin="anonymous" attributes.

The browser itself enforces SRI before any JavaScript executes. If the serving node tampers with a script after the gateway computed the hash, the browser refuses to execute it. This is a browser-level guarantee that tampered JS cannot bypass.

The gateway also injects a <meta name="x-bundle-fingerprint"> tag containing a composite hash of all asset SRI hashes. This fingerprint is used by the client attestation system.

html
<!-- Gateway injects integrity attributes and bundle fingerprint -->
<head>
  <meta name="x-bundle-fingerprint" content="a1b2c3...64hex">
  <script src="/_next/static/chunks/main.js"
          integrity="sha256-ABC123..."
          crossorigin="anonymous"></script>
</head>

A rogue node's only options:

  • Serve clean code → SRI passes, client code runs honestly ✓
  • Serve tampered code → SRI fails, browser blocks execution, page breaks ✗

There is no option 3.

#Layer 2: Bundle Manifest Consensus

Every node computes a deterministic manifest of all served files:

  • Walk .next/static/, .next/server/, and public/ directories.
  • SHA-256 hash each JS, CSS, WASM, and source map file.
  • Sort chunks by path for deterministic ordering.
  • Compute a composite manifestHash = SHA256(sorted chunk hashes).

Nodes broadcast their manifest hash via BUNDLE_INTEGRITY_ATTESTATION protocol events. The explorer tracks which manifest hash each node reports. Divergent nodes are flagged.

Audit frequency: Every 5 minutes, each node queries all peers for their manifest hash.

#Layer 3: Content Probing (Defeats "Two Directory" Attack)

A rogue node could maintain two build directories — clean code for peer audits, tampered code for users. The manifest audit (Layer 2) wouldn't catch this because it's self-reported.

Content probing solves this by fetching actual served content as a regular user:

  • The auditing node fetches the suspect's /api/release/manifest to get the declared asset list.
  • It picks 5 random assets from the manifest.
  • It fetches each asset with no node authentication headers — using a standard browser User-Agent.
  • It hashes the received bytes locally and compares against the manifest's declared hashes.

The rogue node cannot distinguish this request from a real user request, so it cannot serve different content.

text
Request headers (indistinguishable from a browser):
  Accept: */*
  User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36
  Accept-Encoding: identity
  (NO x-node-pubkey, NO x-node-signature, NO x-dm-skip-quorum)

Audit frequency: Every 15 minutes (heavier than manifest checks).

Detection probability: With 200 chunks and 1 tampered, probing 5 random chunks:

  • Per round: ~2.5% catch rate
  • Over 24 hours (96 rounds): ~91% catch rate
  • If multiple chunks are tampered, detection is faster

#Layer 4: Client Bundle Attestation (Defeats IP Discrimination)

Even with content probing, a rogue node could whitelist known node IPs and serve clean code to them while serving tampered code to everyone else.

Client bundle attestation closes this gap:

  • The browser loads the page. SRI guarantees the loaded JS is untampered.
  • The untampered client code reads the x-bundle-fingerprint meta tag.
  • The client sends this fingerprint directly to 2-3 random peer nodes (bypassing the gateway).
  • Each peer compares the client's fingerprint against its own content probe of the serving node.
  • If the fingerprints differ → the serving node is IP-discriminating.

Because SRI guarantees the client code is honest, the client's report is trustworthy. The rogue node cannot serve tampered JS that lies about its own fingerprint, because the browser would refuse to execute it (SRI check fails).

text
Client → POST /node/bundle-attestation/verify (directly to peer)
Body: { clientFingerprint: "a1b2c3...", servingNodeId: "suspect-node" }

Peer response: { matches: false, expectedFingerprint: "d4e5f6..." }
→ IP DISCRIMINATION DETECTED

#Consequences of Detection

When bundle divergence is detected at any layer:

SeverityAction
Manifest mismatchNode quarantined (5-min TTL), BUNDLE_INTEGRITY_ATTESTATION event gossiped
Content probe mismatchMISBEHAVIOR_PROOF with type BUNDLE_DIVERGENCE, misbehavior strike applied
IP discriminationGovernance lock on stake (7 days), misbehavior strike, explorer flag

The misbehavior strike system escalates:

  • Strike 1: 24-hour fee suspension
  • Strike 2: 72-hour fee suspension
  • Strike 3: 168-hour fee suspension
  • Strike 4+: Permanent loss of fee eligibility

#Protocol Events

text
BUNDLE_INTEGRITY_ATTESTATION
  bundleManifestHash: string (64 hex)
  chunkCount: number
  releaseVersion: string
  checkedPeerNodeIds: string[]
  agreeingPeerCount: number
  divergentPeerNodeIds: string[]
  attestedAt: ISO timestamp
PreviousRate LimitingNext Transaction Session Reconciliation

On this page

  • Bundle Integrity Verification
  • Threat Model
  • Layer 1: Subresource Integrity (SRI)
  • Layer 2: Bundle Manifest Consensus
  • Layer 3: Content Probing (Defeats "Two Directory" Attack)
  • Layer 4: Client Bundle Attestation (Defeats IP Discrimination)
  • Consequences of Detection
  • Protocol Events