OviSync Custom Chain
Deploy zkSync nodes and Ethereum endpoints on Netrabricks (Ubuntu on AMD processors).
Provide a DAppNode package to allow anyone to run an OVchain node.
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
Clone zkSync Repository:
git clone <https://github.com/matter-labs/zksync-era.git> cd zksync-era
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
).
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
Start zkSync Services:
Run the services using Docker Compose:docker-compose up -d
Test zkSync Deployment:
Use the zkSync web interface to ensure nodes are syncing.
4. Implement Merkle Root Commitment
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']}")
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).
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
Create a DAppNode Package:
Follow the DAppNode package guide to create a custom package.
Define Package Contents:
zkSync Docker Compose setup.
Configuration for Ethereum endpoints (automatically detected by DAppNode).
Postgres configuration for local data storage.
Package Configuration:
Create adocker-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.Publish Package:
Publish the package to the DAppNode store so others can install it.
6. Reward OVchain Node Operators
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]); } } }
Track Active Nodes:
Use zkSync logs or a registry to monitor active node operators.
Periodically calculate token rewards based on uptime or data processed.
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
Test Entire Workflow:
Write and retrieve sensor data.
Generate and verify Merkle proofs.
Reward node operators.
Deploy on Mainnet:
Ensure all components (Ethereum, zkSync, and DAppNode package) are production-ready.
Publish the DAppNode package for public installation.
Outcome
Anyone can set up an OVchain node using the DAppNode package.
Nodes participate in zkSync operations and Ethereum Merkle root commitments.
Node operators are incentivized with OpenVinoDAO tokens, fostering a decentralized ecosystem for wineries.