Inspiration

Since 27 September 2026, EU Directive 2024/825 bans generic green claims like "eco-friendly" unless a company can prove them. Türkiye is the EU's second-largest textile supplier, and recycled-content fraud is a known problem: in one 18-month lab study, 62% of "recycled" polyester samples didn't contain the recycled content their label claimed.

The proof behind a "recycled" label today is usually a PDF transaction certificate sent by email. A spinning mill can receive 30 tonnes of certified recycled chips, sell 50 tonnes of "recycled" yarn padded with virgin fiber, and nothing on paper looks wrong. We wanted the kilos themselves to be checkable.

Ilmek is Turkish for "stitch".

What it does

  • Mass-balance ledger. Every processing step (bale → flake → chip → yarn → fabric → garment) consumes its input lots on-chain. The contract refuses any output that claims more recycled kilos than its inputs allow at the best physical yield: \( \text{recycled}{out} \le \text{recycled}{in} \times \text{yield}_{max} \). It refuses even when a certifier has signed the step, so a bribed certifier can't push fraud through.
  • One certificate, one shipment. A shipment certificate can be used once across the whole ledger, so it can't be shown to a second buyer.
  • AI document reading, checked by code. Claude reads transaction certificates, invoices, weighbridge tickets and meter bills and returns every value with the exact quote it came from. Code then confirms each quote is in the PDF's own text and that each value is in its quote, and checks that a shipment's documents agree. AI proposes; it never writes to the ledger.
  • Integrity engine. Eight checks per step (physical yield, energy per kg, timing, plant capacity, certificate reuse, sudden jumps against the plant's history), each explained in plain language for the certifier.
  • Honest carbon. The contract carries each lot's embedded CO₂e down the chain from the plant's real energy use. Recycled isn't automatically low-carbon: our 100% recycled yarn spun on lignite power comes out at 4.3 kg CO₂e/kg, barely better than virgin (4.4), while 58% recycled yarn on the Turkish grid is 2.7. The passport says so. It's shown as information, never sold as a credit, so nothing is double-counted.
  • Label checker. The brand's draft ("Eco-friendly jacket made from 100% recycled materials. Kind to the planet.") is sorted phrase by phrase under the EU rules and rewritten by Claude. A deterministic number lock only lets through numbers the passport proves and blocks generic green terms; otherwise a safe template is used.
  • Garment passport + public verifier. A shopper scans the QR code and sees 57% recycled, verified, from Istanbul bottles to an Amsterdam shop. The verifier runs in the browser: it walks the chain back to the certified bales, recomputes the mass balance, checks every evidence Merkle root and every post-quantum ML-DSA-44 certifier signature, and reads the contract live from Base Sepolia. Our own server is treated as untrusted. Judges can flip "Try to break it" switches (edit the label, edit a document, swap the certifier's key) and watch the checks fail.

How we built it

  • Smart contract: FiberLedger.sol (Solidity 0.8.24, Foundry, OpenZeppelin EIP-712). Deployed on Base Sepolia at 0x90db5fde6310022c5f478bbb84e264455e895b1d, source verified on Sourcify (exact match). 22 Foundry tests, including a fuzz test that recycled mass is never created.
  • Signatures: certifiers approve each step with an EIP-712 signature (checked on-chain) and sign the evidence root with ML-DSA-44 (NIST FIPS 204). The contract stores the post-quantum key's hash, and browsers verify the signatures, since evidence must stay checkable for years.
  • Off-chain core (TypeScript): yields, carbon maths (Türkiye grid 442 g CO₂e/kWh, IPCC natural gas 56.1 g/MJ, Textile Exchange LCA for virgin fiber), the integrity engine, evidence Merkle trees and the verifier. 31 tests.
  • AI: Claude via the Anthropic API with structured outputs (Zod schemas). Quotes are verified against PDF text extracted with pdf.js. Responses are recorded so the demo replays without a key. 36/36 extracted fields confirmed against 5 demo PDFs. 43 tests.
  • Web app: React, Vite and Tailwind, with a landing page, dashboard, role workspaces (recycler, spinner, certifier, brand), passport and verifier. viem reads the chain, batched through Multicall3. Hosted on Vercel.
  • Demo data: a fictional supply chain through real Turkish textile cities (Adana, Gaziantep, Bursa, Denizli), with real yields and emission factors. Every party is a separate testnet account, and both fraud attempts are real reverted transactions on Base Sepolia.

Challenges we ran into

  • Paper can't catch it. The inflated yarn certificate is internally consistent: 50 t net, 50 t recycled. Neither the AI nor the document checks can catch it. Only the ledger, which knows how much recycled input actually arrived, can. That shaped the whole design: AI reads and explains, physics and signatures decide.
  • Keeping AI honest. Claude's first read verified 34 of 36 fields. The two misses were bugs in our own date checker (a time on a weighbridge ticket, a date range on a bill), not AI errors. We fixed the checker and added regression tests.
  • Public RPC limits. Base's public endpoint caps event queries at 200 blocks and 25 requests per second. We chunked log reads and preloaded lots through Multicall3, which took the live verifier from about 10 seconds to about 3.
  • Ligatures broke quote matching. Our demo PDFs used an "fi" ligature, so text extraction saw "Certifcate". We turned ligatures off so quotes match exactly.

Accomplishments that we're proud of

  • A fraud attempt signed by the certifier is still refused on-chain: RecycledExceedsInputs(50 t, 29.1 t).
  • A verifier that trusts nothing but the chain, including post-quantum signature checks in the browser.
  • Carbon figures that are honest even when the answer is "recycled, but not low-carbon".

What we learned

Blockchain earns its place here only for the parts several parties must share and nobody may rewrite: who consumed which kilos, and which certificate was used. Everything else (documents, AI reasoning, supplier names) belongs off-chain, anchored by a hash.

What's next for Ilmek

  • A pilot with a Turkish spinner and a certification body, using real GRS/RCS transaction certificates.
  • Zero-knowledge proofs of the mass balance, so supplier volumes stay private.
  • Lab fiber-testing results as an input to the integrity engine.
  • Mapping to the EU textile Digital Product Passport data model (ESPR) as it's finalised.

Built With

  • anthropic-api
  • base
  • claude
  • eip-712
  • ethereum
  • foundry
  • merkle-trees
  • ml-dsa
  • node.js
  • openzeppelin
  • pdf.js
  • pnpm
  • post-quantum-cryptography
  • react
  • solidity
  • sourcify
  • tailwindcss
  • typescript
  • viem
  • vite
  • vitest
  • zod
Share this project:

Updates

Submission history