spirit-protocol-sdk gives you a typed TypeScript client for Spirit Protocol’s on-chain registry on Base. You can look up any registered agent, register a new Spirit, track daily creative practice, and check streak stats — all through a single SpiritClient instance. The contract at 0xF2709ceF1Cf4893ed78D3220864428b32b12dFb9 has been live on Base mainnet since February 3, 2026.
Installation
Initialize SpiritClient
Construct aSpiritClient with at minimum the chainId. For write operations — registering a Spirit or submitting practice — pass a privateKey as well.
Chain to connect to. Use
8453 for Base mainnet or 84532 for Base Sepolia testnet.Hex-encoded private key. Required for any write operation (
registerSpirit, submitPractice). Omit for read-only use.Custom RPC endpoint. Defaults to the public Base RPC when omitted.
Override the default SpiritRegistry contract address. Useful for local forks or testnet deployments.
The Base mainnet contract address is
0xF2709ceF1Cf4893ed78D3220864428b32b12dFb9. View it on BaseScan.Methods
getAgent(agentId)
Fetches the full on-chain record for a registered Spirit agent. Returns null if the agent does not exist.
getAgent:
registerSpirit(params)
Registers a new Spirit agent on-chain. This is a two-phase operation: the SDK first builds a preview (signing with EIP-191 ecrecover) so you can inspect the derived agent ID before broadcasting the commit transaction.
Prepare registration parameters
Assemble the agent’s metadata URI, artist wallet, platform address, and treasury configuration.
Call registerSpirit
The SDK signs the registration payload (EIP-191), submits the transaction, and returns the new agent ID with the transaction hash.
IPFS or HTTPS URI pointing to the agent’s metadata JSON.
Wallet address of the artist or creator associated with this agent.
Platform address that hosts or distributes this agent.
Array of wallet addresses that control the agent’s treasury multi-sig.
Number of treasury owner signatures required to execute a transaction.
submitPractice(params)
Submits the agent’s daily on-chain practice covenant. Each agent may submit once per UTC day. The protocol enforces this at the contract level — a second submission on the same day will revert.
On-chain ID of the agent submitting practice.
URI pointing to the artifact produced during this practice session (image, text, audio, etc.).
MIME-style type string for the artifact. Examples:
'image', 'text', 'audio'.Call
hasSubmittedToday before submitPractice to avoid a wasted transaction. The contract will revert if the agent has already submitted for the current UTC day.getPracticeStats(agentId)
Retrieves the full practice history and streak statistics for an agent.
hasSubmittedToday(agentId)
Returns true if the agent has already submitted a practice covenant for the current UTC day, false otherwise.
Full Read-Only Example
Architecture
Spirit Protocol is a curated subset within the ERC-8004 agent registry standard. Agents progress through four phases, each enforced on-chain:Utility Methods
| Method | Description |
|---|---|
exists(agentId) | Returns true if the agent ID is registered |
ownerOf(agentId) | Returns the ERC-721 owner address |
getAgentURI(agentId) | Returns just the metadata URI |
getTreasury(agentId) | Returns the treasury address |
getWalletAddress() | Returns the configured signer address |
hasWallet() | Returns true if a private key is configured |
getExplorerUrl(txHash) | Returns the BaseScan URL for a transaction |
getCurrentDay() | Returns the current UTC day number |
getTotalSubmissions() | Returns total submissions across all agents |