OviSync Custom Chain

OviSync Custom Chain

 

  1. Deploy zkSync nodes and Ethereum endpoints on Netrabricks (Ubuntu on AMD processors).

  2. Provide a DAppNode package to allow anyone to run an OVchain node.

  3. Periodically reward node operators with OpenVinoDAO tokens


Step-by-Step Instructions

1. Prerequisites

  • Hardware Requirements:

    • Netrabricks with Ubuntu installed.

    • Minimum 16GB RAM, 4 cores, 500GB SSD for zkSync nodes.

    • Ethereum node requirements depend on whether you're running:

      • Full Node (512GB–1TB SSD recommended).

      • Light Node (100GB SSD sufficient).

  • Software Requirements:

    • DAppNode installed on each Netrabrick.

    • Docker and Docker Compose pre-installed (DAppNode manages this automatically).

    • Access to zkSync Era source code.

  • Crypto Wallet:

    • A wallet capable of interacting with Ethereum (e.g., Metamask or hardware wallets).


2. Deploy zkSync Nodes

  1. Clone zkSync Repository:

    git clone <https://github.com/matter-labs/zksync-era.git> cd zksync-era
  2. Configure Docker for zkSync:

    • Create a .env file in the repository root:

      cp .env.example .env nano .env
    • Update the file with these values:

      • ETH_RPC_URL: RPC endpoint of the Ethereum node running on DAppNode.

      • DB_URL: Postgres database URL (e.g., postgresql://user:password@localhost/zksync).

  3. Set Up Postgres Database:
    Install and configure Postgres:

    sudo apt update sudo apt install postgresql sudo -u postgres createuser --interactive sudo -u postgres createdb zksync
  4. Start zkSync Services:
    Run the services using Docker Compose:

    docker-compose up -d
  5. Test zkSync Deployment:

    • Use the zkSync web interface to ensure nodes are syncing.


4. Implement Merkle Root Commitment

  1. Aggregate Sensor Data on zkSync:

    • Write sensor data to zkSync nodes using a Python script (e.g., oviwox.py):

      import hashlib from zksync_sdk import ZkSyncProvider, Wallet provider = ZkSyncProvider("<http://localhost:3050>") wallet = Wallet("YOUR_PRIVATE_KEY", provider) sensor_data = "temperature=20.5" tx = wallet.send_transaction({ "to": "0x0000000000000000000000000000000000000000", "data": hashlib.sha256(sensor_data.encode()).hexdigest() }) print(f"Transaction sent: {tx['hash']}")
  2. Generate and Submit Merkle Roots:

    • Use a daily cron job to:

      • Fetch data from zkSync nodes.

      • Compute the Merkle root.

      • Submit the root to Ethereum using a simple Solidity contract (see previous instructions).

  3. Deploy Smart Contract for Merkle Root:
    Deploy a contract to record Merkle roots on Ethereum (see Step 3 in the previous instructions).


5. Package OVchain as a DAppNode Module

  1. Create a DAppNode Package:

  2. Define Package Contents:

    • zkSync Docker Compose setup.

    • Configuration for Ethereum endpoints (automatically detected by DAppNode).

    • Postgres configuration for local data storage.

  3. Package Configuration:
    Create a docker-compose.yml file:

    version: '3' services: zksync: image: "zksync/zksync-node:latest" restart: always environment: - ETH_RPC_URL=<http://geth.dappnode> - DB_URL=postgresql://user:password@localhost/zksync ports: - "3050:3050"

    Add metadata (e.g., package.json) to describe the package for DAppNode.

  4. Publish Package:

    • Publish the package to the DAppNode store so others can install it.


6. Reward OVchain Node Operators

  1. Design the Reward Mechanism:

    • Create a smart contract to distribute OpenVinoDAO tokens periodically:

      contract OVchainRewards { address public owner; IERC20 public openVinoToken; mapping(address => uint256) public rewards; constructor(address _token) { owner = msg.sender; openVinoToken = IERC20(_token); } function distributeRewards(address[] memory nodes, uint256[] memory amounts) public { require(msg.sender == owner, "Only owner can distribute"); for (uint256 i = 0; i < nodes.length; i++) { openVinoToken.transfer(nodes[i], amounts[i]); } } }
  2. Track Active Nodes:

    • Use zkSync logs or a registry to monitor active node operators.

    • Periodically calculate token rewards based on uptime or data processed.

  3. Automate Token Distribution:

    • Develop a backend script to trigger token distribution periodically (e.g., weekly).

    • Integrate it with the reward contract.


7. Testing and Deployment

  1. Test Entire Workflow:

    • Write and retrieve sensor data.

    • Generate and verify Merkle proofs.

    • Reward node operators.

  2. Deploy on Mainnet:

    • Ensure all components (Ethereum, zkSync, and DAppNode package) are production-ready.

    • Publish the DAppNode package for public installation.


Outcome

  1. Anyone can set up an OVchain node using the DAppNode package.

  2. Nodes participate in zkSync operations and Ethereum Merkle root commitments.

  3. Node operators are incentivized with OpenVinoDAO tokens, fostering a decentralized ecosystem for wineries.