How z33mscessex/midnight-agent-registry works
This repository implements a Midnight agent registry and a demo discovery-to-paid-call workflow: an operator registers an agent and its price, a client discovers and checks its Agent Card, then pays through x402 and calls it with A2A. The registry API and contract provide the core on-chain record and ownership proofs; separate wallet utilities create and fund wallets. Major subsystems are included based on the README, but several demo and contract implementation relationships are documented there rather than verified from sampled source.
Main entry points: agent-b.ts Agent B client · index.ts Registry API · register-dust.ts DUST registration · providers.ts Chain providers
Components 22
Registry and identity
- Agent registration
registry/demo/register-agent-a.ts - Registry API
registry/api/index.ts - Registry types
registry/api/common-types.ts - Registry contract
registry/contract/registry.compact - Ownership witness
registry/contract/witnesses.ts - Chain providers
registry/src/providers.ts - Network config
registry/src/config.ts
Agent discovery
- Agent B client
registry/demo/agent-b.ts - Agent Card
Payment and invocation
- Agent A service
registry/demo/agent-a.ts - Midnight x402 scheme
registry/demo/midnight-x402.ts - Payment facilitator
registry/demo/facilitator.ts
Wallet operations
- Registry wallet
registry/src/wallet.ts - Wallet creation
wallet/src/create-wallet.ts - Seed storage
wallet/src/seed.ts - DUST registration
wallet/src/register-dust.ts - Wallet network config
wallet/src/config.ts
Other components
- Agent operator
- Midnight indexer
- A2A service
- Agent B operator
- Midnight network
Connections 25
- Agent operator → Agent registration: registers agent
README.md - Agent registration → Registry API: submits record
README.md - Registry API → Registry contract: calls circuits
registry/api/index.ts - Registry API → Registry types: uses types
registry/api/index.ts - Registry API → Midnight indexer: reads state
registry/api/index.ts - Registry API → Chain providers: uses providers
registry/src/providers.ts - Chain providers → Network config: uses config
registry/src/providers.ts - Chain providers → Midnight indexer: configures access
registry/src/providers.ts - Registry contract → Ownership witness: uses witness
- Agent B client → Midnight indexer: reads records
README.md - Agent B client → Agent Card: fetches and checks
README.md - Agent B client → Midnight x402 scheme: requests payment
README.md - Agent B client → A2A service: calls agent
README.md - A2A service → Agent A service: routes request
README.md - Agent A service → Midnight x402 scheme: requires payment
README.md - Midnight x402 scheme → Payment facilitator: submits proof
README.md - Payment facilitator → Midnight indexer: checks payer and price
README.md - Payment facilitator → Midnight network: claims payment
README.md - Agent B operator → Agent B client: starts workflow
README.md - Agent B client → Registry wallet: opens for payment
README.md - Wallet creation → Seed storage: loads or creates
wallet/src/create-wallet.ts - DUST registration → Seed storage: reads seed
wallet/src/register-dust.ts - DUST registration → Wallet network config: uses endpoints
wallet/src/register-dust.ts - Registry wallet → Midnight network: submits transactions
- DUST registration → Midnight network: registers token
README.md