ZORAI Public Chain Technical Documentation v1.0
Code baseline: current /home/zhangxg/zoraiv5 workspace
Last updated: 2026-05-22
Audience: node operators, DApp developers, RWA issuers, legal/notary evidence providers, AI/GPU providers, bridge integrators, explorer and indexer developers
Legal notice: ZORAI Evidence/Notary Layer is designed for judicial evidence-preservation workflows, but final legal effect depends on recognition by the competent local judicial authority.
Table of Contents
- ZORAI Public Chain Overview
- System Architecture
- Core Protocol Features
- EVM Compatibility and Smart Contracts
- RWA Support
- Legal / Notary Evidence System
- AI / GPU Compute Market
- Cross-chain Functionality
- Stablecoins: ZUSD / zUSDT
- RPC Reference
- Developer Guide
- Technical Parameters and Configuration
- Deployment and Operations
- Roadmap and Current Status
1. ZORAI Public Chain Overview
ZORAI is an EVM-compatible Layer 1 public chain designed for high-frequency applications, compliant RWA issuance, AI/GPU compute markets, and cross-chain asset movement. The current repository includes a full node, BFT + PoS consensus, EVM execution, MPT state, LevelDB persistence, JSON-RPC/WebSocket APIs, Explorer/Indexer, RWA RPC, Compute RPC, Bridge/Wrapped Asset modules, and production monitoring scripts.
Key implementation references:
| Module | Code path | Notes |
|---|---|---|
| Node binary | cmd/xihud/main.go:2208 | Block production, BFT proposal, execution, finality broadcast |
| BFT consensus | pkg/consensus/bft.go:366 | BFTManager, QC, vote history, liveness recovery |
| PoS validators | pkg/consensus/pos_complete.go:37 | Validator metadata, stake, proposer selection |
| EVM execution | pkg/evm/evm.go:40 | go-ethereum EVM, London rules, precompiles |
| State layer | pkg/state/mpt_state.go:43 | MPT state manager, account state, proofs |
| Chain store | pkg/blockchain/store.go:34 | LevelDB + WAL, block and transaction indexes |
| Network | pkg/network/network.go:107 | libp2p, gossip, rate limits, DHT, sync |
| RPC | pkg/rpc/web3_full.go:598 | Ethereum JSON-RPC and ZORAI extension methods |
| WebSocket | pkg/websocket/websocket.go:22 | newHeads, pending transactions, logs, syncing |
| Explorer/Indexer | cmd/explorer/main.go:235 | Blocks, transactions, accounts, validators, tokens, docs |
Positioning
ZORAI focuses on four main goals:
- EVM-compatible application chain: chain ID
70707, hex0x11433, defined inpkg/types/chain.go:3. - Sub-second block target: default block time is
400ms, configured inconfigs/config.toml:21. - BFT finality: proposals, votes, quorum certificates and finalized block broadcast are implemented in
pkg/consensus/bft.go:70,pkg/consensus/bft.go:76, andcmd/xihud/main.go:5454. - Native business modules: RWA, compute market and bridge modules are implemented under
pkg/rwa,pkg/taskmarket,pkg/computerelay,pkg/crosschain,pkg/bridge, andpkg/evm/bridge_executor.go.
Current Maturity
The codebase is a production-candidate chain implementation. The critical production gate is long-running public-network evidence, especially BFT liveness on the current 7 validator + 1 RPC topology. Recent liveness fixes include pending block recovery, voteHistory cleanup, finalized watermark synchronization, round_timeout critical-message bypass and a 90-second watchdog. Relevant code paths include pkg/consensus/bft.go:650, pkg/consensus/bft.go:839, pkg/consensus/bft.go:2372, pkg/network/network.go:1865, and scripts/stability-test/zorai_liveness_watchdog.py:231.
| Area | Current assessment | Notes |
|---|---|---|
| EVM compatibility | 8.5/10 | London EVM and EIP-1559 are implemented |
| Consensus safety | 8.0/10 | QC, BLS aggregation and 2/3 stake checks exist |
| Consensus liveness | 8.0 to 8.5/10 | Candidate after recent fixes, pending 720h evidence |
| RPC/developer experience | 8.0/10 | Ethereum RPC plus ZORAI extension APIs |
| RWA/Compute/Bridge | 7.5 to 8.5/10 | Broad modules exist, but need audit and integration evidence |
| Operations | 8.0/10 | 8-node scripts, 720h monitor, watchdog and control plane foundations exist |
Comparison With Ethereum, Solana, Monad and Avalanche
| Dimension | ZORAI | Ethereum | Solana | Monad | Avalanche |
|---|---|---|---|---|---|
| Execution | London EVM | EVM | SVM | EVM | EVM/Subnet |
| Consensus direction | PoS + BFT QC | PoS finality | PoH + Tower BFT | high-performance EVM | Avalanche consensus |
| Block target | 400ms default | around 12s | sub-second slot | low-latency target | seconds-level |
| State | MPT + LevelDB | MPT, Verkle roadmap | AccountsDB | parallel state direction | LevelDB/RocksDB-style |
| Differentiator | RWA + Compute + Bridge modules | largest ecosystem | high-throughput non-EVM native | high-performance EVM | mature multi-chain model |
| Current stage | production candidate | production mature | production mature | emerging | production mature |
2. System Architecture
Text Architecture Diagram
Wallets / DApps / Operators / Explorer users
|
| JSON-RPC / WebSocket / Explorer UI
v
RPC layer: pkg/rpc + pkg/websocket
|
| sendRawTransaction / eth_call / logs / compute / rwa / bridge
v
Mempool: pkg/mempool ---> Block production: cmd/xihud
| |
| | BFT Proposal / Vote / QC
v v
Execution: pkg/evm <----> Consensus: pkg/consensus
|
| StateDB / receipts / logs
v
State: pkg/state MPT + Storage: pkg/blockchain LevelDB/WAL
|
v
P2P network: pkg/network libp2p / DHT / Gossip / Sync
|
v
Explorer / Indexer: cmd/explorer
Consensus Layer: BFT + PoS
Validator metadata includes address, P2P multiaddr, RPC URL, stake and BLS public key, defined in pkg/consensus/pos_complete.go:37. Proposer selection uses active validators, stake weights, epoch height, round and previous hash, implemented in pkg/consensus/pos_complete.go:144.
BFTManager maintains pending blocks, votes, vote history, fork and equivocation records, round locks, highQC, currentQC and finalized watermark. See pkg/consensus/bft.go:366. A quorum certificate contains block hash, height, round, aggregate signature, signers, total stake and validator-set hash. See pkg/consensus/bft.go:76. QC validity requires at least 2/3 total stake, implemented in pkg/consensus/bft.go:103.
Execution Layer: EVM
The EVM executor wraps go-ethereum StateDB, trie DB, ChainConfig, receipts and the ZORAI state manager. See pkg/evm/evm.go:40. ZORAI activates Homestead, EIP150, EIP155, Byzantium, Constantinople, Petersburg, Istanbul, Berlin and London from block 0 in pkg/evm/evm.go:78.
State Storage: MPT + LevelDB
MPTStateManager holds LevelDB, account state, trie, state root, dirty accounts and state-root history. See pkg/state/mpt_state.go:43. Commits rebuild a canonical trie from sorted accounts and persist state_root, implemented in pkg/state/mpt_state.go:477.
The chain store is backed by LevelDB plus WAL and keeps block, transaction and receipt indexes. See pkg/blockchain/store.go:34. Trusted block writes use WAL plus LevelDB batch operations in pkg/blockchain/store.go:337.
P2P Network
The network layer uses libp2p with protocol ID /zorai/1.0.0, defined in pkg/network/network.go:34. It supports Kademlia DHT, routing discovery, peer scoring, CRDT peer exchange, snapshot sync, incremental sync, message dedupe, rate limiting and critical-message bypass. The core network structure is in pkg/network/network.go:107.
Consensus message types include block_proposal, vote, round_timeout, finalized_block, validator join/leave/vote. See pkg/network/network.go:63. round_timeout bypasses peer rate limits because it is critical for BFT liveness. See pkg/network/network.go:1865.
RPC Layer
RPC dispatch is centralized in pkg/rpc/web3_full.go:598. It supports Ethereum JSON-RPC, ZORAI extension methods, validator RPC, bridge RPC, RWA RPC and compute RPC. WebSocket subscriptions support newHeads, newPendingTransactions, logs and syncing, defined in pkg/websocket/websocket.go:22.
Explorer and Indexer
Explorer routes are registered in cmd/explorer/main.go:235. Token indexer persistence uses LevelDB and supports token metadata, holders and transfer history. ERC1155 event hashes and indexer state are in cmd/explorer/token_indexer.go:23 and cmd/explorer/token_indexer.go:64.
3. Core Protocol Features
Account Model and State Management
ZORAI uses the EVM account model. Accounts track balance, nonce, code hash and storage root. Balance, nonce, storage, code, proof and state-root operations are implemented across pkg/state/mpt_state.go:216 to pkg/state/mpt_state.go:535.
Get balance:
curl -s https://rpc.zorai.co \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc":"2.0",
"id":1,
"method":"eth_getBalance",
"params":["0xYourAddressHere","latest"]
}'
Get nonce:
curl -s https://rpc.zorai.co \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc":"2.0",
"id":1,
"method":"eth_getTransactionCount",
"params":["0xYourAddressHere","latest"]
}'
Transaction Structure and Signatures
Transaction types are defined in pkg/types/transaction.go:17:
| Type | Value | Notes |
|---|---|---|
| Legacy | 0x00 | Traditional Ethereum transaction |
| AccessList | 0x01 | EIP-2930 access-list transaction |
| DynamicFee | 0x02 | EIP-1559 dynamic-fee transaction |
The transaction structure includes from, to, value, gasLimit, gasPrice, maxFeePerGas, maxPriorityFeePerGas, nonce, data, signature and chainID fields. See pkg/types/transaction.go:26. Signing uses go-ethereum LatestSignerForChainID, implemented in pkg/types/transaction.go:62. Verification checks chain ID, signature, gas limit and EIP-1559 fields in pkg/types/transaction.go:169.
Send a raw transaction:
curl -s https://rpc.zorai.co \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc":"2.0",
"id":1,
"method":"eth_sendRawTransaction",
"params":["0xRAW_SIGNED_TRANSACTION"]
}'
ethers.js EIP-1559 transfer:
import { ethers } from "ethers";
const provider = new ethers.JsonRpcProvider("https://rpc.zorai.co", {
chainId: 70707,
name: "zorai"
});
const wallet = new ethers.Wallet(process.env.PRIVATE_KEY!, provider);
const tx = await wallet.sendTransaction({
to: "0xReceiverAddress",
value: ethers.parseEther("1"),
type: 2,
maxFeePerGas: ethers.parseUnits("2", "gwei"),
maxPriorityFeePerGas: ethers.parseUnits("1", "gwei"),
gasLimit: 21000
});
console.log(tx.hash);
Gas Mechanism: EIP-1559
Default gas configuration is in pkg/evm/evm.go:791:
| Parameter | Default | Code path |
|---|---|---|
| EIP-1559 | enabled | pkg/evm/evm.go:792 |
| Initial base fee | 1 gwei | pkg/evm/evm.go:793 |
| Min gas price | 1 gwei | pkg/evm/evm.go:794 |
| Max gas price | 1000 gwei | pkg/evm/evm.go:795 |
| Max priority fee | 1 gwei | pkg/evm/evm.go:796 |
| Block gas limit | 30,000,000 | pkg/evm/evm.go:797 |
| Base fee denominator | 8 | pkg/evm/evm.go:798 |
| Target gas ratio | 50% | pkg/evm/evm.go:799 |
Base fee adjustment is implemented in pkg/evm/evm.go:495. RPC supports eth_gasPrice, eth_maxPriorityFeePerGas and eth_feeHistory.
Mempool and Block Packing
TxPool tracks pending and queued transactions, account indexes, transaction size limit, minimum gas price, replacement bump, chain ID and base fee. See pkg/mempool/mempool.go:91. Defaults include 3-hour expiration, 1 gwei min gas price, 128KB max transaction size and 10% replacement bump, defined in pkg/mempool/mempool.go:110.
Transaction validation checks signature, nonce, balance, gas, size and chain ID. See pkg/mempool/mempool.go:409. Block production filters nonce, fee cap, balance and gas limit before proposal. See cmd/xihud/main.go:2208.
Block Production and Finality
Block headers contain height, previous hash, state root, transaction hash, receipt hash, gas used, gas limit, base fee, chain ID, proposer and signature. See pkg/types/block.go:21. NewBlock sets default chain ID and base fee in pkg/types/block.go:52.
Finalization flow:
- PoS selects proposer, see
pkg/consensus/pos_complete.go:144. - Proposer packages and pre-executes transactions, see
cmd/xihud/main.go:2208. - Proposer creates a BFT proposal, see
pkg/consensus/bft.go:1120. - Validators validate proposer, chain ID, validator set, parent hash, round, signature and local vote history, see
pkg/consensus/bft.go:1219. - Validators create votes, see
pkg/consensus/bft.go:1430. - A QC forms after 2/3 stake and the finalized block is broadcast, see
cmd/xihud/main.go:5454.
BFT Liveness Protection
Recent liveness protections:
| Mechanism | Code path | Purpose |
|---|---|---|
| Pending timeout recovery | pkg/consensus/bft.go:650 | Clear stale pending and allow re-proposal |
| Height recovery cleanup | pkg/consensus/bft.go:839 | Clear pending, forks, round locks and vote history |
| Higher-round vote rules | pkg/consensus/bft.go:788 | Same-round double vote rejected, higher-round progress allowed by rules |
| Finalized watermark advance | pkg/consensus/bft.go:2098 | Align BFT finalized height with canonical chain head |
| State loading | pkg/consensus/bft.go:2372 | Avoid restoring stale vote history that can deadlock |
| Round timeout protection | pkg/network/network.go:1543 | Deduplicate and protect consensus channels from timeout storms |
Events and WebSocket Subscriptions
Receipts and logs are defined in pkg/receipt/receipt.go:18 and pkg/receipt/receipt.go:33. Log filtering is implemented in pkg/receipt/receipt.go:257. eth_getLogs is handled in pkg/rpc/web3_full.go:1920.
WebSocket subscription types:
| Type | Code path | Notes |
|---|---|---|
newHeads | pkg/websocket/websocket.go:22 | New block headers |
newPendingTransactions | pkg/websocket/websocket.go:23 | Pending transaction hashes |
logs | pkg/websocket/websocket.go:24 | Contract events |
syncing | pkg/websocket/websocket.go:25 | Sync state |
4. EVM Compatibility and Smart Contracts
Supported EVM Version
ZORAI currently exposes a London-compatible EVM configuration. The code activates major forks up to London from block 0 in pkg/evm/evm.go:78. Shanghai/Cancun configuration is not present in the current code, so public documentation should describe the chain as London EVM compatible.
Precompiles
ZORAI inherits go-ethereum Berlin/Istanbul precompiles and registers custom ERC-3643 precompiles in pkg/evm/evm.go:158. ERC-3643 precompile addresses are defined in pkg/evm/erc3643_precompiled.go:17:
| Address | Function |
|---|---|
0x0000000000000000000000000000000000000200 | ERC3643 transfer |
0x0000000000000000000000000000000000000201 | ERC3643 mint |
0x0000000000000000000000000000000000000202 | ERC3643 burn |
0x0000000000000000000000000000000000000203 | ERC3643 balance |
0x0000000000000000000000000000000000000204 | ERC3643 whitelist |
0x0000000000000000000000000000000000000205 | ERC3643 freeze |
ERC Standard Support
| Standard | Status | Notes |
|---|---|---|
| ERC20 | supported | Official template at contracts/zorai-token-templates/ZORAIERC20.sol:9 |
| ERC721 | deployable on EVM | Use OpenZeppelin standard contracts; no official template found in repo |
| ERC1155 | deployable and partially indexed | Event hashes exist in cmd/explorer/token_indexer.go:23 |
| ERC3643 | first-class support | Solidity template, EVM precompile and RWA RPC support |
| Stablecoin | supported template | ZORAIStablecoinV2 supports mint, burn, pause, blacklist, freeze, roles and multisig |
Hardhat Configuration
Hardhat includes a ZORAI network in contracts/hardhat/hardhat.config.ts:23:
zorai: {
url: process.env.ZORAI_RPC_URL || "http://127.0.0.1:18080/rpc",
chainId: 70707,
accounts: process.env.PRIVATE_KEY ? [process.env.PRIVATE_KEY] : [],
}
Deploy:
cd /home/zhangxg/zoraiv5/contracts/hardhat
npm install
export ZORAI_RPC_URL=https://rpc.zorai.co
export PRIVATE_KEY=0xYOUR_PRIVATE_KEY
npx hardhat compile
npx hardhat run scripts/deploy_zusd.ts --network zorai
5. RWA Support
ZORAI's RWA module covers issuer onboarding, asset registration, valuation, documents, KYC, compliance rules, governance proposals, distributions, redemptions, disclosures, regulatory reports and price oracle updates. Asset types and records are defined in pkg/rwa/types.go:37, KYC records in pkg/rwa/types.go:137, and redemption requests in pkg/rwa/types.go:218.
ERC-3643 Implementation
The official RWA Solidity template is contracts/zorai-token-templates/ZORAIRWAToken.sol:260. It includes:
| Component | Code path | Purpose |
|---|---|---|
| ClaimTopics | contracts/zorai-token-templates/ZORAIRWAToken.sol:20 | Required claim topics |
| TrustedIssuers | contracts/zorai-token-templates/ZORAIRWAToken.sol:59 | Trusted claim issuers |
| IdentityRegistry | contracts/zorai-token-templates/ZORAIRWAToken.sol:111 | Address identity and country |
| Compliance | contracts/zorai-token-templates/ZORAIRWAToken.sol:172 | Freeze, blacklist, country and daily-limit checks |
| RWA Token | contracts/zorai-token-templates/ZORAIRWAToken.sol:260 | ERC20 plus KYC/compliance controls |
Compliance, KYC and Access Control
RWA RPC dispatch is implemented in pkg/rpc/rwa_rpc.go:24. Key compliance methods include:
| Method | Purpose |
|---|---|
rwa_setKYCRecord | Set investor KYC record |
rwa_getKYCRecord | Read KYC record |
rwa_isVerified | Check verification status |
rwa_freezeAddress / rwa_unfreezeAddress | Freeze or unfreeze address |
rwa_setComplianceRules | Set asset compliance rules |
rwa_setSanction | Set sanction status |
rwa_registerTradingVenue | Register trading venue |
rwa_setTransferRestriction | Set transfer restriction |
Set KYC example:
curl -s https://rpc.zorai.co \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc":"2.0",
"id":1,
"method":"rwa_setKYCRecord",
"params":[{
"address":"0xInvestorAddress",
"verified":true,
"level":"enhanced",
"investor_type":"professional",
"jurisdiction":"HK",
"tax_residency":"HK",
"sanctions_clear":true,
"accredited":true,
"kyc_hash":"ipfs://bafy.../kyc-proof.json",
"expires":1798761600
}]
}'
RWA Issuance Flow
- Register issuer with
rwa_registerIssuer. - Register asset with
rwa_registerAsset. - Submit legal, audit, valuation and custody documents with
rwa_submitDocument. - Start asset verification with
rwa_startVerification. - Add ownership proof, legal review, audit and regulatory check.
- Complete and approve verification.
- Configure KYC and compliance rules.
- Create issuance proposal.
- Vote and activate the token.
- Operate transfers, distributions, redemptions and disclosures.
Deploy RWA contracts:
cd /home/zhangxg/zoraiv5/contracts/hardhat
export ZORAI_RPC_URL=https://rpc.zorai.co
export PRIVATE_KEY=0xISSUER_PRIVATE_KEY
npx hardhat run scripts/deploy_rwa.ts --network zorai
6. Legal / Notary Evidence System
ZORAI Evidence/Notary Layer provides a general-purpose evidence registry for legal, notary, audit, enterprise contract and judicial evidence-preservation workflows. The design rule is strict: only hashes, roles, timestamps, transaction proofs and event proofs are stored on-chain; raw files must remain in encrypted off-chain preservation systems.
| Capability | Implementation | Notes |
|---|---|---|
| Evidence registry contract | contracts/zorai-token-templates/ZORAINotaryRegistry.sol | registerEvidence, appendEvidence, revokeEvidence, batchRegister, Merkle leaf verification |
| Legal roles | ZORAINotaryRegistry.sol / pkg/rwa/evidence.go | NOTARY_ROLE, LAW_FIRM_ROLE, COURT_ROLE, ENTERPRISE_ROLE, AUDITOR_ROLE, OPERATOR_ROLE |
| Multisig and timelock | ZORAINotaryRegistry.sol | append, revoke and batch registration require approveOperation plus 24h timelock |
| RWA Evidence RPC | pkg/rpc/rwa_rpc.go | rwa_registerLegalIdentity, rwa_registerEvidence, rwa_verifyEvidence, rwa_getEvidenceReport |
| Persistence | pkg/rwa/state_snapshot.go | legal identities, address indexes and evidence records are persisted in the RWA snapshot |
| Explorer verification portal | cmd/explorer/evidence.go | /evidence, /evidence/verify, /api/evidence/verify, PDF/JSON report export |
| Off-chain preservation | pkg/rwa/evidence.go | IPFS CID, Arweave ID, S3/Object Lock URI, encryption algorithm and access-log hash |
6.1 Evidence Registry
The ZORAINotaryRegistry contract is based on OpenZeppelin AccessControlEnumerable, Pausable and MerkleProof. A normal evidence registration flow is:
- Compute SHA-256 or Keccak-256 over the original file.
- Canonicalize metadata JSON and compute
metadataHash. - A legal-role account calls
registerEvidence(contentHash, metadataHash, caseHash, subjectHash, previousEvidenceId, evidenceType, uri). - The contract emits
EvidenceRegistered, bindingevidenceId,contentHash, submitter, case hash, subject hash and URI. - Explorer or API reads the transaction receipt, block hash and event log to generate a legal verification report.
High-risk operations:
| Operation | Control |
|---|---|
appendEvidence | At least 2 multisig signer approvals plus 24h timelock |
revokeEvidence | At least 2 multisig signer approvals plus 24h timelock |
batchRegister | At least 2 multisig signer approvals plus 24h timelock |
pause/unpause | OPERATOR_ROLE, recommended to be controlled by multisig in production |
6.2 Legal Identity and Roles
LegalIdentity extends the RWA identity system with legally meaningful actors:
{
"subject_id": "notary-hk-001",
"address": "0x...",
"legal_name": "Example Notary Office",
"jurisdiction": "HK",
"registration_id": "NOTARY-001",
"roles": ["notary"],
"oidc_subject": "oidc|notary-hk-001",
"webauthn_user_id": "base64url-user-id",
"rbac_groups": ["notary-admins"]
}
In production, the Operations Console should authenticate operators through OIDC/WebAuthn/RBAC and submit write requests through the Control Plane approval flow. Nodes, Explorer and the console must not store private keys.
6.3 Verification Portal and Reports
Explorer routes:
| Route | Purpose |
|---|---|
/evidence | Evidence verification page |
/evidence/verify | Same verification page |
/api/evidence/verify?tx=0x...&hash=0x... | Parse EvidenceRegistered from receipt and compare file hash |
/api/evidence/report.json?tx=0x...&hash=0x... | Export JSON report |
/api/evidence/report.pdf?tx=0x...&hash=0x... | Export PDF report |
The browser computes SHA-256 locally with WebCrypto. Raw files are not uploaded. Reports include file hash, evidence ID, transaction hash, block height, block hash, block timestamp, submitter, contract address, receipt status, event log and legal notice.
6.4 Evidence RPC
Register evidence:
{
"jsonrpc": "2.0",
"id": 1,
"method": "rwa_registerEvidence",
"params": {
"content_hash": "0x...",
"metadata_hash": "0x...",
"case_hash": "0x...",
"subject_hash": "0x...",
"uri": "ipfs://bafy...",
"evidence_type": "contract",
"submitter": "0x...",
"offchain_storage": {
"ipfs_cid": "bafy...",
"object_lock_uri": "s3://zorai-evidence/legal/001",
"encrypted": true,
"encryption_alg": "AES-256-GCM",
"access_log_hash": "0x..."
}
}
}
Verify:
{
"jsonrpc": "2.0",
"id": 2,
"method": "rwa_verifyEvidence",
"params": {
"evidence_id": "abc...",
"content_hash": "0x..."
}
}
Export report:
{
"jsonrpc": "2.0",
"id": 3,
"method": "rwa_getEvidenceReport",
"params": {
"evidence_id": "abc...",
"chain_id": 70707,
"contract_address": "0x...",
"regulatory_export": true
}
}
6.5 Deployment and Tests
cd /home/zhangxg/zoraiv5
export ZORAI_RPC_URL=http://127.0.0.1:8545
export ZORAI_CHAIN_ID=70707
export PRIVATE_KEY=0x...
scripts/rwa/deploy_notary_registry.sh
cd contracts/hardhat
npm test -- --grep "ZORAINotaryRegistry|ZORAIRWAToken"
cd /home/zhangxg/zoraiv5
go test ./pkg/rwa ./pkg/rpc -run 'TestRWAEvidenceRPCRegisterVerifyReport|TestRWAEnterpriseRPCOnboardingAndPersistence' -count=1
go test -tags explorer ./cmd/explorer -run TestDoesNotExist -count=1
Legal notice: ZORAI Evidence/Notary Layer is designed for judicial evidence-preservation scenarios, but final legal effect depends on recognition by the competent local judicial authority.
7. AI / GPU Compute Market
ZORAI Compute Market coordinates task publishing, provider assignment, result submission, proof verification, escrow settlement and disputes.
Architecture
Requester
|
| zor_publishTask / HTTP relay
v
TaskMarket: pkg/taskmarket
|
| task assigned / websocket
v
Compute Relay: pkg/computerelay
|
| provider register / heartbeat / result
v
GPU Agent / Provider
|
| proof + result CID + signature
v
TaskMarket settlement / dispute / reward
Task fields are defined in pkg/taskmarket/types.go:52. Provider endpoint and GPU metadata are defined in pkg/taskmarket/types.go:123 and pkg/taskmarket/types.go:163.
TaskMarket
TaskMarket stores tasks, nodes, events, disputes, escrow records, attestations, ledger and persistent store. See pkg/taskmarket/market.go:17. Default market settings are in pkg/taskmarket/market.go:57.
| Operation | Code path | Purpose |
|---|---|---|
| PublishTask | pkg/taskmarket/market.go:158 | Lock budget and create task |
| AcceptTask | pkg/taskmarket/market.go:235 | Provider accepts task |
| SubmitProof | pkg/taskmarket/market.go:328 | Submit result and compute proof |
| SettleTask | pkg/taskmarket/market.go:387 | Settle after challenge window |
| Dispute | pkg/taskmarket/market.go:423 | Open dispute and possible slashing |
| RegisterNode | pkg/taskmarket/market.go:520 | Register provider |
Compute Relay
Relay HTTP routes are in pkg/computerelay/relay.go:264:
| Path | Method | Purpose |
|---|---|---|
/health | GET | Health check |
/v1/provider/connect | WebSocket | Provider connection |
/v1/providers | GET | Provider list |
/v1/tasks | POST/GET | Create or list tasks |
/v1/tasks/{task_id} | GET | Task details |
/v1/tasks/{task_id}/dispute | POST | Open dispute |
/v1/chat/completions | POST | OpenAI-style compute entry |
Mutation signing domain is ZORAI_COMPUTE_RPC_V1, verified in pkg/rpc/compute_rpc.go:115.
Register GPU provider:
curl -s https://rpc.zorai.co \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc":"2.0",
"id":1,
"method":"zor_registerNode",
"params":[{
"node_id":"gpu-provider-001",
"owner":"0xProviderAddress",
"endpoint":"wss://provider.example.com/v1/provider/connect",
"gpus":[{"type":"A100","vram_gb":80,"count":4}],
"stake":"100000000000000000",
"nonce":1,
"timestamp":1778112000,
"signature":"0xProviderSignature"
}]
}'
Publish task:
curl -s https://rpc.zorai.co \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc":"2.0",
"id":2,
"method":"zor_publishTask",
"params":[{
"requester":"0xRequesterAddress",
"task_type":"inference",
"model_cid":"ipfs://bafy.../llm-model",
"input_cid":"ipfs://bafy.../prompt.json",
"config":{"gpu_type":"A100","min_vram_gb":40,"max_duration_sec":600},
"budget":"1000000000000000000",
"deposit":"100000000000000000",
"deadline":1778115600,
"nonce":2,
"timestamp":1778112000,
"signature":"0xRequesterSignature"
}]
}'
8. Cross-chain Functionality
ZORAI bridge functionality has two complementary layers:
pkg/crosschain: cross-chain messages, proofs, chain state, finality binding, digest and replay protection.pkg/bridgepluspkg/evm/bridge_executor.go: bridge execution, relayers, wrapped asset mint/burn/unlock, outbound receipts.
Ethereum and Solana Bridge Design
Cross-chain messages are defined in pkg/crosschain/types.go:28. Proof fields support Ethereum transaction/receipt MPT proofs, finalized checkpoints, Solana slots, program IDs and guardian signatures. See pkg/crosschain/types.go:49.
BridgeManager registers Ethereum and Solana verifiers in pkg/crosschain/manager.go:172. Message verification is implemented in pkg/crosschain/manager.go:261. Digest binding includes source chain ID, tx hash, nonce, target chain ID, target contract, token, amount, receiver and payload. See pkg/crosschain/manager.go:554.
Wrapped Asset Mechanism
Wrapped asset execution is implemented in pkg/evm/bridge_executor.go:35. Mint validates the message, checks replay state, updates balance and total supply, emits a Transfer log and marks the message processed. Wrapped asset metadata is defined in pkg/evm/wrapped_registry.go:292.
Bridge RPC Example
curl -s https://rpc.zorai.co \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc":"2.0",
"id":1,
"method":"bridge_status",
"params":[]
}'
9. Stablecoins: ZUSD / zUSDT
ZORAI supports two stablecoin paths:
- Native stablecoin issuance with
ZORAIStablecoinV2. - Wrapped stablecoins such as zUSDT or zUSDC via Bridge + Wrapped Asset.
ZORAIStablecoinV2 Features
Template path: contracts/zorai-token-templates/ZORAIStablecoinV2.sol:1.
| Feature | Code path | Notes |
|---|---|---|
| 6 decimals | contracts/zorai-token-templates/ZORAIStablecoinV2.sol:44 | Common stablecoin precision |
| MINTER/BURNER | contracts/zorai-token-templates/ZORAIStablecoinV2.sol:24 | Mint and burn permissions |
| PAUSER | contracts/zorai-token-templates/ZORAIStablecoinV2.sol:26 | Pause transfers |
| BLACKLISTER | contracts/zorai-token-templates/ZORAIStablecoinV2.sol:27 | Blacklist addresses |
| FREEZER | contracts/zorai-token-templates/ZORAIStablecoinV2.sol:28 | Freeze addresses |
| UPGRADER | contracts/zorai-token-templates/ZORAIStablecoinV2.sol:29 | UUPS upgrade |
| Multisig operations | contracts/zorai-token-templates/ZORAIStablecoinV2.sol:47 | OperationRecord plus signer threshold |
Deploy ZUSD:
cd /home/zhangxg/zoraiv5/contracts/hardhat
npm install
npx hardhat compile
export ZORAI_RPC_URL=https://rpc.zorai.co
export PRIVATE_KEY=0xDEPLOYER_PRIVATE_KEY
export ZUSD_NAME="ZORAI USD"
export ZUSD_SYMBOL="ZUSD"
export ZUSD_ADMIN=0xAdminAddress
export ZUSD_SIGNERS=0xSigner1,0xSigner2,0xSigner3
export ZUSD_THRESHOLD=2
export ZUSD_DELAY=3600
npx hardhat run scripts/deploy_zusd.ts --network zorai
10. RPC Reference
RPC dispatch is implemented in pkg/rpc/web3_full.go:598. Bridge RPC is in pkg/rpc/bridge_admin_rpc.go:28. RWA RPC is in pkg/rpc/rwa_rpc.go:24. Compute RPC is in pkg/rpc/compute_rpc.go:51.
Ethereum / Web3 / Net Methods
| Method | Purpose |
|---|---|
web3_clientVersion | Client version |
net_version | Network version |
net_peerCount | Peer count |
net_peers | Peer list |
net_addPeer | Add peer |
net_peerScores | Peer scores |
net_metrics | Network metrics |
net_listening | Listening state |
eth_blockNumber | Current height |
eth_chainId | Chain ID |
eth_getBalance | Account balance |
eth_getTransactionCount | Account nonce |
eth_getBlockByNumber | Block by height |
eth_getBlockByHash | Block by hash |
eth_getTransactionByHash | Transaction lookup |
eth_getTransactionReceipt | Receipt lookup |
eth_getTransactionsByAddress | Address transaction history |
eth_getLogs | Event logs |
eth_call | Read-only execution |
eth_estimateGas | Gas estimation |
eth_gasPrice | Gas price |
eth_maxPriorityFeePerGas | Priority fee |
eth_feeHistory | Fee history |
eth_sendRawTransaction | Send raw transaction |
txpool_status | Txpool status |
txpool_content | Txpool content |
eth_syncing | Sync state |
eth_coinbase | Coinbase |
eth_mining | Mining state |
eth_hashrate | Hashrate |
eth_getCode | Contract code |
eth_getStorageAt | Storage slot |
Chain ID:
curl -s https://rpc.zorai.co \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"eth_chainId","params":[]}'
Expected result:
{"jsonrpc":"2.0","id":1,"result":"0x11433"}
ZORAI Extension Methods
| Method | Purpose |
|---|---|
zor_livenessMetrics | Consensus liveness metrics |
zor_getStats | Chain statistics |
zor_getValidators | Validator list |
zor_getValidator | Validator details |
zor_getAccountCount | Account count |
zor_getContractCount | Contract count |
zor_getTotalStaked | Total stake |
zor_getBurnedFees | Burned fees |
zor_getCommunityPool | Community pool |
zor_getGPUPower | GPU power |
zor_getAvgGasPrice | Average gas price |
zor_pause | Pause node services |
zor_unpause | Resume node services |
zor_pauseStatus | Pause status |
Validator, Bridge, RWA and Compute Methods
Validator methods include validator_getInfo, validator_getStatus, validator_getPendingRewards, validator_join, validator_leave, validator_vote, validator_updateStake, validator_slash, and validator_getUptime.
Bridge methods include bridge_status, bridge_deposit, bridge_burn, bridge_outboundReceipt, bridge_getOutboundReceipt, bridge_listOutboundReceipts, bridge_registerChain, bridge_updateCheckpoint, bridge_registerRelayer, bridge_submitMessage, bridge_addRelayerSignature, bridge_processMessage, bridge_getMessage, bridge_registerWrappedAsset, bridge_listWrappedAssets, bridge_updateWrappedAssetControls, and bridge_burnWrapped.
RWA methods include asset, issuer, document, token, transfer, governance, verification, valuation, compliance, fund, regulatory, dividend, redemption, disclosure and stats APIs. The full dispatch list is in pkg/rpc/rwa_rpc.go:24.
Compute methods include zor_publishTask, zor_acceptTask, zor_submitProof, zor_getTaskStatus, zor_registerNode, zor_updateNodeStatus, zor_getOpenTasks, zor_getMarketStats, zor_getDispute, and zor_getTaskEscrow.
11. Developer Guide
Start a Node
cd /home/zhangxg/zoraiv5
go build -o build/xihud ./cmd/xihud
./build/xihud \
--config configs/config.toml \
--data-dir /data/zorai
Core defaults:
[genesis]
chain_id = 70707
[consensus]
block_time = "400ms"
[rpc]
port = 8545
compute_port = 8646
[network]
p2p_port = 30303
network_id = "zorai-mainnet"
Deploy a Contract
import { ethers } from "ethers";
import fs from "node:fs";
const provider = new ethers.JsonRpcProvider("https://rpc.zorai.co", {
chainId: 70707,
name: "zorai"
});
const wallet = new ethers.Wallet(process.env.PRIVATE_KEY!, provider);
const artifact = JSON.parse(fs.readFileSync("./artifacts/contracts/MyToken.sol/MyToken.json", "utf8"));
const factory = new ethers.ContractFactory(artifact.abi, artifact.bytecode, wallet);
const contract = await factory.deploy("My Token", "MYT", wallet.address, ethers.parseEther("1000000"), {
maxFeePerGas: ethers.parseUnits("2", "gwei"),
maxPriorityFeePerGas: ethers.parseUnits("1", "gwei")
});
await contract.waitForDeployment();
console.log(await contract.getAddress());
Publish an AI Task
curl -s https://rpc.zorai.co \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc":"2.0",
"id":1,
"method":"zor_getOpenTasks",
"params":[{"limit":20}]
}'
Issue an RWA Asset
curl -s https://rpc.zorai.co \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc":"2.0",
"id":1,
"method":"rwa_registerAsset",
"params":[{
"asset_id":"rwa-bond-2026-001",
"asset_type":"bond",
"name":"ZORAI Bond 2026",
"issuer":"issuer-001",
"jurisdiction":"HK",
"currency":"USD",
"total_value":"100000000",
"metadata_uri":"ipfs://bafy.../asset.json"
}]
}'
12. Technical Parameters and Configuration
Chain Parameters
| Parameter | Value | Code path |
|---|---|---|
| Chain ID | 70707 | pkg/types/chain.go:3 |
| Chain ID Hex | 0x11433 | pkg/types/chain.go:4 |
| Network name | zorai-mainnet | pkg/types/chain.go:5 |
| Default block time | 400ms | configs/config.toml:21 |
| Default block gas limit | 30000000 | pkg/evm/evm.go:797 |
| Default base fee | 1 gwei | pkg/evm/evm.go:793 |
| Target gas ratio | 50% | pkg/evm/evm.go:799 |
P2P and RPC
| Parameter | Value | Code path |
|---|---|---|
| P2P port | 30303 | configs/config.toml:12 |
| Protocol ID | /zorai/1.0.0 | pkg/network/network.go:34 |
| Max peers | 50 | configs/config.toml:14 |
| JSON-RPC port | 8545 | configs/config.toml:27 |
| Compute RPC port | 8646 | configs/config.toml:28 |
| Metrics port | 9200 | configs/config.toml:77 |
Current Public 8-node Topology
The current public test topology is 7 validators + 1 RPC-only node, recorded in scripts/nodes.conf.
| Node | Role | Code path |
|---|---|---|
val-hk-1 | validator / bootnode | scripts/nodes.conf:11 |
val-hk-2 | validator | scripts/nodes.conf:20 |
val-hk-3 | validator | scripts/nodes.conf:29 |
val-hk-4 | validator | scripts/nodes.conf:38 |
val-zj-1 | validator | scripts/nodes.conf:47 |
rpc-hk-1 | rpc | scripts/nodes.conf:56 |
rpc-hz-1 | validator | scripts/nodes.conf:64 |
rpc-jp-2 | validator | scripts/nodes.conf:73 |
13. Deployment and Operations
8-node Deployment
Production/public deployment should use scripts/nodes.conf as the inventory source. Each node needs a consistent genesis, validator set and chain ID, a unique node key and validator key, correct external IP/ports, a systemd-managed xihud service and journal logs.
Local stability deployment:
cd /home/zhangxg/zoraiv5
scripts/stability-test/deploy_8nodes.sh --clean
720h Monitor and 90s Watchdog
The 720-hour monitor is launched by scripts/stability-test/run_720h_public_monitor.sh:118. It samples block height, peer count, common root and transaction-test state every 30 minutes. The 90-second watchdog is launched by scripts/stability-test/run_liveness_watchdog.sh:4 and creates incident files when height stalls, peer count drops, roots diverge or nodes become unavailable.
Start monitors:
DURATION_HOURS=720 INTERVAL_SECONDS=1800 REQUIRE_PEER_COUNT=7 \
scripts/stability-test/run_720h_public_monitor.sh
INTERVAL_SECONDS=90 STALL_THRESHOLD=3 REQUIRE_PEER_COUNT=7 \
scripts/stability-test/run_liveness_watchdog.sh
Continuous transaction test:
DAILY_TARGET_TX=80000 ADD_ADDRESS_EVERY=50 \
scripts/stability-test/run_continuous_tx_supervised.sh
Control Plane
The control plane is a production-condition component for future node onboarding, topology allocation, configuration delivery, identity-drift checks and full-node status visibility. Server entry is cmd/controlplane/main.go:13, configuration is in internal/controlplane/config/config.go:80, and node registration/heartbeat/config client calls are in pkg/controlplane/client.go:223, pkg/controlplane/client.go:231 and pkg/controlplane/client.go:239.
14. Roadmap and Current Status
Implemented
| Feature | Status | Evidence |
|---|---|---|
| Chain ID and network parameters | implemented | pkg/types/chain.go:3 |
| Blocks and validation | implemented | pkg/types/block.go:21, pkg/types/block.go:187 |
| Legacy and EIP-1559 transactions | implemented | pkg/types/transaction.go:17 |
| MPT state | implemented | pkg/state/mpt_state.go:43 |
| LevelDB + WAL | implemented | pkg/blockchain/store.go:34 |
| London EVM | implemented | pkg/evm/evm.go:78 |
| EIP-1559 gas | implemented | pkg/evm/evm.go:495 |
| Mempool | implemented | pkg/mempool/mempool.go:91 |
| PoS validators | implemented | pkg/consensus/pos_complete.go:37 |
| BFT QC / finality | implemented | pkg/consensus/bft.go:76 |
| BFT liveness recovery | implemented, needs long-running evidence | pkg/consensus/bft.go:839 |
| libp2p network | implemented | pkg/network/network.go:107 |
| Ethereum JSON-RPC | implemented | pkg/rpc/web3_full.go:598 |
| WebSocket subscriptions | implemented | pkg/websocket/websocket.go:22 |
| Explorer / Token Indexer | implemented | cmd/explorer/main.go:235, cmd/explorer/token_indexer.go:23 |
| RWA RPC | implemented | pkg/rpc/rwa_rpc.go:24 |
| ERC-3643 template/precompile | implemented | contracts/zorai-token-templates/ZORAIRWAToken.sol:260, pkg/evm/erc3643_precompiled.go:17 |
| Compute Market | implemented | pkg/taskmarket/market.go:17 |
| Compute Relay | implemented | pkg/computerelay/relay.go:264 |
| Bridge / Wrapped Asset | implemented | pkg/bridge/cross_chain.go:174, pkg/evm/bridge_executor.go:35 |
| Stablecoin V2 | implemented | contracts/zorai-token-templates/ZORAIStablecoinV2.sol:1 |
| 720h monitor | implemented | scripts/stability-test/run_720h_public_monitor.sh:118 |
| 90s liveness watchdog | implemented | scripts/stability-test/run_liveness_watchdog.sh:4 |
| Control plane foundation | implemented, needs production restoration | cmd/controlplane/main.go:13 |
Priority Next Steps
- Complete uninterrupted 720h public evidence on the 7 validator + 1 RPC topology.
- Restore the control plane as a production operational surface.
- Expand BFT fault-injection tests for rate limits, round dispersion, restarts and double-vote cases.
- Audit bridge proof, relayer quorum and wrapped-asset replay protection.
- Audit RWA compliance, privacy proof, forced transfer, redemption and reporting workflows.
- Run wallet/RPC compatibility tests across Hardhat, Foundry, ethers, web3.py and MetaMask.
- Continue peak TPS, contract-call, event-log and RPC query load testing.
Appendix A: Command Cheat Sheet
# Build node
go build -o build/xihud ./cmd/xihud
# Run all tests
go test ./...
# Consensus and network tests
go test ./pkg/consensus ./pkg/network
# Chain ID
curl -s https://rpc.zorai.co -H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"eth_chainId","params":[]}'
# Block height
curl -s https://rpc.zorai.co -H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"eth_blockNumber","params":[]}'
# Peers
curl -s https://rpc.zorai.co -H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"net_peerCount","params":[]}'