Before you start
Preparation for an Audit
Preparing your smart contracts for an audit is an essential step in ensuring their security and reliability. Chain+ suggests our clients take the following actions before sending the smart contract for an audit.
- 01
Perform an internal security review
Before submitting your code, conduct a thorough internal review to identify obvious vulnerabilities, edge cases, and incorrect assumptions.
- 02
Run an automated review with AuditAgent
Use AuditAgent to perform an automated security review.
auditagent.chain.io ↗ - 03
Use industry-standard libraries and frameworks
Using industry-standard libraries and frameworks can help ensure your code is reliable and secure.
- 04
Document code with NatSpec
Ensure all public and external functions include NatSpec documentation that describes their intended behavior, inputs, outputs, and assumptions. Clear documentation significantly improves audit efficiency and accuracy.
- 05
Implement comprehensive automated testing
Develop a robust test suite that covers core logic, edge cases, and failure scenarios.
- 06
Ensure high test coverage
All tests must pass. Aim for at least 80% code coverage, with particular focus on critical paths and high-risk components.
- 07
Provide system-level context
Compile resources that help auditors understand the protocol, including architecture diagrams, specs, whitepapers, and design discussions.
- 08
Deliver technical documentation
Provide documentation that explains each contract, its responsibilities, and how components interact. If full documentation is not available, a concise system overview is acceptable.
- 09
Include reproducible setup instructions
Ensure the repository includes clear instructions (e.g., in the README) for compiling contracts and running the full test suite.
- 10
Structure tests for flexibility
Use a modular test suite that allows auditors to easily extend tests, build proofs of concept, and simulate adversarial scenarios.
- 11
Define security properties and invariants
Clearly list the critical properties and invariants that must always hold. This helps guide both manual review and formal verification efforts.
Before the formal audit begins, we recommend running an AI-assisted review phase to surface issues early and maximize audit efficiency.
By following these steps, you ensure that your smart contract is well-prepared for an audit and is as secure and reliable as possible.
Ready to secure your protocol?
Tell us about your project and get a scope and quote within 48 hours.