ASK KNOX
beta
LESSON 271

Multi-Checkpoint Verification

The wallet debugging case required four sources to agree: the derived EOA from the key, the configured expected wallet, the on-chain USDC.e balance, and the CLOB-reported balance. Any mismatch is a red flag. The discipline of cross-checking independent sources before trusting any single one.

7 min read

The Hermes wallet mismatch was diagnosed by comparing four independent sources for the same fact: "what address holds the Hermes USDC.e?"

  • Source 1: Account.from_key(private_key).address — cryptographic derivation from the Doppler secret.
  • Source 2: os.environ["EXPECTED_WALLET"] — the intended address, set by operators.
  • Source 3: Direct Polygon RPC call to the USDC.e contract's balanceOf() for each candidate address.
  • Source 4: Polymarket CLOB /balance-allowance endpoint.

All four should agree. The bot was healthy if and only if source 1 matched source 2, and the balance on source 3 matched the balance on source 4 for that agreed address. In the actual bug, source 1 and source 2 disagreed — the derived EOA was 0x081c…0115 while the expected wallet was 0xCF56…0aD. The moment that comparison was run, the bug was diagnosed.

The Pattern

Identify the fact you are verifying. Then list every independent source that should agree on that fact. Query all of them. Compare. Any mismatch is a red flag that must be explained before proceeding.

FactSource 1Source 2Source 3Source 4
Bot wallet addressKey derivationEXPECTED_WALLET env varWallet-UI screenshotDeploy config
USDC.e balanceOn-chain balanceOfPolymarket CLOBExplorer UIPortfolio tracker
Order statusCLOB GET /ordersOn-chain settlement eventCLOB trade historyUI dashboard

Each row is a fact worth cross-checking at startup or during debugging. Each column is a potential independent source. The more high-stakes the fact, the more sources deserve a checkmark.

Inline Diagram — Four-Source Agreement

FOUR-SOURCE VERIFICATION — HERMES WALLETSOURCE 1 DISAGREES WITH SOURCES 2/3/4 → WALLET MISMATCHDoppler key rotated without propagating the change to Hermes

When to Apply It

Multi-checkpoint verification is worth running at three moments:

  1. Startup — before any production action, run the critical cross-checks (wallet, balance, config hash). Fail loudly on mismatch.
  2. Investigation — when debugging any "something is zero" or "something is missing" complaint, list the independent sources and cross-check them before assuming the primary source is correct.
  3. Pre-deploy — when shipping a config change, verify the new config matches expectations across every environment it touches.

The Rule

One source is a guess. Four sources is a verification. For every high-stakes fact, list the independent sources and cross-check them. The Hermes wallet mismatch cost an hour because this discipline was not yet baked into startup. Now it is.