Home Solutions ERC-8004 Bridge

ERC-8004 Reputation Bridge

Bridge DAT trust scores to Ethereum. On-chain reputation that makes DAT the intelligence layer behind blockchain identity. Your agents earn trust off-chain and carry it on-chain—verifiable by any smart contract.

Off-Chain Intelligence, On-Chain Proof

Trust scores convert to uint256 and sync to Ethereum automatically, with smart threshold filtering.

Behavioral Trust Meets Blockchain Permanence

DAT's 5-pillar trust engine evaluates agents continuously off-chain—where computation is cheap, data is rich, and ML models can run freely. The ERC-8004 bridge selectively publishes these scores on-chain, giving smart contracts and DeFi protocols a verifiable, auditable reputation signal for every agent.

  • Score Conversion — Trust 0-100 (float) maps to uint256 0-10000 on-chain for precision without floating point
  • DID to bytes32 — Agent DIDs convert to keccak256 hashes for gas-efficient on-chain storage
  • Background Sync Worker — Every 5 minutes, the sync worker checks for score changes and batches updates
  • Threshold Filtering — Only syncs when the score delta is 5 points or more, minimizing gas costs
  • Exponential Backoff — Network failures trigger automatic retry with increasing delays

The result: on-chain reputation that is always within 5 points of the live off-chain score, with gas costs optimized to only pay for meaningful changes.

Score Conversion Pipeline
==============================

Off-Chain (DAT):
  Trust Score: 82.45
  DID: did:dat:testnet:agent_abc

Conversion:
  Score: 82.45 * 100 = 8245 (uint256)
  AgentId: keccak256("did:dat:...")
    = 0x7f3a...b2c1 (bytes32)

On-Chain (Ethereum):
  DATReputationRegistry.sol
  setScore(agentId, 8245)

Sync Worker (5-min interval):
  1. Fetch all mapped agents
  2. Get current trust scores
  3. Compare with last synced
  4. Filter: |delta| >= 5
  5. Batch update on-chain
  6. Record transaction hash

Gas Optimization:
  Score 80 -> 82: skip (delta 2)
  Score 80 -> 86: sync (delta 6)
  Score 80 -> 40: sync (delta 40)

Result: ~3-5 txns/day typical
  vs ~50+ without threshold

Zero-Config Agent Onboarding

Agents that earn trust are automatically bridged. No manual mapping required.

Earn Your Way On-Chain

The bridge doesn't require administrators to manually map every agent to an Ethereum identity. When an agent's trust score crosses the threshold (default 70), the sync worker automatically creates a bridge mapping and begins publishing scores on-chain. Agents earn their way to blockchain reputation through behavior.

  • Auto-Map at Trust 70+ — Configurable threshold. Agents below it are excluded from on-chain sync
  • Gas Estimator — Redis-cached gas estimates (30s TTL) for dashboard cost projections
  • Graceful Degradation — Service runs fully without Ethereum config. Enable on-chain sync when ready
  • Idempotent Mapping — P2002 unique constraint handling prevents duplicate bridge entries
  • Redis Distributed Lock — Sync worker uses NX lock to prevent concurrent sync cycles

For enterprises evaluating blockchain reputation standards, DAT offers a risk-free path: start with off-chain trust scoring, add on-chain publication when the business case is proven, and remove it without disruption if priorities change.

Auto-Mapping Flow
==============================

Sync Worker Step 0 (auto-map):
  1. Query agents with trust >= 70
  2. Check existing mappings
  3. Create new mappings for
     unmapped high-trust agents
  4. P2002 -> skip (idempotent)

Configuration:
  BRIDGE_AUTO_MAP_ENABLED=true
  BRIDGE_AUTO_MAP_THRESHOLD=70
  BRIDGE_SYNC_INTERVAL=300000
  BRIDGE_BATCH_SIZE=10
  BRIDGE_SCORE_THRESHOLD=5

Graceful Degradation:
  No ETHEREUM_RPC_URL?
    -> Service starts normally
    -> All endpoints return status
    -> Sync worker skips
    -> Enable later with env vars

Dashboard:
  Bridge Status:  Connected
  Last Sync:      2m ago
  Mapped Agents:  12
  Pending Sync:   3
  Gas Price:      12 gwei
  Est. Cost:      $0.42/sync

Battle-Tested Smart Contract

DATReputationRegistry.sol deployed on Sepolia with 15 passing Hardhat tests.

A Contract Built for Agent Reputation

The DATReputationRegistry is a purpose-built Solidity contract that stores agent reputation scores on Ethereum. It supports individual and batch updates, owner-controlled write access (the bridge wallet), and sequential token IDs for gas-efficient enumeration. Every score update is an immutable, auditable on-chain record.

  • 15 Hardhat Tests — Register, update, batch, authorization, and ownership transfer all verified
  • Chain-Aware URLs — Dashboard links to correct Etherscan (Sepolia vs mainnet) automatically
  • Owner-Only Writes — Only the bridge wallet can update scores. No unauthorized modifications
  • Sequential Token IDs — Gas-efficient enumeration for on-chain analytics

The contract is designed for Sepolia testnet today and mainnet migration tomorrow. When ERC-8004 moves to an official registry standard, the bridge service adapts—your agents keep their accumulated reputation.

DATReputationRegistry.sol
==============================

// Solidity ^0.8.24
// Optimizer: 200 runs

contract DATReputationRegistry {

  // Score storage
  mapping(bytes32 => uint256) scores;
  mapping(bytes32 => uint256) tokenIds;

  // Owner-only write access
  modifier onlyOwner() { ... }

  // Register new agent
  function register(
    bytes32 agentId
  ) external onlyOwner;

  // Update score (0-10000)
  function setScore(
    bytes32 agentId,
    uint256 score
  ) external onlyOwner;

  // Batch update
  function batchUpdate(
    bytes32[] agentIds,
    uint256[] scores
  ) external onlyOwner;

  // Public read
  function getScore(
    bytes32 agentId
  ) external view returns (uint256);
}

Deployed: Sepolia testnet
Tests: 15/15 passing
Hardhat + ethers.js v6
5m
Sync Interval
≥70
Auto-Map Trust
Live
Sepolia
15
Contract Tests

Put Agent Reputation On-Chain

Give your agents verifiable, immutable reputation that any smart contract can query. Start on Sepolia, migrate to mainnet when ready.