index41 ⚖️
Proves transaction A executed before transaction B inside an Ethereum block — a fact carried in no payload and readable by no oracle — and makes a relay's bond pay for breaking its no-sandwich promise.
A real Ethereum mainnet sandwich (block 25,764,741, positions 14 → 15 → 16)
ruled on by a bonded contract on Creditcoin CC3, in
one real transaction
— status 1, 1,092,100 gas, 1.456% of MAX_GAS_CAP. The positions are
not hardcoded in the page's code path: they are decoded, on every page load, from the
logs the Attestcoin precompile itself wrote (a committed capture of that same read backs the
page when a live one is unreachable — see below). 120 Foundry tests, 0 failed.
[](https://index41.edycu.dev)
[](JUDGE.md)
[](public/index41-pitch-deck.pdf)
[](https://youtu.be/NuyoosaD-lk)
[](https://creditcoin-testnet.blockscout.com/tx/0xd136dea0524b7e0e9eba54bf9724eec78597c2598047a96849af727f4d243810)
[](docs/PIPELINE.md)
[](https://dorahacks.io/hackathon/buidl-ctc-2026-fall)






[](LICENSE)
---
> **A note on the name.** The icon's `41 → 42 → 43` is this project's fingerprint — an illustrative
> three-slot rhythm, not a result. The sandwich that was actually proven on-chain sits at
> **14 → 15 → 16**, and every number in this document, in the tests and on the demo page is that
> real one. Nothing here presents `41/42/43` as a live output.
## 📸 See it in Action
```bash
npm install
npm run dev # http://localhost:3000 — no .env, no wallet, no API key, no account
# /judge — the same evidence, written for one reader
```
The page shows three rows of Ethereum mainnet block `25764741` lighting up in sequence —
**14 searcher buy · 15 the victim · 16 searcher sell** — then `SandwichProven` and the bond paying
out. **Those indices are not hardcoded in the page's code path.** They are decoded, on every page
load, from the three `TransactionVerified` logs the Attestcoin precompile itself wrote inside the
receipt of CC3 transaction
[`0xd136dea0…d243810`](https://creditcoin-testnet.blockscout.com/tx/0xd136dea0524b7e0e9eba54bf9724eec78597c2598047a96849af727f4d243810).
A banner above the ledger states which of the two **real** sources is on screen — a live chain read,
or the committed [`data/proof-artifact.json`](data/proof-artifact.json) capture of that same read if
the public node is unreachable — and there is no third source. There is no demo mode, no mock and no
toggle anywhere in this repository.
Alongside each index the page shows the laterality decode that produced it (`RLLLRRRR → 14`), the
real sibling hashes it was folded from, and the position the precompile emitted, so the off-chain
and on-chain answers can be seen *agreeing* rather than asserted to agree.
Verify one position against a complete stranger's API, no clone required:
```bash
curl -s https://eth.blockscout.com/api/v2/transactions/0xec3777f9d0e55d03b9caa3a4b8a786dd62e16eeb327a9f1c45dfbc79af618436 | jq .position
# 14
```
## 💡 The Problem & Solution
### The Problem
A private RPC or block-builder relay sells one promise: *route through us and you will not be
sandwiched.* When that promise breaks, the victim has a screenshot and the relay has a denial.
The dispute is unresolvable on-chain for one structural reason — **the harm is entirely a fact about
ordering**, and a transaction does not carry its own position. There is no `tx.index` field. No
oracle reports it. No `eth_call` can be proven for it. A sandwich is three transactions that only
become an attack when you can show that one landed *between* the other two, and that "between" is
exactly what no payload contains.
### The Solution
A relay posts a CTC bond on Creditcoin behind its no-sandwich promise. A victim submits three
Ethereum transaction hashes from the same block. `Index41.proveSandwich` then:
1. **Verifies** each of the three transactions with `INativeQueryVerifier.verifyAndEmit(...)` —
three sequential calls in one Creditcoin transaction, sharing one continuity proof.
2. **Recovers each transaction's ordinal position inside its block** by calling
`INativeQueryVerifier.calculateTxIndex(merkleProof)` — a free `view` that decodes position out of
the left/right laterality of the merkle authentication path. Every sibling on the path is one
bit; the position is the *shape of the proof*, not a claimed field.
3. **Asserts the sandwich shape**: `frontRunIndex < victimIndex < backRunIndex`, that all three legs
emitted a `Swap` log *from the same pool address* (`PoolNotTouched` otherwise — note this is the
log emitter, not the transaction's `to`, which legitimately differs across routers), the same
searcher as sender on the outer two, and a higher priority fee on the front-run.
4. **Computes harm** as the attacker's *realized profit* — front-run `amountIn` versus back-run
`amountOut`, both read from `Swap` logs that are inside the proof. Never a counterfactual against
a pre-sandwich reserve ratio: Attestcoin commits transaction history, not state, so there is no
state to counterfactually compare against, and a contract that claimed otherwise would be lying.
5. **Pays the victim** from the relay's bond and marks the claim `processedQueries` so the same
sandwich cannot be claimed twice.
Ordering is not in any payload. The merkle authentication path *is* the position — that is the
entire foundation of this contract, and it is the one thing nothing else here can do.
## 🏗️ Architecture & Tech Stack