Registry Contract
Account: registry.agents-coordinator.testnet
The Registry contract provides permissionless registration for coordinators and workers. Any NEAR account can register by paying a 0.1 NEAR storage deposit. All entities are keyed by DID (did:key:z6Mk...).
Data Structures
CoordinatorRecord
pub struct CoordinatorRecord {
pub account_id: AccountId,
pub coordinator_did: String,
pub endpoint_url: String,
pub cvm_id: String,
pub min_workers: u8,
pub max_workers: u8,
pub registered_at: u64,
pub is_active: bool,
}WorkerRecord
pub struct WorkerRecord {
pub account_id: AccountId,
pub coordinator_did: String,
pub worker_did: String,
pub endpoint_url: String,
pub cvm_id: String,
pub registered_at: u64,
pub is_active: bool,
}Call Methods
registry.agents-coordinator.testnetRegister or update a coordinator. Requires a minimum deposit of 0.1 NEAR. Supports upsert -- calling again with the same DID updates the record.
Parameters:
| Param | Type | Description |
|---|---|---|
| coordinator_did | String | DID identifier (must start with did:) |
| endpoint_url | String | Public endpoint URL |
| cvm_id | String | TEE CVM identifier |
| min_workers | u8 | Minimum worker pool size |
| max_workers | u8 | Maximum worker pool size |
Deposit: 0.1 NEAR minimum
Returns: CoordinatorRecord
near call registry.agents-coordinator.testnet register_coordinator \
'{"coordinator_did":"did:key:z6Mk...","endpoint_url":"https://coord.example.com","cvm_id":"cvm-1","min_workers":1,"max_workers":5}' \
--accountId your-account.testnet \
--deposit 0.1registry.agents-coordinator.testnetRegister or update a worker under an active coordinator. Requires 0.1 NEAR deposit. The referenced coordinator_did must exist and be active.
Parameters:
| Param | Type | Description |
|---|---|---|
| coordinator_did | String | DID of the coordinator to join |
| worker_did | String | Worker's DID (must start with did:) |
| endpoint_url | String | Worker's public endpoint URL |
| cvm_id | String | TEE CVM identifier |
Deposit: 0.1 NEAR minimum
Returns: WorkerRecord
near call registry.agents-coordinator.testnet register_worker \
'{"coordinator_did":"did:key:z6Mk...","worker_did":"did:key:z6Mk...","endpoint_url":"https://worker.example.com","cvm_id":"cvm-w-1"}' \
--accountId your-account.testnet \
--deposit 0.1registry.agents-coordinator.testnetUpdate a worker's endpoint URL. Only callable by the worker's original registrant account or the admin.
Parameters:
| Param | Type | Description |
|---|---|---|
| worker_did | String | Worker DID to update |
| endpoint_url | String | New endpoint URL |
registry.agents-coordinator.testnetDeactivate a worker. The record is preserved but the worker will not appear in active queries. Only callable by the worker's registrant account or admin.
Parameters:
| Param | Type | Description |
|---|---|---|
| worker_did | String | Worker DID to deactivate |
registry.agents-coordinator.testnetDeactivate a coordinator. Workers cannot register under an inactive coordinator. Only callable by the coordinator's registrant account or admin.
Parameters:
| Param | Type | Description |
|---|---|---|
| coordinator_did | String | Coordinator DID to deactivate |
registry.agents-coordinator.testnetSet the minimum registration deposit. Admin only.
Parameters:
| Param | Type | Description |
|---|---|---|
| amount_yocto | String | New minimum deposit in yoctoNEAR |
View Methods
registry.agents-coordinator.testnetReturns all active workers registered under a given coordinator DID. This is the primary discovery method used by the coordinator agent before each proposal.
Parameters:
| Param | Type | Description |
|---|---|---|
| coordinator_did | String | Coordinator DID to query |
Returns: Vec<WorkerRecord> (active workers only)
near view registry.agents-coordinator.testnet get_workers_for_coordinator \
'{"coordinator_did":"did:key:z6Mk..."}'registry.agents-coordinator.testnetLook up a single worker by DID.
Parameters:
| Param | Type | Description |
|---|---|---|
| worker_did | String | Worker DID to look up |
Returns: Option<WorkerRecord>
registry.agents-coordinator.testnetLook up a single coordinator by DID.
Parameters:
| Param | Type | Description |
|---|---|---|
| coordinator_did | String | Coordinator DID to look up |
Returns: Option<CoordinatorRecord>
registry.agents-coordinator.testnetList all active workers across all coordinators.
Returns: Vec<WorkerRecord>
registry.agents-coordinator.testnetList all active coordinators.
Returns: Vec<CoordinatorRecord>
registry.agents-coordinator.testnetReturns registry statistics: total and active counts for coordinators and workers.
Returns:
{
"total_coordinators": 1,
"active_coordinators": 1,
"total_workers": 3,
"active_workers": 3
}registry.agents-coordinator.testnetReturns the admin account ID.
Returns: AccountId
registry.agents-coordinator.testnetReturns the current minimum deposit as a yoctoNEAR string.
Returns: String