- Live Demo: https://hale-oracle.vercel.app
- Colosseum Project: View Submission
- Strategic Partner: Clawbet (AI-Powered Prediction Markets)
A production-ready system that uses Google Gemini 2.0/2.5 AI as an autonomous forensic auditor to verify digital deliveries against smart contract terms on the Circle Arc blockchain. HALE (H-A-L-E = 8 in numerology) represents balance and strength in code verification.
| Network | Component | Live Address |
|---|---|---|
| Solana Devnet | Forensic Engine | CnwQj2kPHpTbAvJT3ytzekrp7xd4HEtZJuEua9yn9MMe |
| Solana Devnet | HALE Escrow | BCKogk1bxSti471AAyrWu3fEBLtbrE3nrwopKZrauEu6 |
| Arc Testnet | Vault Factory | 0x4059fDf0bd9b48F4864cB3949A3c5892df0C2e70 |
| Arc Testnet | Forensic Escrow | 0x57c8a6466b097B33B3d98Ccd5D9787d426Bfb539 |
HALE Oracle eliminates trust assumptions between autonomous AI agents by:
- Analyzing digital deliverables (code, text, data) against strict contractual terms.
- Performing deep security scans for malicious content and backdoors.
- Outputting structured JSON verdicts that trigger atomic blockchain settlements.
- Permanent Archiving: Storing the forensic "Proof of Outcome" to Arweave for immutable reputation history.
programs/: Proof of Intent — Anchor smart contract for on-chain attestations.api/: AI Forensic Oracle — Python backend using Google Gemini reasoning.frontend/: Live Dashboard — React + Vite application for real-time monitoring.docs/VISION.md: [Technical Whitepaper] — Our full vision, detailed architecture, and the future of Liquid Reputation.
- Live Demo: hale-oracle.vercel.app
- Full Architecture Diagram: Located in
assets/hale_process_diagram.png
HALE is optimized for the Gemini 2.0 & 2.5 reasoning models, utilizing their massive context windows (up to 2M tokens) to perform holistic code reviews that smaller models miss. The system automatically detects the best available model in your region.
HALE supports enterprise-grade and agentic payment flows:
- Circle Programmable Wallets (Recommended): Developer-controlled wallets via Circle's API for compliant, gasless USDC settlement on Arc.
- Traditional Wallets: Direct private key management for high-speed on-chain attestations on Solana.
See CIRCLE_WALLET_SETUP.md for detailed configuration.
User Request → Backend → Gemini API (HALE Oracle) → JSON Verdict → Smart Contract → Arc Blockchain
pip install -r requirements.txt- Visit Google AI Studio
- Create a new API key
- Set it as an environment variable:
export GEMINI_API_KEY="your-api-key-here"- Go to Google AI Studio
- Create a new prompt
- Copy the contents of
hale_oracle_system_prompt.txtinto the "System Instructions" box - Save the configuration
If you want to trigger actual blockchain transactions:
export ARC_RPC_URL="https://rpc.arc.xyz" # Replace with actual Arc RPC endpointfrom hale_oracle_backend import HaleOracle
import json
# Initialize oracle
oracle = HaleOracle(
gemini_api_key=os.getenv('GEMINI_API_KEY'),
arc_rpc_url=os.getenv('ARC_RPC_URL') # Optional
)
# Load contract data
contract_data = {
"transaction_id": "tx_0x123abc_arc",
"Contract_Terms": "Generate a Python script to fetch USDC price",
"Acceptance_Criteria": [
"Must be written in Python 3",
"Must handle API errors gracefully",
"Must print the price to console"
],
"Delivery_Content": "import requests\n\ndef get_usdc_price():\n ..."
}
# Process delivery
result = oracle.process_delivery(
contract_data=contract_data,
seller_address="0xSellerAddress123"
)
print(json.dumps(result, indent=2))python hale_oracle_backend.pyThis will:
- Load
test_example.json - Send it to Gemini for verification
- Display the verdict
- Show how the smart contract would be triggered
HALE Oracle returns a JSON object with this structure:
{
"transaction_id": "tx_0x123abc_arc",
"verdict": "PASS",
"confidence_score": 98,
"release_funds": true,
"reasoning": "The script is valid Python 3, correctly targets the CoinGecko API for USDC, and includes a try-except block for error handling as requested.",
"risk_flags": []
}verdict: Either "PASS" or "FAIL"confidence_score: 0-100 (must be ≥90 for PASS)release_funds:trueonly if verdict is PASS and confidence ≥90reasoning: Concise explanation (max 2 sentences)risk_flags: Array of security or compliance concerns
- Frontend: User submits a request, Bot submits code
- Backend Logs:
[HALE Oracle] Sending delivery to HALE Oracle (Gemini)... [HALE Oracle] Verdict: PASS [HALE Oracle] Confidence: 98% [Blockchain] Triggering Smart Contract: Escrow.release(0xSellerAddress)... - Blockchain: Show transaction on Arc Block Explorer
The trigger_smart_contract() method is a placeholder. To integrate with actual Arc smart contracts, follow these steps:
-
Deploy an Escrow Contract on Arc
- Create a smart contract that holds funds in escrow
- Implement a
release(address seller)function that transfers funds - Ensure the contract has proper access controls (only HALE Oracle can call release)
-
Set Up Environment Variables
export ARC_RPC_URL="https://rpc.arc.xyz" # Arc blockchain RPC endpoint export ESCROW_CONTRACT_ADDRESS="0x..." # Your deployed escrow contract address export ORACLE_PRIVATE_KEY="0x..." # Private key for signing transactions (keep secure!)
-
Get Contract ABI
- Export your contract ABI from your deployment tool (Hardhat, Foundry, etc.)
- Save it as
escrow_abi.jsonor include it directly in your code
Here's a complete implementation of trigger_smart_contract():
import json
from eth_account import Account
def trigger_smart_contract(self, verdict: Dict[str, Any], seller_address: str,
contract_address: Optional[str] = None) -> bool:
"""
Trigger the smart contract to release funds if verdict is PASS.
"""
if not verdict.get('release_funds', False):
print("[Blockchain] Funds will NOT be released (verdict: FAIL)")
return False
if not self.web3:
print("[Blockchain] WARNING: No blockchain connection configured")
return False
# Use provided address or environment variable
escrow_address = contract_address or os.getenv('ESCROW_CONTRACT_ADDRESS')
if not escrow_address:
print("[Blockchain] ERROR: No contract address provided")
return False
# Load contract ABI
with open('escrow_abi.json', 'r') as f:
escrow_abi = json.load(f)
# Initialize contract
contract = self.web3.eth.contract(
address=Web3.to_checksum_address(escrow_address),
abi=escrow_abi
)
# Get oracle account
oracle_private_key = os.getenv('ORACLE_PRIVATE_KEY')
if not oracle_private_key:
print("[Blockchain] ERROR: ORACLE_PRIVATE_KEY not set")
return False
oracle_account = Account.from_key(oracle_private_key)
oracle_address = oracle_account.address
try:
# Build transaction
nonce = self.web3.eth.get_transaction_count(oracle_address)
gas_price = self.web3.eth.gas_price
transaction = contract.functions.release(
Web3.to_checksum_address(seller_address)
).build_transaction({
'from': oracle_address,
'nonce': nonce,
'gas': 100000, # Adjust based on your contract
'gasPrice': gas_price,
'chainId': 5042002 # Correct Arc Testnet Chain ID
})
# Sign transaction
signed_txn = oracle_account.sign_transaction(transaction)
# Send transaction
print(f"[Blockchain] Submitting transaction to release funds to {seller_address}...")
tx_hash = self.web3.eth.send_raw_transaction(signed_txn.rawTransaction)
# Wait for confirmation
receipt = self.web3.eth.wait_for_transaction_receipt(tx_hash, timeout=120)
if receipt.status == 1:
print(f"[Blockchain] ✅ Transaction successful!")
print(f"[Blockchain] Transaction hash: {tx_hash.hex()}")
print(f"[Blockchain] Block: {receipt.blockNumber}")
print(f"[Blockchain] View on explorer: https://explorer.arc.xyz/tx/{tx_hash.hex()}")
return True
else:
print(f"[Blockchain] ❌ Transaction failed")
return False
except Exception as e:
print(f"[Blockchain] ERROR: {str(e)}")
return False// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract Escrow {
address public oracle; // HALE Oracle address
mapping(address => uint256) public deposits;
constructor(address _oracle) {
oracle = _oracle;
}
function deposit(address seller) external payable {
deposits[seller] += msg.value;
}
function release(address seller) external {
require(msg.sender == oracle, "Only oracle can release");
uint256 amount = deposits[seller];
require(amount > 0, "No funds to release");
deposits[seller] = 0;
payable(seller).transfer(amount);
}
}- Private Key Management: Never commit private keys to version control. Use environment variables or secure key management services
- Access Control: Ensure only the HALE Oracle address can call
release()in your smart contract - Gas Limits: Set appropriate gas limits to prevent failed transactions
- Error Handling: Implement retry logic for network failures
- Transaction Monitoring: Monitor transaction status and implement alerts for failures
- Multi-sig: Consider using a multi-signature wallet for production deployments
Before deploying to mainnet, test on Arc testnet:
# Test transaction
result = oracle.process_delivery(contract_data, seller_address)
if result['transaction_success']:
print("✅ Funds released successfully")
else:
print("❌ Transaction failed - check logs")-
HALE Oracle performs security scans for:
- Infinite loops in code
- Prompt injection attempts
- Phishing links
- Other malicious patterns
-
Always validate the JSON response structure before processing
-
Implement rate limiting for production use
-
Store API keys securely (use environment variables or secrets management)
HALE Oracle includes a comprehensive web frontend for deploying, customizing, monitoring, and integrating the oracle.
- ✅ Verification Form: Enter custom data and verify deliveries
- ✅ Deployment: Deploy and configure the escrow contract
- ✅ Monitoring: Real-time monitoring of oracle performance
- ✅ Documentation: Comprehensive guides and API reference
- ✅ Integration: Easy integration guides for projects and agent wallets
- Install frontend dependencies:
cd frontend
npm install- Start the backend API (in project root):
python backend_api.py- Start the frontend (in frontend directory):
npm run dev- Open
http://localhost:3000in your browser
Or use the convenience script:
./start_frontend.shfrontend/src/components/VerificationForm.jsx- Main verification interfacefrontend/src/components/Deployment.jsx- Contract deploymentfrontend/src/components/Monitoring.jsx- Oracle monitoring dashboardfrontend/src/components/Documentation.jsx- Comprehensive documentationfrontend/src/components/Integration.jsx- Integration guides
See frontend/README.md for detailed frontend documentation.
hale_oracle_system_prompt.txt: System instructions for Geminihale_oracle_backend.py: Main backend implementationbackend_api.py: REST API server for frontendtest_example.json: Example contract data for testingrequirements.txt: Python dependenciesfrontend/: React frontend application
MIT
