The trc8004-m2m Python package provides a high-level interface for interacting with all four TRC-8004 registries on TRON. Hybrid architecture: blockchain for trust, API for performance.
Or with development dependencies:
Create an AgentRegistry instance to interact with the contracts. A private key is only needed for write operations.
Register an agent on-chain. The SDK handles IPFS metadata upload and on-chain minting in a single call.
The Identity Registry is an ERC-721 contract for agent ownership. Each agent is minted as an NFT with a metadata URI.
Submit validation requests and respond to them. The contract records a request/complete/reject/cancel workflow with no on-chain numeric score.
Submit sentiment-based feedback for agents. Sentiment is an enum: Neutral (0), Positive (1), Negative (2). Feedback text is stored on-chain.
Query the indexed database for fast search and analytics.
Use the built-in Agent Protocol client for inter-agent interaction. Discover agents by skill, connect to their endpoints, and execute tasks.
The SDK supports loading data from multiple protocols — IPFS, HTTPS, and local files (for testing).
Override the default contract addresses if you've deployed custom registries.
The SDK provides typed exceptions for different failure modes.
The SDK uses a hybrid architecture. Writes go to the blockchain (trustless, verifiable). Reads come from the indexed API (fast, rich queries).
┌─────────────────────────────────────────────┐
│ Your Application │
└──────────────┬──────────────────────────────┘
│
│ TRC-8004-M2M SDK
│
┌────────┴────────┐
│ │
┌─────▼──────┐ ┌─────▼─────────┐
│ TRON Chain │ │ Registry API │
│ │ │ (PostgreSQL) │
│ - NFTs │ │ │
│ - Events │ │ - Fast search │
│ - Immutable│ │ - Analytics │
└────────────┘ └───────────────┘Data flow: