Building EIP-712 Verifier in Solidity With AI as My Mentor — Live Mistakes Included
Yesterday I understood EIP-712 from first principles. Today I implement it — live, in Solidity, from scratch. The AI mentor refuses to give answers. It questions me until I figure everything out myself. Watch 83 minutes of real implementation — including every mistake. What gets built in this video: → Contract skeleton — DOMAIN_TYPEHASH, TRANSFER_TYPEHASH → domainSeparator — computed once, cached in constructor → hashStruct() — typeHash + abi.encode per EIP-712 spec → verify() — final hash + ecrecover + address(0) guard → execute() — nonce validation, increment, event emission → Nonce added to Transfer struct and TYPEHASH string → Foundry project initialized (forge init copy-trade-vault) Every mistake caught live on camera: Said encodeData instead of hashStruct in the formula Forgot verifyingContract in domainSeparator fields Missed DOMAIN_TYPEHASH as the 5th constructor argument Passed name/version directly — got a compiler error Mixed abi.encode and abi.encodePacked inside hashStruct Used pure for verify() — caught: it reads a state variable Called this.hashStruct() — unnecessary external call Forgot nonce in TRANSFER_TYPEHASH string after adding to struct Missing require(nonces[signer] == transfer.nonce) — attacker gap 00:00:00 Intro — What I Learned Yesterday (EIP-712 Basics) 00:00:19 Today's Goal — Implement EIP712Verifier.sol With AI Mentor 00:00:34 Starting the AI Tutor Session 00:01:02 Retention Check — Write the Final Hash Formula From Memory 00:01:28 My Answer — Prefix, domainSeparator, encodeData (Partially Wrong) 00:02:29 Fixing domainSeparator Fields — verifyingContract Was Missing 00:05:00 Correcting the Formula — hashStruct Not encodeData 00:08:00 typeHash — Structure Name and Its Members 00:10:00 Designing the Contract — What Functions Does It Need? 00:13:00 Defining DOMAIN_TYPEHASH and TRANSFER_TYPEHASH Constants 00:18:00 Writing the Contract Skeleton in Remix 00:24:27 AI Review — Incomplete Function Signatures Caught 00:25:31 hashStruct Parameters — address and uint256 00:26:17 verify() — Figuring Out V R S Types Live 00:28:52 bool vs address — Which Should verify() Return? 00:31:02 Visibility and Mutability — external, pure vs view 00:32:44 Caught — verify Needs view Not pure 00:36:17 Looking Up Solidity Docs — Confirming block.chainid 00:37:21 How Does Concatenation Work in Solidity? 00:41:16 Discovering abi.encode for Structured Data Hashing 00:41:46 Writing the Constructor — Missed DOMAIN_TYPEHASH as 5th Argument 00:42:23 Bug Caught — name and version Need keccak256 Wrapping 00:42:49 Compiler Error — Invalid Implicit Conversion for String 00:44:00 Fix — keccak256(bytes(name)) Is the Idiomatic Way 00:46:00 Implementing hashStruct — abi.encode vs abi.encodePacked Confusion 00:50:00 Fixing hashStruct — One abi.encode, No Nesting 00:52:00 Implementing verify() — Building the Final Hash 00:54:00 Should Caller Compute the Hash? No — Keep It Internal 00:56:00 Why abi.encodePacked for the \x19\x01 Prefix 00:58:00 Changing hashStruct to internal pure — No External Calls 01:01:00 ecrecover Returns address(0) — The Zero Address Vulnerability 01:03:00 Adding require(signer != address(0)) Guard 01:05:00 Test Case Planning — 5 Scenarios Identified 01:08:00 Adding Nonce — Preventing Replay Attacks 01:10:00 Nonce Increment — Before or After Verification? 01:13:00 Why Incrementing After Works — Walkthrough With Alice 01:16:00 Single Responsibility — Nonce Goes in execute() Not verify() 01:18:00 Adding execute() — verify(), Nonce Increment, Event Emission 01:20:00 Nonce Must Be in Transfer Struct and TYPEHASH String 01:21:00 require(nonces[signer] == transfer.nonce) — Closing the Gap 01:22:00 Initializing Foundry Project — forge init copy-trade-vault 01:23:00 Contract Complete — Tests in Next Video Resources used: 📘 EIP-712 Spec: https://eips.ethereum.org/EIPS/eip-712 📘 Solidity Docs: https://docs.soliditylang.org 📘 Foundry Book: https://book.getfoundry.sh Next video: Writing 5 Foundry tests — happy path, invalid signature, zero address, replay attack, cross-contract replay. AI Tutor prompt → see description of Session 1 (EIP-712 Basics). If this helped you, like, share and subscribe.

Replacing keccak256 With Yul Inline Assembly — And Proving the Gas Savings

Billionaire's WARNING: I'm SELLING. The Crash Is Already Here!

Learning EIP-712 With an AI Mentor — The Blind Signing Attack That Changed How I Think

MIT Just Revealed the AI Bubble's Fatal Flaw

Writing 5 Foundry Tests for EIP-712 — All Passing

Designing Data-Intensive Applications: Chapters 1 and 2

Jfrog | Jfrog Artifactory | Jfrog Artifactory Tutorial | Artifactory Tutorial | Intellipaat

Databricks Live Bootcamp | Day1: Introduction & Data Analytics

Inside Anthropic, the $965 Billion AI Juggernaut | The Circuit

Professor Jiang: World War 3 Is About To Begin, Let Me Explain!

NestJS Full Course for Beginners in 2026 | Build a Production-Ready API

Building a Clone Factory in Solidity — I Hit a Compiler Error I Didn't Expect

Ex-Google Exec: How to Position Yourself Now Before the Next AI Phase (2026–2027) | Mo Gawdat

Building an AI Dark Factory: A Codebase That Writes Its Own Code, Live

Build REST APIs with Node.js & Express From Scratch|Postman Testing + CRUD Routes|OJT Week 2 Video 2

Full Archon Guide - Build AI Coding Harnesses That Actually Ship (LIVE)

Learn RAG From Scratch – Python AI Tutorial from a LangChain Engineer

Keynote: After the AI Hype – What’s Real, and What’s Next - Richard Campbell - 2026

Free Event: Power BI Beginner to Pro 2026 Edition - Full Hands-On Tutorial

