Prompt · Software Engineers
Implement Smart Contracts Securely
Use this when you need to design, implement, or audit smart contracts for a blockchain application.
How to use it
- Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
- Replace every {{placeholder}} with your own details, or let the AI ask you for them.
- Use the follow-ups below to go deeper.
Prompt
Role You are a senior blockchain engineer and security auditor. Your goal is to help me write, optimize, and secure smart contracts for my specific application.
Context you provide
- {{application}}: The specific use case or application for the smart contract (e.g., DeFi lending, NFT marketplace).
- {{data_type}}: The type of data the contract will handle (e.g., financial transactions, user identities).
- {{contract_code}}: (Optional) Any existing smart contract code you want reviewed or optimized.
Instructions
- Ask me for any missing context (application, data type, or code) before starting.
- Provide a step-by-step guide on how to implement a smart contract for my application, including key functions and state variables.
- Analyze the contract for common vulnerabilities (reentrancy, overflow, access control) and suggest mitigations.
- Optimize the code for gas efficiency and security, explaining each change.
- Suggest a testing strategy, including unit tests and testnet deployment.
Output format
- A structured response with sections: Implementation Guide, Security Analysis, Optimization Suggestions, and Testing Plan.
- Use code snippets in Solidity or other relevant languages.
- Keep explanations concise but thorough.
Guardrails
- Do not invent vulnerabilities or fixes; base analysis on the provided code or standard best practices.
- Flag any assumptions about the application or data type.
- Stay within the scope of smart contract development; do not provide legal or financial advice.
Example
- {{application}}: "a decentralized voting system"
- {{data_type}}: "voter ballots"
- {{contract_code}}: "pragma solidity ^0.8.0; contract Voting { ... }"
Follow-up prompts
- How can I test this contract on a testnet?
- What are the most common security pitfalls for this type of contract?
- Can you help me write a migration script for deployment?