Skip to content

PoA & VM Execution

Past due by 8 months 100% complete

Milestone: PoA & VM Execution

Overview

This milestone focuses on implementing Proof of Authority (PoA) consensus and Virtual Machine (VM) execution for OPNet, enhancing the Bitcoin Layer 1 with smart contract capabilities. This milestone will also include the integration of WBTC (Wrapped Bitcoin) swapping functionalities and p2p trading.

Objectives

  1. PoA …

Milestone: PoA & VM Execution

Overview

This milestone focuses on implementing Proof of Authority (PoA) consensus and Virtual Machine (VM) execution for OPNet, enhancing the Bitcoin Layer 1 with smart contract capabilities. This milestone will also include the integration of WBTC (Wrapped Bitcoin) swapping functionalities and p2p trading.

Objectives

  1. PoA Consensus Implementation

    • Develop and integrate a robust PoA consensus mechanism.
    • Establish a set of validators authorized to validate transactions.
    • Implement a reward system for validators.
    • Ensure secure and efficient validation processes.
  2. VM Execution

    • Develop a Virtual Machine (VM) for executing smart contracts.
    • Ensure deterministic execution of contracts to prevent variances in contract outcomes.
    • Implement isolation mechanisms using isolated-vm to sandbox contract execution.
    • Introduce a timeout mechanism based on CPU cycles to prevent DoS attacks and infinite loops.
  3. WBTC Swapping Integration (PSBT) / P2P trading style (PSBT)

    • P2P trading style
    • Implement functionalities for swapping BTC to WBTC and vice versa.
    • Ensure 1:1 value correspondence between BTC and WBTC.
    • Integrate smart contract mechanisms for secure and transparent swaps.

Detailed Tasks

PoA Consensus Implementation

  1. Validator Selection and Management

    • Define criteria for selecting validators.
    • Develop smart contracts for validator registration and management.
    • Implement a mechanism to regularly update the list of active validators.
  2. Transaction Validation

    • Develop algorithms for transaction validation.
    • Ensure transactions are validated efficiently and securely.
    • Implement consensus rules and ensure compliance among validators.
  3. Reward System

    • Develop a reward system to incentivize validators.
    • Implement smart contracts for distributing rewards.
    • Ensure transparency and fairness in reward distribution.

VM Execution

  1. VM Development

    • Design and develop a VM capable of executing WebAssembly (Wasm) based contracts.
    • Ensure compatibility with OP20 and other relevant standards.
    • Implement a deterministic execution environment.
  2. Isolation and Security

    • Use isolated-vm to create isolated execution contexts for each contract.
    • Implement security measures to prevent cross-contract interference.
    • Ensure robust handling of external calls and state changes.
  3. Timeout Mechanism

    • Develop a timeout mechanism based on CPU cycles to limit execution time.
    • Implement monitoring and enforcement of execution limits.
    • Ensure graceful termination of contracts exceeding execution limits.

WBTC Swapping Integration (PSBT) / P2P trading style (PSBT)

  1. Swap Mechanism Development

    • Develop smart contracts for BTC to WBTC swaps and vice versa.
    • Ensure atomic swaps to guarantee 1:1 value correspondence.
    • Implement mechanisms to handle edge cases and failures securely.
  2. Testing and Security

    • Conduct thorough testing of the swap mechanism under various scenarios.
    • Implement security audits to identify and mitigate vulnerabilities.
    • Ensure compliance with industry standards and best practices.

Deliverables

  • Fully implemented PoA consensus mechanism.
  • Operational VM for executing Wasm-based smart contracts. (rust)
  • Integrated WBTC swapping functionalities.
  • Documentation detailing the implementation, usage, and maintenance.
  • Comprehensive test cases and results.
  • Security audit reports. (last)

Risks and Mitigations

  • Security Risks: Conduct regular audits and testing to ensure robust security.
  • Execution Variance: Ensure deterministic execution through thorough testing and validation.
  • Validator Misbehavior: Implement strict rules and penalties for validator misbehavior.

There are no open issues in this milestone.

Add issues to milestones to help organize your work for a particular release or project.

Create new issue

Or find and add issues with no milestone in this repo.