Using AI Without Opening Smart Contract Holes

Using AI Without Opening Smart Contract Holes

AI assistants now write a lot of Solidity, and the code they return usually compiles and reads cleanly. That says very little about whether it is safe. The working rule for a blockchain team is to treat AI-generated contract code as untrusted until it has passed your own gates, and to run those gates before the code reaches an external audit. This guide sets out five gates, the failure types to check first, and a short example of a bug that passes a happy-path test.

Two recent studies point the same way. A 2025 workshop paper that analysed 250 AI-generated contracts and a 2026 preprint from Deakin University both conclude that AI-generated contracts need human-led security checks before deployment (Vella et al., 2025; Do et al., 2026). The rest of this article turns that conclusion into a process a tech lead can enforce.

What do studies say about AI-written smart contracts?

A 2025 study of 250 contracts. Researchers at the University of Genoa and the University of Cagliari generated 250 Solidity contracts with GPT-4 and DeepSeek-Coder and analysed them with the Slither and Mythril tools. They found that the models can produce syntactically correct and functionally relevant contracts, but that the output is not yet reliable enough for fully autonomous deployment and frequently needs manual review and correction. Reentrancy was the most prevalent issue in the Mythril results (Vella, Cinà, Ribaudo and Roli, 2025).

A 2026 preprint on newer models. Researchers at Deakin University tested Solidity contracts generated by ChatGPT, Gemini and Sonnet against a broad set of known vulnerabilities. Despite their syntactic correctness and functional completeness, the contracts frequently showed severe security flaws that could be exploited in real-world settings. The authors recommend treating AI-generated contracts as untrusted code and applying security-first workflows before production, and they argue that asking an LLM to review its own output cannot replace rigorous verification and independent auditing (Do, Sohrabi and Hassan, 2026).

What the studies do not tell you. Models change quickly, and each study used its own prompt set. The Genoa authors themselves note that 250 contracts and predefined prompt templates limit how far the results generalise. Read both papers as a reason to keep human gates in place, not as a ranking of models or a failure rate for your own codebase.

Which failure types should reviewers check first?

The OWASP Smart Contract Top 10 (2025) was built from an analysis of 149 security incidents from 2024 together with two other sources, and the sources it draws on collectively document more than USD 1.42 billion in losses. Its first three entries are access control vulnerabilities, price oracle manipulation and logic errors (OWASP, 2025). The table below maps six entries of that list to what a reviewer should look for in generated code. The second and third columns are this article’s review checklist, not OWASP text.

OWASP 2025 entryWhat to look for in generated codeReviewer’s check
SC01 Access controlFunctions that move funds or change settings with no caller restriction, or with the wrong one, including tx.origin used for authorizationList every public or external function that changes state and name who may call it
SC03 Logic errorsCode that does something plausible but differs from what the spec saysCompare behaviour with the written invariants, not with the code’s own comments
SC04 Lack of input validationMissing range checks, zero-address checks and empty-array handlingAsk what happens with 0, the maximum value and an unexpected address
SC05 ReentrancyAn external call made before the contract updates its own stateRead each external call and check what state is still stale at that point
SC06 Unchecked external callsReturn values of low-level calls that are ignoredSearch for every call, delegatecall and send and confirm the result is handled
SC08 Integer overflow and underflowunchecked blocks and type casts that were added to save gasRequire a written reason for every unchecked block

The Solidity documentation is direct about several of these. It says never to use tx.origin for authorization, and that interaction with other contracts should be the very last step in any function, which is the checks-effects-interactions pattern. It also warns that even in the default checked arithmetic mode you should not assume you are protected from overflow bugs, because an overflow reverts and can leave a contract stuck in a certain state (Solidity documentation).

What does a reentrancy bug that passes a happy-path test look like?

The example below was written for this article to show the pattern. It is not taken from any candidate profile, client project or BlockchainWork data. A simple vault lets users withdraw their balance, and an AI assistant returns this version:

// Version A: compiles, and a normal withdraw test passes
function withdraw(uint256 amount) external {
    require(balances[msg.sender] >= amount, "insufficient balance");
    (bool ok, ) = msg.sender.call{value: amount}("");
    require(ok, "transfer failed");
    balances[msg.sender] -= amount;
}

The function sends the Ether before it reduces the balance. If the receiver is a contract, it can call withdraw again from its receive function while the balance is still unchanged, which is the call-back the Solidity documentation describes. The corrected order finishes the checks and the state update first:

// Version B: checks, then effects, then the external interaction
function withdraw(uint256 amount) external {
    require(balances[msg.sender] >= amount, "insufficient balance");
    balances[msg.sender] -= amount;
    (bool ok, ) = msg.sender.call{value: amount}("");
    require(ok, "transfer failed");
}

A unit test that deposits and withdraws once passes on both versions. Only a test that withdraws from a malicious receiving contract, or a fuzz or invariant test that checks “total withdrawn never exceeds total deposited”, separates them. A reentrancy guard from a maintained library adds a second layer, but the ordering should be right first.

Which five gates should AI-written contract code pass before an audit?

Gate 1: write the specification before the prompt. List in plain language what must always be true (for example, users can never withdraw more than they deposited) and who may do what. Ethereum.org describes formal verification as proving that a formal model of a contract matches a specification of its security properties (ethereum.org, 2026). Even without a prover, a written list gives your tests and reviewers something to check against, and it gives the assistant a clearer instruction than a one-line feature request.

Gate 2: compile cleanly and run static analysis on every pull request. The Solidity documentation advises using the latest compiler version so that you are notified of newly introduced warnings, and taking those warnings seriously (Solidity documentation). Ethereum.org lists static analysis tools such as Cyfrin Aderyn, Mythril and Slither and says to run them ideally before each pull request is merged and to compare differences in output (ethereum.org, 2026). Triage by severity: in the Genoa study, Slither’s informational and optimization categories accounted for over 80% of its findings (Vella et al., 2025). For a tool-by-tool comparison, see our guide to 10 smart contract audit tools.

Gate 3: test beyond the happy path. Ethereum.org notes that unit tests are only as effective as the tests that are written, and describes fuzzing as executing contract code with random input values to detect operations that violate security properties (ethereum.org, 2026). Write the tests from the specification, not from the generated code, and do not let the same assistant be the only author of both the code and its tests. The Deakin authors make the same point about self-review (Do et al., 2026).

Gate 4: review line by line with a short checklist. The Solidity documentation puts it plainly: the more people examine a piece of code, the more issues are found, and review also shows whether the code is easy to understand (Solidity documentation). Give reviewers the table above, ask them to explain every external call and every function that moves value, and ask the author to mark which parts of the pull request were AI-generated. Smaller contracts are easier to review, and the same documentation recommends keeping contracts small and modular.

Gate 5: hand the auditors a package they can use. Ethereum.org warns that audits will not catch every bug and are mostly designed to provide an additional round of reviews, and it recommends documenting code properly and adding inline comments for auditors (ethereum.org, 2026). Send the specification, the test results, the triaged static analysis output and the list of AI-generated parts. The aim is that audit time goes to design questions, not to bugs a tool would have flagged on the first day.

What can a tech lead look for in candidates who use AI on contracts?

Hiring for this work means asking how someone checks AI output, not which assistant they use. BlockchainWork’s candidate pool covers more than 10 position groups from fresher to senior, and Blockchain/Web3 is one of them next to Backend, Fullstack, Data/AI and DevOps/Cloud. In our CV data for October 2026, about 60% of CVs list AI skills, and more than half of those are engineers who directly use and build AI features. Nearly half of profiles include a GitHub, portfolio or product demo link, so a tech lead can often open the code before the first interview (BlockchainWork CV data, October 2026).

Employers in Vietnam say they value responsible use. ManpowerGroup’s hiring outlook survey for the third quarter of 2026, run in April 2026, collected data from 265 employers in Vietnam, and Nhan Dan reported that 83% of employers in Vietnam are willing to offer higher compensation to candidates who can use AI tools effectively and responsibly (Nhan Dan, 2026). That figure is a stated willingness, not a count of pay rises, but “responsibly” is exactly what the five gates make visible.

Questions that bring it out in an interview:

  • Show me a pull request where an assistant wrote part of the code. What did you change before merging?
  • Which invariants did you write before you asked for the code, and which test would break if one failed?
  • Here is Version A of the withdraw function. What is wrong with it, and how would you test for it?
  • Name one suggestion from an assistant that you rejected on a contract and why.

For a wider screening method that is not specific to smart contracts, see How to Screen for Real AI Skills When Hiring in Vietnam.

Looking for blockchain engineers in Vietnam who can show how they check AI-generated code? Send a hiring request through our hiring offer page, or email our team at contact@blockchainwork.net to describe the role.

Frequently asked questions

1. Can AI write production-ready smart contracts?

Not on its own. Both studies reviewed here found security flaws in AI-generated contracts that looked correct, and their authors recommend treating the code as untrusted until people have checked it (Vella et al., 2025; Do et al., 2026).

2. Can we ask the same AI to audit its own code?

It can help as one more pass, but it cannot replace verification or an independent audit. The Deakin authors state that LLM-based self-review by the developer cannot replace rigorous verification and independent auditing (Do et al., 2026).

3. Does passing the five gates make an audit unnecessary?

No. Ethereum.org says audits do not catch every bug, and the gates do not catch every bug either. They are layers: each one removes a class of problem so that the external audit can focus on design and edge cases (ethereum.org, 2026).

4. Which tools should a team start with?

Start with a clean compile on the latest compiler, then add a static analyser such as Slither, Aderyn or Mythril to every pull request, then add fuzz or invariant tests built from your written specification (Solidity documentation; ethereum.org, 2026).

Sources

  • OWASP, OWASP Smart Contract Top 10 (2025) (2025)
  • Solidity documentation, Security Considerations (current documentation, read November 2026)
  • ethereum.org, Smart contract security (2026)
  • Vella, Cinà, Ribaudo and Roli, Vulnerability Assessment of LLM-Generated Smart Contracts in Ethereum, GeCoIn 2025 workshop at ECAI 2025 (2025)
  • Do, Sohrabi and Hassan, Evaluating the Vulnerability Landscape of LLM-Generated Smart Contracts, arXiv preprint (2026)
  • ManpowerGroup Vietnam, hiring outlook survey Q3 2026, reported by Nhan Dan (2026)
  • BlockchainWork, BlockchainWork CV data, October 2026 (2026)

BlockchainWork

** This content does not constitute investment advice, investment strategy recommendations, or sponsored advertising. Please refer to our Disclaimer and use the information at your own discretion.

BlockchainWork – Vietnam’s leading blockchain talent community, connecting passionate candidates with pioneering companies in blockchain and Web3. With 25,000+ registered candidates, 12+ educational institution MOUs and 350+ hiring companies, BlockchainWork is the specialized platform for blockchain careers, from Vietnam to global opportunities.

>> You may also like:

Writing a Job Description That Asks for AI Impact

Editors BlockchainWork Nov 16, 2026 1 Views

A job description that says “must know ChatGPT” tends to attract tool lists. A job description that asks for AI impact tends to attract evidence. Add one short section to your next JD that states what change you expect…

Hiring QA and BA Talent in Vietnam: A 2026 Guide

Editors BlockchainWork Nov 15, 2026 1 Views

To hire QA engineers and business analysts (BA) in Vietnam in 2026, do not screen for the longest list of AI tools. Screen for one piece of work where the candidate used AI, measured the change and checked the…

What AI-Ready Talent Means to Us at BlockchainWork

Editors BlockchainWork Nov 11, 2026 1 Views

Answer first: at BlockchainWork, “AI-ready” does not mean a candidate who can name AI tools. It means a candidate whose work shows what changed and at what scale when they worked with AI, and BlockchainWork scores candidates by real…

Blockchain - Web3 jobs

Chuyên Viên Quan Hệ Khách Hàng - Khối Môi Giới

Apply by 30/12/2027
Salary: Negotiable

Nhân Viên Kinh Doanh

Apply by 30/11/2026
Salary: Negotiable

Senior AI Engineer

Apply by 30/11/2026
Salary: Negotiable

Thực Tập Sinh Thiết Kế Đồ Họa

Apply by 04/12/2026
Salary: Negotiable

CTV Kinh Doanh

Apply by 30/11/2026
Salary: 2 - 3 million VND

Product Monetization Specialist - Gamota

Apply by 30/11/2026
Salary: Negotiable

CTV SEO YouTube – Game Global (OTA Network)

Apply by 30/11/2026
Salary: From 3 million VND

AI Software Engineering Lead/Technical Lead

Apply by 30/11/2026
Salary: 40 - 50 million VND

(Remote) B2B Sales Executive

Apply by 30/12/2026
Salary: Negotiable

Social Commerce Executive – Gig Store

Apply by 30/11/2026
Salary: 10 - 12 million VND

Product Owner

Apply by 30/11/2026
Salary: 15 - 20 million VND

Giám Đốc Kinh Doanh - Khối Môi Giới

Apply by 30/12/2027
Salary: Negotiable

Nhân Viên Kinh Doanh Giải Pháp Thanh Toán B2B

Apply by 30/11/2026
Salary: Negotiable

Nhân Viên Phát Triển Kinh Doanh (Payment Acceptance)

Apply by 29/11/2026
Salary: Negotiable

Phát Triển Hệ Thống Backend

Apply by 30/11/2026
Salary: Negotiable

Marketing Executive (Blockchain/Web3)

Apply by 30/11/2026
Salary: Negotiable

(Onsite Project) Golang Developer

Apply by 30/11/2026
Salary: Negotiable

Business Development (Blockchain/Web3)

Apply by 30/11/2026
Salary: Negotiable