ERCData
Store and verify AI-related data on Base mainnet. Public or private, with cryptographic integrity proofs.
Quick Start
CODEBLOCK0
Configuration
Set via environment or skill config:
- -
ERCDATA_KEY — Private key for signing transactions (required for writes) - INLINECODE1 — Contract address on Base mainnet
- INLINECODE2 — RPC URL (default: https://mainnet.base.org)
Or pass via --key, --contract, --rpc flags.
Commands
| Command | What it does |
|---|
| INLINECODE6 | Store data on-chain (add --private for access control) |
| INLINECODE8 |
Read a data entry by ID |
|
verify | Verify data integrity (eip712 or hash method) |
|
grant-access | Grant read access to an address (private entries) |
|
revoke-access | Revoke read access |
|
register-type | Register a new data type (admin only) |
|
snapshot | Create a point-in-time snapshot |
|
info | Get entry info without full data |
Privacy Model
- - Public (default): Anyone can read via
getData(). Use for transparency, audit trails. - Private (
--private): Only the provider, granted addresses, and admin can read. Use for sensitive agent data.
Private entries store the same data on-chain but gate getData() access. Note: raw transaction calldata is still visible on-chain explorers. For maximum privacy, encrypt data before storing.
Use Cases for AI Agents
- 1. Memory attestation — Hash your MEMORY.md and store it periodically for tamper-proof audit trail
- Agent identity — Store model fingerprint, system prompt hash, config on-chain
- Verifiable outputs — Hash agent outputs and store for later verification
- Agent-to-agent trust — Check another agent's ERCData entries before trusting its data
- Model provenance — Store model hashes, benchmark scores, architecture metadata
API Reference
See references/api.md for full contract API, roles, events, and limits.
Requirements
- - Python 3.10+ with
web3 and eth-account packages (auto-installed by uv) - A funded wallet on Base mainnet (ETH for gas)
- PROVIDERROLE granted by contract admin for storing data
- VERIFIERROLE granted for verification operations
ERCData
在Base主网上存储和验证AI相关数据。支持公开或私有存储,并带有加密完整性证明。
快速开始
bash
存储公开数据
uv run {baseDir}/scripts/ercdata-cli.py store \
--type AI
AGENTMEMORY \
--data memory hash: abc123 \
--metadata {agent:MyBot,ts:2026-01-31} \
--key $ERCDATA
KEY --contract $ERCDATACONTRACT
存储私有数据(仅你本人和授权地址可读取)
uv run {baseDir}/scripts/ercdata-cli.py store \
--type AI
AGENTMEMORY \
--data secret memory data \
--private \
--key $ERCDATA
KEY --contract $ERCDATACONTRACT
读取条目
uv run {baseDir}/scripts/ercdata-cli.py read --id 1 --key $ERCDATA
KEY --contract $ERCDATACONTRACT
验证条目(EIP-712签名校验)
uv run {baseDir}/scripts/ercdata-cli.py verify --id 1 --method eip712 --key $ERCDATA
KEY --contract $ERCDATACONTRACT
授予私有条目访问权限
uv run {baseDir}/scripts/ercdata-cli.py grant-access --id 2 --to 0xSomeAddress --key $ERCDATA
KEY --contract $ERCDATACONTRACT
配置
通过环境变量或技能配置进行设置:
- - ERCDATAKEY — 用于签署交易的私钥(写入操作必需)
- ERCDATACONTRACT — Base主网上的合约地址
- ERCDATA_RPC — RPC URL(默认:https://mainnet.base.org)
或通过 --key、--contract、--rpc 参数传递。
命令
| 命令 | 功能说明 |
|---|
| store | 在链上存储数据(添加 --private 进行访问控制) |
| read |
按ID读取数据条目 |
| verify | 验证数据完整性(eip712或hash方法) |
| grant-access | 授予地址读取权限(私有条目) |
| revoke-access | 撤销读取权限 |
| register-type | 注册新的数据类型(仅管理员) |
| snapshot | 创建时间点快照 |
| info | 获取条目信息(不含完整数据) |
隐私模型
- - 公开(默认): 任何人都可通过 getData() 读取。适用于透明度和审计追踪。
- 私有(--private): 仅提供者、授权地址和管理员可读取。适用于敏感代理数据。
私有条目在链上存储相同的数据,但对 getData() 的访问进行控制。注意:原始交易调用数据在链上浏览器中仍然可见。如需最大隐私保护,请在存储前对数据进行加密。
AI代理用例
- 1. 内存证明 — 对MEMORY.md进行哈希处理并定期存储,实现防篡改审计追踪
- 代理身份 — 在链上存储模型指纹、系统提示哈希、配置信息
- 可验证输出 — 对代理输出进行哈希处理并存储,供后续验证
- 代理间信任 — 在信任其他代理的数据前,先检查其ERCData条目
- 模型溯源 — 存储模型哈希、基准测试分数、架构元数据
API参考
完整合约API、角色、事件和限制请参见 references/api.md。
要求
- - Python 3.10+,需安装 web3 和 eth-account 包(由uv自动安装)
- Base主网上有资金的钱包(ETH用于支付Gas费)
- 由合约管理员授予的PROVIDERROLE(用于存储数据)
- 用于验证操作的VERIFIERROLE