Code Genie AI Soroban auditor
SCF #23 Activation Award Static Analysis Tool $50,000 View in SCF
A platform that uses Artificial Intelligence (AI) technology to do instant audits of Soroban Smart Contracts.
Team

rohanhall

Other Chain Description

It exists for Ethereum. We need to build and fine-tune an AI model that is able to understand Soroban smart contracts and that can accurately audit these contracts and generate audit reports as well as generate code to remediate issues found with the Soroban contracts.

Deliverables List

Phase 1: MVP of Smart Contract Auditor for Low Complexity Contracts

 

Brief Description:

Develop a Minimum Viable Product (MVP) of the Code Genie Soroban Smart Contract Auditor, specifically tailored to handle low complexity Soroban smart contracts. This MVP will include basic functionality for auditing contracts written in Rust, focusing on syntax and structure validation.

 

How to Measure Completion:

Completion will be measured by the tool’s ability to audit low complexity contracts with consistent accuracy, as determined by test cases designed to cover a range of potential contract structures and common errors.

 

Estimated Date of Completion:

End of Month 1.

 

Budget:

$50,000

The details for the Phase 1 deliverables follows along with the Roadmap for subsequent proposed phases.

Phase 1 Details: MVP Core Functionalities - Basic Auditing Capabilities

Deliverable 1: Data Assembly and Preprocessing for Low Complexity Contract Auditing

Brief Description:

Gather a comprehensive collection of Soroban smart contracts written in Rust, prioritizing scalability and interoperability features. This will form the foundational dataset for training the Code Genie Soroban AI model.

 

How to Measure Completion:

Successful aggregation and preprocessing of an extensive and varied dataset of low complexity Soroban smart contracts, verified for quality and relevance to the project's scope.

 

Estimated Date of Completion:

End of Week 2.

 

Budget:

$10,000

 

Deliverable 2: Environment Setup and Preliminary AI Training

Brief Description:

Establish the development environment by installing the Rust toolchain and Soroban CLI. Begin preliminary training of the AI model using the assembled dataset to understand Rust syntax and low complexity contract structures.

 

How to Measure Completion:

Completion will be assessed by the successful setup of the development environment and the AI model’s ability to interpret and analyze Rust code and low complexity contract structures with a set accuracy threshold.

 

Estimated Date of Completion:

End of Week 4.

 

Budget:

$15,000

 

Deliverable 3: Development of Basic Auditing Algorithms

Brief Description:

Develop initial auditing algorithms focusing on identifying standard vulnerabilities and errors in low complexity smart contracts, ensuring they align with the performance characteristics of Soroban.

 

How to Measure Completion:

Algorithmic capability to identify and report common vulnerabilities and errors in low complexity smart contracts, validated against a set of contracts with known issues.

 

Estimated Date of Completion:

End of Week 4.

 

Budget:

$15,000

 

Deliverable 4: Integration with Soroban Tools & Initial Testing

Brief Description:

Integrate the preliminary AI model and auditing algorithms with Soroban’s SDKs, CLI, and RPC server. Conduct initial tests using synthetic and testnet contracts to evaluate the model's real-world application.

 

How to Measure Completion:

Integration is complete when the AI auditing tools are fully compatible with Soroban’s development environment, and initial tests on synthetic and testnet contracts demonstrate accurate auditing capabilities.

 

Estimated Date of Completion:

End of Week 4.

 

Budget:

$10,000

 

Phase 1 Total Budget: $50,000

By the end of the first phase, the project goal is to have established a solid foundation for the smart contract auditor with a focus on low complexity contracts. The success of this phase will be pivotal for ensuring the project's overall effectiveness and will set the stage for more advanced features in subsequent phases.



 

Project Categories

Product Type [If Security]

Progress on Previous (Awarded) Submissions

Technical architecture, MVP, demo, deliverables and budget, team and experience are all included in this proposal based on feedback provided from our previous submission.

Section

read

Product & Architecture

Introduction:

The Stellar Blockchain Community Fund plays a pivotal role in fostering innovation and development within the Stellar blockchain ecosystem. We are excited to submit a proposal for a groundbreaking project aimed at enhancing the security and functionality of Soroban smart contracts through the development of an AI-based smart contracts auditor.

Problem:

The blockchain sector is currently grappling with a troubling trend: numerous projects are launching with smart contracts that haven't been audited. This oversight has led to significant cybersecurity breaches and substantial financial losses. A recent analysis from 2022 highlights the severity of this issue:

  • The year witnessed an alarming $2.81 billion lost due to smart contract security failings.
  • Smart contract breaches constituted 70.36% of all security incidents within the Web3 domain.
  • Notably, 91.96% of the compromised smart contracts had been audited, some even by well-known security firms.

Challenges in this area stem from several factors. For many projects, the cost of a thorough audit by a top-tier firm, often reaching tens of thousands of dollars, is prohibitively expensive. In instances where audits are conducted, they may still fail to detect certain vulnerabilities due to the complex and evolving nature of smart contract code and the limitations of current auditing methodologies. Furthermore, malicious actors are becoming increasingly sophisticated, employing advanced AI tools to identify and exploit weaknesses in smart contracts.

Solution:

Our goal is to create an advanced smart contracts auditor that leverages artificial intelligence (AI), a Fine-Tuned Large Language Model (LLM), and other specifically trained LLM models and datasets to audit Soroban smart contracts. This “Code Genie Soroban” AI auditor will provide an automated and efficient auditing solution for Soroban smart contracts.  Some potential features and benefits are below.

 

1. Real-Time Audits: The Code Genie Soroban auditor will utilize artificial intelligence and will perform audits in real time.  The results will be immediate or within seconds of the AI reviewing the smart contract code. This "instant results" approach will save projects a significant amount of time instead of waiting for their audit results which can take days or weeks typically.

2. Cost Savings: The audits will be priced to democratize the auditing of contracts.  Instead of projects spending tens of thousands of dollars to audit smart contracts, auditing will be priced to be affordable for startups and other projects. This will make auditing a standard process for even the smallest of projects, unfunded, instead of being reserved only for fully funded projects.

3. Instant Static Analysis by examining the source code to identify potential issues including:

  • Security Flaws: Common vulnerabilities like integer overflows, underflows, and reentrancy attacks.
  • Unsafe Code: Usage of Rust's unsafe keyword, which could lead to memory safety issues if not handled correctly.
  • Logic Bugs: Mistakes in the code that could cause incorrect behavior, such as off-by-one errors, incorrect condition checks, or mishandled error states.
  • Performance Issues: Inefficient use of data structures or algorithms that could lead to performance bottlenecks.
  • Non-idiomatic Rust Patterns: Code that doesn't follow the conventions and idioms of Rust, which can lead to maintainability and safety issues.

4. Code Fix, Remediation, and Recommendations will be provided where our AI tool will generate code to fix bugs and issues found in the Smart Contracts source code.  This can save a significant amount of time where typical analysis may point out issues but the developer is left to figure out how to solve these issues.  In the case of our AI Auditor, the fixed code is also provided as a part of the audit report.

5. A Detailed Audit Report will be provided that will Security audit, Functional audit, Visibility & Transparency, Ownership & Accountability and other details detected from the code analyzed by the AI Auditor.

Audience

The Soroban Contract Auditor is designed to serve a diverse range of users within the blockchain community:

  • For Developers: It offers developers the ability to comprehensively review their smart contracts on Soroban. Before launching their contracts on the blockchain, developers can verify security measures and ensure compliance with established coding standards.

  • For Security Professionals: This tool is invaluable for auditors and cybersecurity specialists tasked with scrutinizing Stellar-based smart contracts. It facilitates in-depth examinations, enabling the detection of security gaps and provision of specialized recommendations.

  • For the Stellar Community: Members of the Stellar network, including investors and active community contributors, can leverage the Soroban Contract Auditor as a reliable resource for assessing the integrity of smart contracts they consider supporting or using.

Benefits

  1. Enhanced Trust: By offering an advanced auditing tool like Code Genie Soroban, the Stellar Blockchain Community can instill greater trust in its smart contracts. Users and developers will have confidence that their contracts have been thoroughly reviewed and are secure, which is essential for attracting and retaining users and investors.
  2. Developer Productivity: Code Genie Soroban's automated auditing and code fix recommendations capabilities will significantly boost developer productivity. Developers can focus on creating innovative applications and contracts without being burdened by manual auditing tasks. This will attract more developers to the Stellar ecosystem.
  3. Broad Adoption: A developer-friendly, AI-based smart contracts auditor like Code Genie Soroban will encourage more developers to choose Stellar as their blockchain platform. This influx of talent will result in a wider range of decentralized applications (DApps) and smart contracts, driving adoption and ecosystem growth.
  4. Security and Reliability: The enhanced security and reliability of Soroban smart contracts will protect users' assets and ensure that the Stellar blockchain remains a trustworthy platform. This is particularly important as blockchain technology becomes increasingly integrated into various industries, including finance, supply chain, and healthcare.
  5. Competitive Advantage: Offering Code Genie Soroban as a feature of the Stellar ecosystem can provide a competitive advantage over other blockchain platforms. It showcases Stellar's commitment to innovation, security, and developer support.
  6. Ecosystem Growth: A secure and efficient smart contracts auditing tool can lead to the creation of more complex and sophisticated applications on the Stellar network. This growth will attract more users, investors, and developers, contributing to the overall success and sustainability of the Stellar Blockchain Community.

In summary, the development of Code Genie Soroban and its integration into the Stellar ecosystem represents a strategic investment in the security, functionality, and growth of the Stellar blockchain. It will empower developers, protect users, and position Stellar as a leading platform for decentralized applications and smart contracts.

Technical Architecture

Our Technical Architecture is designed to leverage GPT-4 for auditing Stellar Soroban smart contracts. This process is broken down into distinct phases, each with its specific focus and milestones:

Phase 1: MVP Development

  • Objective: Within four weeks, we plan to deliver a Minimum Viable Product (MVP) capable of auditing simple smart contracts.

Phase 2: Model Enhancement

  • Progression: Building on Phase 1's success, we will refine our AI model, integrating user feedback to extend our auditing capabilities to contracts of medium complexity.

Phase 3: Advanced Auditing

  • Expansion: Leveraging the groundwork laid in the initial phases, our system will evolve to tackle high-complexity smart contracts, offering comprehensive auditing solutions.

Detailed Approach:

  • Model Selection: We will begin with GPT-4, selected for its advanced language understanding capabilities, to be fine-tuned for our specific auditing needs.

  • Data Enrichment: To address the limited availability of Soroban contract data, we will synthesize additional examples, drawing on expert insights to emulate a range of coding scenarios.

  • Foundational Training: Employing GPT-4 as our starting point, we prioritize efficiency and cost-effectiveness, allowing swift iteration and concept validation.

  • Iterative Feedback System: A feedback loop will be established involving human experts who will refine the AI's output, thereby continuously enhancing the model's accuracy.

Fine Tuning and Deployment Steps:

  • Data Preparation: Aggregate and preprocess a dataset comprising Soroban smart contracts and Rust code to reflect the platform's unique attributes.

  • Development Environment: Set up the necessary tools, including the Rust toolchain and the Soroban CLI, to align our development efforts with the Soroban ecosystem.

  • AI Model Training: Train a foundational AI model on existing datasets and simulated contracts to grasp the intricacies of Rust and Soroban contract patterns.

  • Algorithm Innovation: Develop custom algorithms aimed at identifying typical vulnerabilities within the smart contracts, utilizing Soroban's inherent efficiency features.

  • Soroban Integration: Integrate our tools seamlessly with Soroban’s SDKs, CLI, and RPC server to maintain coherence with the platform's development norms.

  • Testnet Evaluation: Deploy and audit test smart contracts on the Soroban testnet, validating the model's effectiveness in practical applications.

  • Community Involvement: Collaborate with the Stellar community to garner feedback, driving iterative enhancements to the AI auditing model.

  • Rollout and Improvement: Officially release the auditing tool on the testnet and

establish an ongoing process of refinement based on active feedback from community engagement and real-world application data. This iterative cycle ensures that our tool remains at the forefront of smart contract auditing technology, adapting to new challenges and evolving security needs.

Technical Architecture Doc

https://drive.google.com/file/d/1nJfhgFYhT3wYOyydMs9JgMc-2HSc3ajv/view?usp=drive_link

Project URL

https://qa.code-genie.ai/

Code URL

https://github.com/rohanocesha/codegenie.git

Video URL

https://www.loom.com/share/d90178f3c07845a3a38d93061be23730?sid=612c8282-50a3-48f7-a2a6-fc1ccd881407

Pitch Deck URL

Section

read

Requested Budget in USD ($)

50000

Total Expected Roadmap

Total Expected Roadmap

Phase 1: Basic Auditing Capabilities (Month 1) - $50,000

  • Deliverable 1: MVP for Low Complexity Contract Auditing

Phase 2: Intermediate Auditing Capabilities (Month 2) - $50,000

  • Deliverable 2: Enhanced Auditing for Medium Complexity Contracts

Phase 3: Advanced Auditing Capabilities (Month 3) - $50,000

  • Deliverable 3: Advanced Auditing for High Complexity Contracts and Decompilation Feature

Total: $150,000 / ETA: 3 months

Deliverables List

Deliverable 1: MVP of Smart Contract Auditor for Low Complexity Contracts

Brief Description:
Develop a Minimum Viable Product (MVP) of the Code Genie Soroban Smart Contract Auditor, specifically tailored to handle low complexity Soroban smart contracts. This MVP will include basic functionality for auditing contracts written in Rust, focusing on syntax and structure validation.

How to Measure Completion:
Completion will be measured by the tool’s ability to audit low complexity contracts with consistent accuracy, as determined by test cases designed to cover a range of potential contract structures and common errors.

Estimated Date of Completion:
End of Month 1.

Budget:
$50,000

Deliverable 2: Enhanced Auditing for Medium Complexity Contracts

Brief Description:
Enhance the Code Genie Soroban Smart Contract Auditor to accurately audit medium complexity contracts. This involves incorporating additional data and feedback from the first month to refine the AI’s capabilities.

How to Measure Completion:
Successful auditing of medium complexity contracts with a high degree of accuracy, benchmarked against a curated set of contracts with known vulnerabilities.

Estimated Date of Completion:
End of Month 2.

Budget:
$50,000

Deliverable 3: Advanced Auditing for High Complexity Contracts

Brief Description:
Finalize the auditor's ability to handle high complexity smart contracts. This includes fine-tuning the data and algorithms based on continued feedback.

How to Measure Completion:

Successful auditing of high complexity contracts with a high degree of accuracy, benchmarked against a curated set of contracts with known vulnerabilities.

Estimated Date of Completion:
End of Month 3.

Budget:
$50,000

Total Project Budget: $150,000

Requested Budget in USD ($): 150,000


 

Section

read

Public Entity Name

Code Genie AI (code-genie.ai)

Entity Description

Code Genie AI (code-genie.ai) is an IT services and emerging technology consulting firm that focuses on helping organizations build and monetize AI technologies. We provide strategic advice, create product vision and product roadmap, build and deploy AI products, support deployed platforms.

Team bio

Rohan Hall is a published author of multiple business and technology books, a sought-after public speaker, technology educator, advisor, and a respected technologist for Artificial Intelligence, blockchain, and other emerging technologies. He is the founder and visionary CEO of Code Genie AI, a technology company that builds Artificial Intelligence and other technologies for enterprises. Past organizations that Hall has worked with include Oracle, Corning, HP, Honda, PeopleSoft, Capital Group American Funds, American Red Cross, Avery Dennison, Robert Half, Nevada Power, and other organizations.

Hall’s Blockchain Experience include:

Founder/CTO/Architect/Developer for different projects.  Author of Blockchain Book and Blockchain courses. Developer/CTO of Blockchain Interoperability platform; verifiable credentials; Decentralized Identifiers (DIDs); the first blockchain Covid-19 immunity passport; Supply Chain traceability platform; Crypto payment platform that supports 200 digital assets and over 100 fiat currencies for payment.  The platform integrated with over 80,000 merchants ecommerce platforms for crypto and fiat payments; B2B Cross Border payment platform, partnering with Ripple and other global partners.  Worked directly with SEC on various compliance items including KYB, KYC, KYT, the Travel Rule, various wallet infrastructures, various exchanges, partnerships with Ripple, Coinbase, Gemini, Circle, Binance and other exchanges as well as on/off ramp partners.

Hall’s Artificial Intelligence Experience include:

Creator of Code Genie AI platform to audit smart contracts; AI to generate resumes; AI to audit code from various development languages; AI for digital transformation; AI to generate thousands of blogs as a marketing tool; creator of online AI courses; author of published book about Artificial Intelligence.