AfterKey

Release gate for ENS config: Chainlink CRE verifies, owner activates, Uniswap LP vaults enforce.

AfterKey

Created At

ETHGlobal Mumbai

Project Description

AfterKey is a release gate for shared onchain configuration, built on ENSv2, Chainlink CRE and Uniswap v3 on Sepolia.

The problem: Teams and AI agents read operators, treasuries and limits from ENS records. Anyone holding a role can change those records, and nothing checks what depends on them first. Offboarding has the same blind spot. Under ENSv2 Enhanced Access Control, removing a departing operator's text-key permission does not remove a separately granted resolver-wide role. In Uniswap v3, revoking one position's approval leaves portfolio-wide approval active. The team believes access is gone when it isn't.

How AfterKey works:

Stage: The owner publishes a candidate configuration (operator, treasury, expiry) as an ENSv2 data record. Nothing live changes yet. Verify: A Chainlink CRE workflow independently re-reads the candidate, the gate and every registered Uniswap v3 LP consumer at one block. It then writes a signed, short-lived report onchain through the CRE forwarder. The gate checks the forwarder, workflow ID, owner, candidate digest, epoch and coverage before accepting it. Activate: Only the owner can activate, and only the exact digest and epoch CRE checked. Enforce: Each LP consumer contract holds one Uniswap v3 position NFT. Before every collection it asks the gate whether the operator is authorized for the active version. Operators can collect fees but never withdraw liquidity, and fees can only go to the fixed owner treasury. If the config changes, operations prepared against the old version revert. Offboarding: AfterKey also ships a fully verified offboarding workflow. It scans both ENS permission scopes, registry roles, and individual and portfolio Uniswap approvals for a departing wallet. It then prepares owner-reviewed revocations, broadest first, and verifies afterward that the team's ENS name, records and LP positions are intact.

Proof on Sepolia:

Ten ENS receipts and 30 historical-state checks Complete Uniswap offboarding of positions 234145 and 234146, with 14 checks Authenticated CRE executions that link a completed GitHub departure case to before/after chain state Release-gate consumers deployed and holding both NFTs, with the CRE workflow binding signed live in MetaMask CRE never holds the owner's key. Every change is signed in the owner's own wallet.

How it's Made

Stack: Most of AfterKey is plain TypeScript. The frontend uses Vite 6 and viem, with no framework, and reads ENSv2 and Uniswap v3 straight from Sepolia RPC. There's no indexer, backend database or subgraph. The two Solidity contracts, ENSReleaseGate and ReleaseLPVault, are compiled with solc 0.8.30 inside a Node script. The CRE workflow is TypeScript on @chainlink/cre-sdk, compiled to WASM with the CRE CLI. The signed relay is one policy module that builds three ways: a local Node server, a Vercel function and a Cloudflare Worker.

How the pieces fit:

ENSv2 is the source of truth. We follow the live registry hierarchy from manager.eth down to our subnames. We verify the official Verifiable Factory, Permissioned Resolver and User Registry implementations against pinned runtime-code hashes, then read Enhanced Access Control with hasRoles. The candidate configuration is published as an ABI-encoded ENS data record (operator, treasury, manager, expiry) and hashed into a digest. Chainlink CRE is the independent second reader. A cron trigger, an EVM-log trigger on Uniswap approval events and an owner-signed HTTP trigger all run one workflow. It re-reads the gate, the candidate resolver, every registered LP consumer and NFT custody at a single block, then delivers a signed report through the KeystoneForwarder. The gate only accepts it if the forwarder, workflow ID, workflow owner, chain, digest, epoch, coverage hash and validity window all match. Uniswap v3 holds the actual money. We use the official Sepolia NonfungiblePositionManager only. Each ReleaseLPVault holds one position NFT, and before every collect call it asks the gate whether the operator is authorized for the active version. The recipient is fixed to the owner treasury when the vault is deployed. How the partner tech helped: ENSv2's Enhanced Access Control made the core problem concrete and measurable. Key-scoped roles and resolver-wide roles are separate grants, so we could show a real narrow revoke leaving a broad role active. CRE gave us a reader that isn't our own browser, which turns "the UI says it's safe" into a signed, onchain attestation. Uniswap's two separate approval paths (getApproved and isApprovedForAll) reproduced the same trap on real assets.

The hacky parts:

GitHub issues as an HR system. A departure case is a closed, labeled GitHub issue. CRE fetches it over HTTP, uses consensus to check that the right approver closed it, then joins it with before/after chain state. Browser-signed CRE triggers without a backend key. The browser has MetaMask sign a five-minute authorization tied to the exact request body. The relay checks the signature, body, expiry and deployed scope before forwarding to the CRE gateway, and it never holds a signing key. Hitting CRE's read limit. Our first release-verification run was accepted but failed at the contract-read capability limit. We rewrote the reader to batch every ENS and Uniswap read through Multicall3 in one call. Proof from execution logs. CRE output is emitted as digest-bound log chunks. A collector script pulls authenticated CRE logs and rebuilds the result, and it only accepts it as proof if the digest and scope match. Resolver surgery mid-hackathon. Our first resolver turned out to lack data-write authority for the release record. We deployed a replacement Permissioned Resolver, pulled both NFTs out of the old consumers, and redeposited them into new ones without losing the original name. No simulations. Every claim in the README links to a real Sepolia receipt or a historical-state check pinned to a block. Read-only checks are labeled separately from mined transactions. AI assistance (Codex, then Claude Code) helped with implementation, debugging, tests and docs. It's disclosed in docs/overview/AI_ATTRIBUTION.md. Every privileged transaction was reviewed and signed by the owner.

background image mobile

Join the mailing list

Get the latest news and updates

AfterKey | ETHGlobal