Non-FictionInformativeEducational
Prompt Engineering for Solidity Code Review eBook
A Coursebook on Prompt Engineering for Solidity Co
by Farrow Venus
A Coursebook on Prompt Engineering for Solidity Code Review
Formats
Free sample
Chapter 1: The Vibe Check...--–- It was 3:47 AM on a Tuesday when the $47 million drain began. The attacker didn't brute-force a private key, didn't exploit a zero-day in the Ethereum virtual machine, and didn't trick anyone into signing a malicious transaction. They simply called a function named withdraw() twice before the contract could update a balance. The code had been reviewed—sort of. A developer had run it through an LLM, asked "are there any bugs?", received a reassuring "no vulnerabilities detected," and deployed it to mainnet six hours later.
That developer was now watching their protocol's TVL vanish block by block, refreshing Etherscan every three seconds, desperately typing "how to pause a Solidity contract" into the same chat interface that had failed them hours earlier.This is not a hypothetical disaster. It is a composite drawn from dozens of real post-mortems published between 2023 and 2025, each following the same tragic arc: an enthusiastic developer uses an LLM to accelerate development, receives confident but incomplete security feedback, deploys without rigorous review, and wakes up to a drained contract. The common thread is not malicious intent, not incompetence, but a fundamental misunderstanding of what LLMs can and cannot do when asked to review Solidity code. The developer asked the wrong question in the wrong way and trusted the answer as if it came from a human expert.This book exists because the gap between "vibe coding" and "vibe reviewing" has become the most expensive skill gap in Web3. You are about to learn how to close it.The Vibe Coding Epidemic The term "vibe coding" emerged in late 2024 to describe a specific workflow: developers describe what they want in natural language, an LLM generates Solidity code, the developer deploys it without fully understanding every line, and then—crucially—they ask the same LLM to review that same code for security issues.
The "vibe" part refers to the intuitive, feeling-based approach: "This feels right," "The AI seems confident," "I don't see any red flags."Here is what happens when you ask an LLM "are there any bugs in this contract?" without preparation. The LLM performs a shallow pattern match against its training data. It looks for exact string matches of known vulnerable patterns—a delegatecall to a user-controlled address, a tx.origin check, a missing only Owner modifier. If it finds none of these obvious signatures, it confidently responds: "No vulnerabilities detected." The developer interprets this as a clean bill of health. The LLM, however, never simulated execution, never traced state changes across functions, never considered economic attack vectors, and never questioned whether the business logic actually makes sense.
It performed a keyword scan and called it a security audit.The problem is not that LLMs are useless for security work. The problem is that developers are using them like security experts when they should be using them like pattern-matching interns who need precise instructions, context, and validation. The difference between a $47 million hack and a secure deployment is not a better LLM—it is a better prompt engineer.Defining the AI Auditor Before we write a single prompt, we must establish a clear distinction that will govern every technique in this book: the difference between an AI Coder and an AI Auditor.An AI Coder generates code. It takes a specification—"build me an ERC20 token with a mint function"—and produces Solidity. Its goal is fluency, speed, and syntactic correctness.
It succeeds when the code compiles and appears to do what the user asked.An AI Auditor, by contrast, does not generate. It verifies, challenges, simulates, and doubts. Its job is to take existing code and answer questions like: "Under what conditions could this function be called by an unauthorized address?" "What state changes occur before and after this external call?" "If an attacker controlled this value, what would break?" The AI Auditor's goal is not to produce a solution but to surface risks. It succeeds when it identifies edge cases the developer did not consider.Most developers make a catastrophic error: they use the same LLM in the same way for both roles. They ask the AI Coder to write a function, then immediately ask the same AI Coder to review that function without changing the system prompt, the context, or the questioning strategy.
This is like asking a building contractor to inspect their own foundation work after pouring it at 3 AM. The contractor is incentivized to see no problems, trained to prioritize speed over scrutiny, and lacks the tools for rigorous inspection.An effective AI Auditor requires a completely different prompting architecture. The system prompt must explicitly revoke the assistant's generative instincts. The context must include not just the target code but also reference standards, known exploit patterns, and explicit instructions for what to ignore. The questioning strategy must force step-by-step simulation rather than pattern matching.
This book will teach you exactly how to construct each of these elements.The Probabilistic Nature of LLMs To understand why LLMs struggle with security review, you must understand what they actually are: probabilistic next-token predictors. When you give an LLM a prompt, it does not "think" or "reason" in any human sense. It calculates the most statistically likely sequence of tokens to follow your input, based on patterns in its training data. This architecture has profound implications for security work.LLMs excel at pattern recognition because their training data contains millions of examples of common code structures. When shown a function that transfers ether, the LLM has seen thousands of similar functions and can predict that a require(msg.sender == owner) statement often appears nearby.
This is genuinely useful: an LLM can flag a missing access control check because it recognizes that the pattern is incomplete compared to the training distribution.However, LLMs are catastrophically bad at deterministic execution. They cannot reliably simulate what happens when a function runs because simulation requires maintaining consistent state across multiple steps—exactly what a probabilistic token predictor was not designed to do. Consider a simple loop that transfers 1 ether to each address in an array. A human auditor can reason: "If there are 100 addresses, this will transfer 100 ether total, assuming the contract has that balance." An LLM, asked to simulate the same loop, will often produce a plausible-sounding answer like "the loop will execute correctly for each address" without actually tracking the cumulative balance. It recognizes the pattern of a loop but cannot execute the arithmetic.This explains the central paradox of LLM-based auditing: the same model that instantly spots a missing only Owner modifier will confidently miss an integer overflow that requires tracking three state variables across four function calls.
The LLM is not being lazy or deceptive—it is operating exactly as designed. Pattern recognition is fast and reliable; deterministic simulation is slow and requires architecture that LLMs do not possess.The Hallucination Gap The most dangerous failure mode for AI-assisted auditing is not missing a vulnerability—it is reporting a vulnerability that does not exist. This phenomenon is called hallucination, and in the context of Solidity review, it takes three specific forms.First, false positives based on keyword triggering. An LLM sees tx.origin in a contract and immediately flags it as a vulnerability, ignoring the…
This is the end of the free sample. Get the eBook to keep going. Buy now
About this book
Details
- Author
- Farrow Venus
- Publisher
- SamEnrico
- Language
- English
- Genre
- Non-Fiction, Informative, Educational
- Released
- 2026-06-03
- Pages (approx.)
- 135
- Available as
- eBook, Audiobook
Read better in the ZLOADR app
Your eBooks on your phone or tablet. Sign in with your SamEnrico account and start reading.
More by Farrow Venus
NVC Four Part Communication GuideFarrow Venus$11.99
Magnesium For Restless Leg ManagementFarrow Venus$11.99
The EQ for Actors GuideFarrow Venus$11.99
Messner High Altitude PhysiologyFarrow Venus$11.99
Self Hypnosis For Stress ResilienceFarrow Venus$11.99
Natural Resources Capital GuideFarrow Venus$11.99
Twelve Step Inventory ResentmentsFarrow Venus$11.99
Ovadia Yosef Sephardic GiantFarrow Venus$11.99
The Violinmaker’s Secret: How a Small Town in Germany Crafted the World’s Finest InstrumentsFarrow Venus$11.99
Bragi's Harp: The God Who Sang the World into BeingFarrow Venus$11.99
Echoes of the Iron Curtain: The Spy Who Stole the Cold WarFarrow Venus$11.99
Growing OemleriaFarrow Venus$11.99You may also like
Hong Kong Handover 1997Dunn Johnnie$11.99
Zumba For Postnatal Recovery CourseNeal Christian$11.99
Zumba for BeginnersLadner Nikia$11.99
YouTube Comment Mining GuideHumes Pandora$12.99
Worry Box MeditationCarlin Rudy$11.99
Workplace Stress MeditationNguyen Lynn$11.99
Workplace Stress and Sleep RepairHawley Ivory$11.99
Workplace Perfectionism CureDelaney Jeffry$11.99
Workplace Injustice Anger GuideWallen Isabelle$11.99
Work Addiction and Burnout LinkGreenwood Ester$11.99
Women in Yoga and WellnessBeattie Galina$11.99
Women in Stand Up ComedyChun Evangeline$11.99