Skip to content

About

Decentralized dispute resolution protocol for voluntary, contract-based justice. Built on Ethereum.

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

VoluntaryJustice

Decentralized Dispute Resolution Protocol for Voluntary, Contract-Based Justice

License: MIT Solidity Tests CI Status


Overview

VoluntaryJustice is a maximally on-chain dispute resolution protocol that enables individuals and organizations to resolve disputes without state courts. The system uses economic incentives, insurance, reputation, and arbitration to create a self-sustaining justice marketplace.

Status: Working Draft — Unaudited. Not yet deployed. See Project Status before using.

┌─────────────────────────────────────────────────────────────────┐
│                        Protocol Layer                            │
│  ┌───────────┐ ┌───────────┐ ┌───────────┐ ┌───────────────────┐│
│  │ Identity  │ │ Contract  │ │Arbitration│ │    Governance     ││
│  │ Registry  │ │  Engine   │ │  Courts   │ │  (Governor+Token) ││
│  └───────────┘ └───────────┘ └───────────┘ └───────────────────┘│
│  ┌───────────┐ ┌───────────┐ ┌───────────┐ ┌───────────────────┐│
│  │ Insurance │ │Enforcement│ │Reputation │ │  Oracle/Legacy    ││
│  │   Pools   │ │  Engine   │ │  Scoring  │ │   Integration     ││
│  └───────────┘ └───────────┘ └───────────┘ └───────────────────┘│
└─────────────────────────────────────────────────────────────────┘

Project Status

This is a working draft built for research and demonstration. It is not production-ready and has not been deployed to any network.

Area State
Smart contracts 22 contracts implemented; compile clean on Solidity 0.8.25
Tests 849 passing, 0 pending; overall 82.3% branch / 98.8% statement coverage
Core coverage All high-stakes contracts (dispute, governance, insurance, enforcement, bounty, bridge, juror pool) are at 80%+ branch coverage
Remaining coverage gaps A few registry/view contracts (CourtRegistry, EscrowVault, OracleRegistry, RulingAnchor, LegacyCourtBridge, …) are still below 80% branch, though overall is now above target
Security Internal review only — no external audit, no static analysis, no bug bounty
Frontend Next.js app wired to contract hooks, but contract addresses are unset and the root landing page is still scaffolding
Deployment Scripts exist; nothing deployed; addresses not wired into the frontend

Do not use with real funds. See the Internal Security Review for known gaps.


Key Features

Feature Description
Tiered Arbitration Single arbitrator → Jury appeal
Multi-Dimensional Reputation Compliance, dispute rate, payment history, ratings
Insurance System Protocol baseline + open market
Economic Enforcement Escrow, insurance, staking, reputation, exclusion
Template Contracts DAO-approved contract templates
On-Chain Governance OpenZeppelin Governor with constitutional constraints
Oracle Integration Chainlink price feeds and VRF for jury selection
Legacy Court Bridge Off-chain court ruling imports with verification

Smart Contracts

Phase 1: Core MVP

Contract Purpose
VJToken.sol ERC-20 governance token with staking hooks
IdentityRegistry.sol Identity registration with sybil protection
ReputationScoring.sol Multi-dimensional on-chain reputation
ContractTemplateRegistry.sol DAO-managed contract templates
ContractFactory.sol Contract creation and signing
CourtRegistry.sol Arbitration court registration and staking
DisputeResolution.sol Dispute lifecycle with appeals
EscrowVault.sol Secure escrow management
StakingRewards.sol Multi-role staking with rewards

Phase 2: Insurance & Appeals

Contract Purpose
JurorPool.sol Juror staking and VRF-ready jury selection
BaselineInsurancePool.sol Community insurance coverage
InsurerRegistry.sol Private insurer registration
InsurancePolicy.sol Policy purchase, renewal, claims
EnforcementEngine.sol Ruling execution and escalation

Phase 3: Bounty Market & Exclusion

Contract Purpose
ExclusionRegistry.sol Permanent exclusion records for non-compliance
BountyMarket.sol Recovery bounties with oracle/court/debtor verification

Phase 4: Governance & Anchoring

Contract Purpose
VJGovernor.sol OpenZeppelin Governor with built-in timelock (GovernorTimelockControl) and constitutional constraints (forbidden-selector checks that block defining crimes, overriding contracts, granting immunity, or compelling participation)
RulingAnchor.sol Anchors final dispute rulings for cross-layer reference

Phase 5: Oracle & Legacy Integration

Contract Purpose
OracleRegistry.sol Trusted oracle network for recovery attestations (staking, quorum, slashing)
LegacyCourtBridge.sol Off-chain court ruling imports with multi-jurisdiction support and a challenge period

Phase 6: Cross-Chain & Randomness

Contract Purpose
VRFConsumer.sol Chainlink VRF v2.5 consumer for random jury selection
CrossChainBridge.sol L2 ↔ mainnet messaging for ruling anchoring (Arbitrum, Optimism, Base)

A MockVRFCoordinator.sol mock lives under contracts/mocks/ for testing VRF flows.

Total: 22 production contracts.


Frontend

A complete Next.js frontend application is included in the frontend/ directory.

Tech Stack

  • Framework: Next.js 16 (App Router)
  • Wallet: RainbowKit + wagmi v2
  • Styling: shadcn/ui + Tailwind CSS
  • State: TanStack Query
  • Forms: React Hook Form + zod

Pages

  • Dashboard - Overview stats, quick actions
  • Contracts - Create, view, sign contracts
  • Disputes - File disputes, submit evidence, view rulings
  • Insurance - Browse insurers, purchase policies
  • Courts - Browse courts, register as arbitrator
  • Governance - View proposals, cast votes

Run Frontend

cd frontend
npm install
npm run dev

How It Works

Dispute Lifecycle

┌──────────┐    ┌───────────┐    ┌──────────┐    ┌─────────┐
│  Filed   │───►│  Evidence │───►│  Ruling  │───►│ Enforce │
└──────────┘    └───────────┘    └──────────┘    └─────────┘
                                       │
                                       ▼ (if appealed)
                               ┌──────────────┐
                               │  Jury Panel  │
                               └──────────────┘

Enforcement Hierarchy

  1. Escrow Transfer - Smart contract releases to victor
  2. Insurance Claim - Protocol triggers claim against debtor's insurer
  3. Bond Slashing - Slash debtor's staked tokens
  4. Reputation Downgrade - Compliance score impacts future access
  5. Exclusion Registry - Barred from system participation

Getting Started

Prerequisites

  • Node.js 18+
  • npm or yarn

Installation

git clone https://github.com/EricGrill/voluntaryjustice.git
cd voluntaryjustice
npm install

Compile Contracts

npx hardhat compile

Run Tests

npm test
# 849 tests passing

Deploy to Local Network

npx hardhat node
npx hardhat run scripts/deploy-full.js --network localhost

Deploy to Testnet

# Set environment variables
export SEPOLIA_RPC_URL=<your-rpc-url>
export PRIVATE_KEY=<deployer-private-key>

npx hardhat run scripts/deploy-testnet.js --network sepolia

Deploy scripts write the resulting addresses to deployments/<network>-latest.json. The frontend's frontend/lib/contracts/addresses.ts is not yet auto-populated — addresses must currently be copied in manually.


Token: VJ

Utilities:

  • Court staking (required to operate as arbitrator)
  • Juror staking (required to join jury pool)
  • Insurer staking (required to offer coverage)
  • Governance voting
  • Registry access fees

Staking Roles:

  • Court - 50% of rewards
  • Juror - 30% of rewards
  • Insurer - 20% of rewards

Insurance Tiers

Tier Coverage Contract Limits
Uninsured None Max 0.1 ETH, 100% escrow
Baseline Protocol pool Max 1 ETH, 50% escrow
Standard Baseline + supplemental Max 10 ETH, 25% escrow
Premium High-limit Unlimited, flexible escrow

Architecture

Full architecture design: docs/plans/2026-01-28-aegis-architecture-design.md

Design Decisions

Decision Choice
Blockchain Ethereum/EVM
On-chain approach Maximally on-chain
Scaling L2 operations + mainnet anchoring
Identity Hybrid (native + existing primitives)
Arbitration Tiered (single + jury appeal)
Enforcement Court-directed escalation
Insurance Protocol baseline + open market
Governance OpenZeppelin Governor + built-in Timelock
Upgrades Non-upgradeable (contracts are immutable once deployed; no proxy layer yet)

Roadmap

  • Phase 1 - Core MVP (Identity, Contracts, Disputes, Escrow)
  • Phase 2 - Insurance & Appeals (Jury, Insurance, Enforcement)
  • Phase 3 - Bounty Market & Exclusion (ExclusionRegistry, BountyMarket)
  • Phase 4 - Governance & Anchoring (Governor with timelock + constitutional constraints, RulingAnchor)
  • Phase 5 - Oracle & Legacy Integration (OracleRegistry, LegacyCourtBridge)
  • Phase 6 - Cross-Chain & Randomness (VRFConsumer, CrossChainBridge)
  • Phase 7 - Frontend Application (Next.js, RainbowKit, shadcn/ui)
  • Phase 8 - Internal review & coverage reports
  • Phase 9 - Overall branch coverage raised above 80% (all high-stakes contracts at 80%+)
  • Phase 10 - Raise the remaining registry/view contracts to 80%+ branch
  • Phase 11 - External security audit + bug bounty
  • Phase 12 - Testnet deployment & full user-flow testing
  • Phase 13 - Mainnet preparation

Security

Audit Status

  • Internal review only (not an external audit)
  • Test coverage: 98.8% statements, 82.3% branches, 99.1% lines (full table in the audit report)
  • Overall branch coverage above the 80% target; all high-stakes contracts at 80%+
  • A few registry/view contracts (CourtRegistry, EscrowVault, OracleRegistry, …) still below 80% branch
  • External security audit — not started
  • Static analysis (Slither/Mythril) — not yet run
  • Bug bounty — not launched

Security Documentation

Security Features (implemented in code)

  • Role-based access control (OpenZeppelin AccessControl)
  • Reentrancy guards on state-changing functions
  • Timelock on governance actions (OpenZeppelin GovernorTimelockControl)
  • Constitutional constraints in the Governor (forbidden-selector checks)
  • Staking + slashing for courts, jurors, insurers, and oracles

Not yet implemented (despite being on the roadmap): an enforced global pause / circuit breaker (the Governor has a paused flag, but no other contract reads it), rate limiting, a dedicated emergency-multisig contract, and an upgrade/proxy layer.


Contributing

Contributions are welcome. Please read CONTRIBUTING.md for development setup, smart contract guidelines, and the PR process.

For security issues, see SECURITY.md.


License

MIT License - see LICENSE for details.


Connect

Built by Eric Grill

Website X

About

Decentralized dispute resolution protocol for voluntary, contract-based justice. Built on Ethereum.

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

⌂ Proxy