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:
- Users can create bounties: Individuals or organizations define challenges (problems) and specify reward amounts (in tokens) for developers to solve those challenges.
 
- Developers can submit solutions: Participants work on these challenges, submitting their code for testing and validation.
 
- Automated Testing Framework: The submitted solutions are rigorously tested using predefined Mocha and Chai test cases inside a Cartesi Linux VM.
 
- 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?
- 
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.
 
 
- 
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.
 
 
- 
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.
 
 
- 
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.
 
 
- 
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.
 
 
- 
Archiving and Transparency:
- Successful projects are archived with the solution and proof of success, ensuring that the results are verifiable by anyone.
 
 
Key Features
- 
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.
 
 
- 
Dynamic Project Management:
- For every bounty, a new Foundry project is created on the VM, isolating the environment for better security and traceability.
 
 
- 
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.
 
 
- 
Real-Time Proofs:
- The platform generates real-time proofs of test case execution, ensuring zero tampering or manipulation.
 
 
- 
Seamless Token Distribution:
- Smart contract integration enables automatic reward distribution, eliminating the need for manual intervention.
 
 
- 
Developer-Friendly Environment:
- Developers use standard tools like Foundry, Mocha, and Solidity, making it easy to participate without needing to learn new frameworks.
 
 
- 
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
- 
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.
 
 
 
- 
Developer Submission:
- A developer submits their Solidity contract solution to the bounty.
 
 
- 
Testing on Cartesi VM:
- The submission is executed on Cartesi's Linux-based VM.
 
- Foundry test cases validate the solution.
 
 
- 
Proof and Reward:
- If the solution passes, a cryptographic proof is generated and logged.
 
- The reward is automatically distributed to the developer.
 
 
- 
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: 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
- 
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.
 
 
 
- 
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.
 
 
- 
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.
 
 
- 
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.
 
 
- 
Mocha and Chai:
- Supplementary test frameworks for running JavaScript-based test logic and validations, particularly useful for off-chain test scenarios.
 
 
- 
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.
 
 
- 
Ethereum-Compatible Blockchain:
- Deployed on an Ethereum-compatible blockchain to ensure broad accessibility.
 
- ERC-20 tokens are used as rewards for successful submissions.
 
 
- 
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.
 
 
- 
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
- 
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.
 
 
- 
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.
 
 
- 
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.
 
 
- 
Error Handling:
- If tests fail, detailed logs are shared with the submitter, and the temporary submission files are deleted.
 
 
Why These Technologies?
- 
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.
 
 
- 
Foundry:
- Key Benefit: Foundry is tailored for Solidity testing and integrates seamlessly with Cartesi, allowing us to leverage its speed and developer-friendly features.
 
 
- 
Ethereum-Compatible Blockchain:
- Key Benefit: Ethereum’s mature ecosystem ensures that users can interact with the platform using familiar tools like Metamask.
 
 
- 
Docker:
- Key Benefit: Containerization allows for a scalable infrastructure where multiple VMs can run simultaneously.
 
 
Partner Technologies and Benefits
- 
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.
 
 
- 
Foundry:
- Simplified the process of creating and managing test cases for Solidity contracts, reducing development time.
 
 
Hacky Yet Notable Elements
- 
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.
 
 
- 
Off-Chain Proofs:
- Generating cryptographic proofs for test execution was a unique implementation that adds an extra layer of trust.
 
 
- 
On-the-Fly Cleanup:
- Failed submissions trigger an automated cleanup process, deleting test files and preserving VM resources.
 
 
- 
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
- 
Integration with Cartesi VM:
- Ensuring compatibility between Foundry and Cartesi’s Linux environment required custom scripting and configuration.
 
 
- 
Gas Optimization:
- Minimizing on-chain interactions while maintaining robust off-chain computations was a delicate balance.
 
 
- 
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.