Skip to main content

ERC-8004 SDK for OpenClaw agents - Register, query, and rate agent identities on Ethereum

Project description

ERC-800Claw

ERC-8004 SDK for OpenClaw agents. Register, query, and rate agent identities on Ethereum.

From Primer Systems · @primer_systems

pip install erc-800claw

Quick Start

CLI

# Get agent details
erc-800claw agent 1

# Check if agent exists
erc-800claw exists 1

# Get agent count for an address
erc-800claw owner 0x9ce7082814bDA389F3ba548BDf2626006279569c

# Register a new agent (requires private key)
PRIVATE_KEY=0x... erc-800claw register --name "My Agent" --network sepolia

# List networks and contracts
erc-800claw networks

# Show contract addresses
erc-800claw contracts mainnet

# Use testnet
erc-800claw agent 1 --network sepolia

# JSON output
erc-800claw agent 1 --json

Python

from erc800claw import create_client

client = create_client(network='mainnet')

# Get agent by ID
agent = client.get_agent(1)
print(agent)
# {
#     'agent_id': 1,
#     'token_uri': 'ipfs://...',
#     'owner': '0x...',
#     'metadata': {'name': 'My Agent', ...},
#     'explorer_url': 'https://etherscan.io/...'
# }

# Check if agent exists
exists = client.agent_exists(1)

# Get agent count for an address
count = client.get_agent_count('0x...')
print(f"Address owns {count} agents")

# Register a new agent (no IPFS needed - uses data URI!)
import os
result = client.register_agent(
    private_key=os.environ['PRIVATE_KEY'],
    name='My Autonomous Agent',
    description='Handles customer support',
    services=[{'name': 'support', 'endpoint': 'https://myagent.com/api'}]
)
print(f"Registered agent #{result['agent_id']}")

# Give feedback to an agent
client.give_feedback(
    private_key=os.environ['PRIVATE_KEY'],
    agent_id=agent_id,
    value=4.5,        # Score out of 5
    decimals=1,
    tag1='support',
    tag2='fast'
)

API

create_client(network='mainnet', rpc_url=None)

Create a client instance.

client = create_client(
    network='mainnet',  # or 'sepolia'
    rpc_url='https://...'  # optional custom RPC
)

Read Methods

client.get_agent(agent_id)

Get agent details by ID. Returns None if agent doesn't exist.

{
    'agent_id': 1,
    'token_uri': 'ipfs://...' or None,
    'owner': '0x...',
    'metadata': {...} or None,  # Fetched from token_uri if available
    'explorer_url': 'https://...'
}

client.agent_exists(agent_id)

Check if an agent exists. Returns True or False.

client.get_agent_count(owner_address)

Get number of agents owned by an address.

client.get_reputation(agent_id, client_addresses=None, tag1='', tag2='')

Get reputation summary for an agent.

rep = client.get_reputation(
    1,
    client_addresses=['0x...'],  # Required: specific reviewers to query
    tag1='support',              # Optional: filter by tag
    tag2=''
)

client.get_network_info()

Get current network configuration.

Write Methods

All write methods require a private key for signing transactions.

client.register(private_key, agent_uri_or_metadata=None)

Register a new agent. Pass a URI string or metadata dict (auto-converted to data URI).

# With metadata dict (recommended - no IPFS needed)
result = client.register(private_key, {
    'name': 'My Agent',
    'description': 'Does cool stuff'
})

# With custom URI
result = client.register(private_key, 'ipfs://...')

# Without URI (can set later)
result = client.register(private_key)

client.register_agent(private_key, name, description='', image='', services=None, supported_trust=None)

Convenience method with structured arguments.

result = client.register_agent(
    private_key,
    name='My Agent',           # Required
    description='Agent desc',  # Optional
    image='https://...',       # Optional
    services=[{                # Optional
        'name': 'api',
        'endpoint': 'https://...'
    }],
    supported_trust=['reputation']  # Optional, default: ['reputation']
)
# Returns: {'agent_id': ..., 'tx_hash': ..., 'owner': ..., 'explorer_url': ...}

client.set_agent_uri(private_key, agent_id, new_uri_or_metadata)

Update an agent's metadata URI.

client.set_agent_uri(private_key, agent_id, {
    'name': 'Updated Name',
    'description': 'New description'
})

client.give_feedback(private_key, agent_id, value, decimals=2, tag1='', tag2='', endpoint='', feedback_uri='', feedback_hash=None)

Submit reputation feedback for an agent.

client.give_feedback(
    private_key,
    agent_id,
    value=4.5,              # Score value
    decimals=1,             # Decimal places (default: 2)
    tag1='quality',         # Primary category
    tag2='fast',            # Secondary tag
    endpoint='/api/chat',   # Which endpoint was used
    feedback_uri='',        # Optional: link to detailed feedback
    feedback_hash='0x...'   # Optional: hash of feedback data
)

Helper Functions

create_data_uri(metadata)

Create a data URI from a metadata dict (no IPFS upload needed).

from erc800claw import create_data_uri
uri = create_data_uri({'name': 'My Agent', 'description': '...'})
# Returns: data:application/json;base64,...

parse_data_uri(data_uri)

Parse a data URI back to a metadata dict.

create_registration_metadata(name, description='', image='', services=None, supported_trust=None)

Create standard ERC-8004 registration metadata.

Networks

Network Chain ID Status
Ethereum Mainnet 1 Live
Sepolia Testnet 11155111 Live

Contract Addresses

Mainnet

  • Identity Registry: 0x8004A169FB4a3325136EB29fA0ceB6D2e539a432
  • Reputation Registry: 0x8004BAa17C55a88189AE136b182e5fdA19dE9b63

Sepolia

  • Identity Registry: 0x8004A818BFB912233c491871b3d84c89A494BD9e
  • Reputation Registry: 0x8004B663056A597Dffe9eCcC1965A193B7388713

What is ERC-8004?

ERC-8004 provides on-chain identity, reputation, and validation for autonomous agents:

  • Identity Registry - ERC-721 agent identities with registration metadata
  • Reputation Registry - Signed feedback scores between agents/clients
  • Validation Registry - Independent verification (zkML, TEE, stakers)

Learn more: 8004.org | EIP-8004

Related

License

MIT - Primer Systems

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

erc_800claw-0.1.0.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

erc_800claw-0.1.0-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file erc_800claw-0.1.0.tar.gz.

File metadata

  • Download URL: erc_800claw-0.1.0.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for erc_800claw-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b9a50781eeb1d3ba934287c7eba3e7fd077ba0d816d75fe6c2bf5e94826e6485
MD5 4d6b71c7b96dd243661226011f46f7b8
BLAKE2b-256 a46a3d0f345a85c400b4216422b427b7081b0abd76c3de6b9c85868dd57eb318

See more details on using hashes here.

File details

Details for the file erc_800claw-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: erc_800claw-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for erc_800claw-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ef938f3d93442124949cc57282b3919ec24323c52b57bee02e723ad173a508ab
MD5 f153ad013545b6f23810d8ca9052bc10
BLAKE2b-256 2bded71a7277f34212e063672f996ca6e6cb4ffdac24f67b4a1ea9614c6b011c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page