project screenshot 1
project screenshot 2
project screenshot 3

TestedOK

TestedOK is a solidity bounty platform, which enables users to create and participate in bounties while creating off chain proofs for the same. It uses cartesi's vm and linux environment to run test cases on machine and generate proofs in real time.

TestedOK

Created At

ETHGlobal Bangkok

Project Description

TestedOK is a cutting-edge platform designed for developers and participants to create, test, and validate Solidity-based smart contract solutions through a seamless bounty system. By leveraging Cartesi's VM and a Linux-based execution environment, TestedOK ensures a fair, transparent, and efficient system for handling smart contract challenges. Here's a detailed explanation of how the platform works and what sets it apart:


What is TestedOK?

TestedOK is a Solidity bounty platform where:

  1. Users can create bounties: Individuals or organizations define challenges (problems) and specify reward amounts (in tokens) for developers to solve those challenges.
  2. Developers can submit solutions: Participants work on these challenges, submitting their code for testing and validation.
  3. Automated Testing Framework: The submitted solutions are rigorously tested using predefined Mocha and Chai test cases inside a Cartesi Linux VM.
  4. Decentralized Proofs: The platform generates off-chain proofs in real time to verify the integrity of the testing process, ensuring that results are tamper-proof.

How Does It Work?

  1. Bounty Creation:

    • A user defines a smart contract problem (e.g., "Implement a token staking system") along with a test case suite written in Foundry.
    • A new Foundry project is initialized on the Cartesi VM to isolate the environment for the bounty.
  2. Participants Submit Solutions:

    • Developers submit their Solidity code as solutions to these bounties.
    • Each submission is stored securely, and unique test scripts are dynamically created for every submission.
  3. Automated Testing on Cartesi VM:

    • The Cartesi VM, powered by a Linux-based execution environment, compiles and runs the submitted code against the provided test cases.
    • It uses Foundry to run the tests in an isolated sandbox to ensure complete fairness and reproducibility.
  4. Off-Chain Proofs Generation:

    • The testing process generates cryptographic proofs that validate whether a submission has passed or failed the test cases.
    • These proofs are created off-chain, ensuring that the process is efficient and scalable.
  5. Reward Distribution:

    • Once a submission passes all test cases, the bounty rewards are automatically distributed to the developer's wallet.
    • The platform updates the status of the bounty, marking it as resolved and assigning the winner.
  6. Archiving and Transparency:

    • Successful projects are archived with the solution and proof of success, ensuring that the results are verifiable by anyone.

Key Features

  1. Integration with Cartesi VM:

    • The platform uses Cartesi's rollup technology and VM to run test cases in a Linux-based, deterministic environment.
    • This ensures that the test execution is consistent, reproducible, and cryptographically verifiable.
  2. Dynamic Project Management:

    • For every bounty, a new Foundry project is created on the VM, isolating the environment for better security and traceability.
  3. Test Case Execution:

    • Test cases written in Mocha and Chai frameworks provide robust validation of the submitted code.
    • Developers can focus on solving problems, knowing that their solutions will be evaluated fairly.
  4. Real-Time Proofs:

    • The platform generates real-time proofs of test case execution, ensuring zero tampering or manipulation.
  5. Seamless Token Distribution:

    • Smart contract integration enables automatic reward distribution, eliminating the need for manual intervention.
  6. Developer-Friendly Environment:

    • Developers use standard tools like Foundry, Mocha, and Solidity, making it easy to participate without needing to learn new frameworks.
  7. Transparent and Immutable:

    • The entire process, from bounty creation to solution submission and validation, is logged and can be audited by any participant.

Why TestedOK Stands Out

  • Zero Chances of Problems:

    • The use of a deterministic Cartesi VM ensures that test execution is tamper-proof and results are guaranteed.
  • Efficient Off-Chain Computation:

    • By offloading heavy testing processes to Cartesi's VM, the platform avoids high gas costs and inefficiencies on-chain.
  • Real-Time Validation:

    • Solutions are tested and validated in real time, providing immediate feedback to developers and bounty creators.
  • Scalability:

    • The platform’s design ensures that it can handle multiple bounties and submissions concurrently without performance bottlenecks.

A Typical Workflow Example

  1. Create a Bounty:

    • A user submits a bounty with the following details:
      • Problem description (e.g., "Implement a DeFi yield aggregator").
      • Reward amount (e.g., 1000 tokens).
      • Test cases written in Foundry.
  2. Developer Submission:

    • A developer submits their Solidity contract solution to the bounty.
  3. Testing on Cartesi VM:

    • The submission is executed on Cartesi's Linux-based VM.
    • Foundry test cases validate the solution.
  4. Proof and Reward:

    • If the solution passes, a cryptographic proof is generated and logged.
    • The reward is automatically distributed to the developer.
  5. Archive:

    • The project is archived with the solution and proof for transparency.

Use Cases

  • Bug Bounties:
    • Incentivize developers to find and fix bugs in smart contracts.
  • Feature Development:
    • Encourage developers to add new features to existing contracts.
  • Educational Challenges:
    • Offer Solidity coding challenges for learning and community engagement.
  • Hackathons:
    • Provide a platform for hackathon submissions and validation.

TestedOK combines the power of decentralized technology, Cartesi's computational capabilities, and developer-friendly tools to create a robust and transparent ecosystem for smart contract development and validation. It’s a one-stop solution for Solidity challenges, ensuring fairness, security, and efficiency in every step.

How it's Made

How It's Made: Behind the Scenes of TestedOK

Building TestedOK required combining cutting-edge technologies with a robust architecture to deliver a seamless and transparent bounty platform for Solidity smart contracts. Here's a detailed look at the components, tools, and design choices that power the platform.


Technologies Used

  1. Smart Contracts (Solidity):

    • At the core of TestedOK are Solidity smart contracts, which handle the creation and management of bounties, as well as reward distribution.
    • Key contracts include:
      • BountyManager: Handles bounty creation, submissions, and reward distribution.
      • RewardDistributor: Automates token transfers based on validated submissions.
  2. Cartesi Rollups and Virtual Machine (VM):

    • Cartesi Rollups provide a scalable off-chain computation layer.
    • The Cartesi VM runs test cases in a deterministic Linux environment, ensuring tamper-proof and reproducible results.
    • Off-chain proofs are generated for every test execution, ensuring transparency and trust.
  3. Foundry:

    • Used as the primary testing framework for Solidity smart contracts.
    • Each bounty initializes a unique Foundry project within the Cartesi VM, creating an isolated and secure environment.
    • Test cases are written in Foundry, leveraging its efficient test execution capabilities.
  4. JavaScript/TypeScript Backend:

    • Manages off-chain operations such as:
      • Parsing submissions.
      • Interfacing with Cartesi Rollups.
      • Managing test scripts and project directories.
    • Built using Node.js and TypeScript for type safety and scalability.
  5. Mocha and Chai:

    • Supplementary test frameworks for running JavaScript-based test logic and validations, particularly useful for off-chain test scenarios.
  6. Dockerized Infrastructure:

    • The entire system is containerized using Docker to ensure consistency across environments.
    • Each Cartesi VM runs inside a container, providing an isolated and scalable setup.
  7. Ethereum-Compatible Blockchain:

    • Deployed on an Ethereum-compatible blockchain to ensure broad accessibility.
    • ERC-20 tokens are used as rewards for successful submissions.
  8. Storage and State Management:

    • Off-chain storage of test cases, submissions, and logs using Cartesi Rollups.
    • Cryptographic proofs are generated and stored for auditing and dispute resolution.
  9. Frontend Framework:

    • A sleek and responsive user interface built using React with Tailwind CSS.
    • Allows users to create bounties, submit solutions, and view real-time test results.

Architecture Overview

  1. Bounty Lifecycle:

    • A user creates a bounty via the frontend, specifying the problem, test cases, and reward amount.
    • The backend initializes a Foundry project in the Cartesi VM, storing the test cases and problem statement.
  2. Submission and Testing:

    • Developers submit their Solidity code through the platform.
    • The backend generates a test script specific to the submission and triggers the Cartesi VM to execute the tests.
    • The VM runs the tests in an isolated environment, generating off-chain proofs for transparency.
  3. Reward Distribution:

    • If the submission passes the tests, the smart contract distributes the reward automatically to the submitter’s wallet.
    • The solution and proof are archived for future reference.
  4. Error Handling:

    • If tests fail, detailed logs are shared with the submitter, and the temporary submission files are deleted.

Why These Technologies?

  1. Cartesi VM:

    • Key Benefit: Cartesi’s ability to run computations off-chain drastically reduces on-chain gas costs.
    • Deterministic Linux environments ensure reproducibility, removing any ambiguity in test results.
  2. Foundry:

    • Key Benefit: Foundry is tailored for Solidity testing and integrates seamlessly with Cartesi, allowing us to leverage its speed and developer-friendly features.
  3. Ethereum-Compatible Blockchain:

    • Key Benefit: Ethereum’s mature ecosystem ensures that users can interact with the platform using familiar tools like Metamask.
  4. Docker:

    • Key Benefit: Containerization allows for a scalable infrastructure where multiple VMs can run simultaneously.

Partner Technologies and Benefits

  1. Cartesi:

    • Partnering with Cartesi enabled us to move heavy computations off-chain, making the platform cost-effective and scalable.
    • The VM provides a secure environment for test execution, removing reliance on centralized servers.
  2. Foundry:

    • Simplified the process of creating and managing test cases for Solidity contracts, reducing development time.

Hacky Yet Notable Elements

  1. Dynamic Foundry Projects:

    • Every new bounty dynamically initializes a unique Foundry project within the VM, ensuring a clean and isolated test environment.
    • This was a challenging but rewarding approach to maintain scalability and isolation.
  2. Off-Chain Proofs:

    • Generating cryptographic proofs for test execution was a unique implementation that adds an extra layer of trust.
  3. On-the-Fly Cleanup:

    • Failed submissions trigger an automated cleanup process, deleting test files and preserving VM resources.
  4. Dual Framework Testing:

    • Combining Foundry (for Solidity) and Mocha/Chai (for JavaScript logic) provided flexibility to handle both on-chain and off-chain test cases.

Challenges Faced

  1. Integration with Cartesi VM:

    • Ensuring compatibility between Foundry and Cartesi’s Linux environment required custom scripting and configuration.
  2. Gas Optimization:

    • Minimizing on-chain interactions while maintaining robust off-chain computations was a delicate balance.
  3. Dynamic Project Management:

    • Handling isolated environments for each bounty required innovative resource allocation and cleanup mechanisms.

TestedOK is a testament to the power of decentralized technology, bridging the gap between secure smart contract development and fair rewards. By combining Ethereum, Cartesi, and Foundry, we’ve created a platform that empowers developers while ensuring transparency and trust.

background image mobile

Join the mailing list

Get the latest news and updates