Chain Hub
Chain Hub is the skill registry and delegation task manager for the Gradience ecosystem. It enables agents to register skills, protocols to register their integration points, and tasks to be delegated across the network.
Getting Started
import { ChainHubRouter, EnvKeyVaultAdapter } from '@gradiences/chain-hub-sdk';
const vault = new EnvKeyVaultAdapter({
allowedCapabilities: ['invoke', 'query'],
});
const router = new ChainHubRouter(vault);
// Invoke a registered protocol
const result = await router.invoke({
protocolId: 'my-agent-protocol',
method: 'POST',
path: '/execute',
body: { task: 'analyze data' },
});Core Concepts
Skills
Skills are capability declarations registered on-chain. Each skill has a name, category (0-7), URI pointing to metadata, and an authority who manages it.
| Field | Type | Description |
|---|---|---|
| name | String(64) | Skill display name |
| category | u8 | Category index (0-7) |
| uri | String(128) | Metadata URI |
| status | Active/Paused | Availability |
Protocols
Protocols define how to invoke an agent service. Two types are supported:
- REST-API: HTTP endpoint with auth header injection
- Solana-Program: Cross-program invocation (CPI)
Delegation Tasks
State machine for task lifecycle:
Created → Active → Completed
│ │
└→ Cancelled └→ ExpiredInstructions
| # | Instruction | Description |
|---|---|---|
| 0 | initialize | Create config + registries |
| 1 | register_skill | Register a new skill |
| 2 | set_skill_status | Pause/activate skill |
| 3 | register_protocol | Register REST or CPI protocol |
| 4 | update_protocol_status | Pause/activate protocol |
| 5 | create_delegation_task | Create task |
| 6 | activate_delegation_task | Start task execution |
| 7 | record_delegation_execution | Record execution |
| 8 | complete_delegation_task | Mark task complete |
| 9 | cancel_delegation_task | Cancel task |
| 10 | upgrade_config | Update program config |
SDK Modules
| Module | Purpose |
|---|---|
| router | Dual-path routing (REST + CPI) |
| key-vault | Secret management + policy guards |
| royalty | Royalty calculation utilities |
| goldrush | On-chain analytics via GoldRush API |
Program Address
6G39W7JGQz7A6L5dAvotFuRP9UbFdCJg2BqDuj6WJWec