RPC Reference
All Cocoon RPC methods are available via the standard JSON-RPC 2.0 interface at the backend proxy endpoint (http://localhost:8546 by default). Every method follows the same envelope format:
{
"jsonrpc": "2.0",
"id": 1,
"method": "namespace_methodName",
"params": [...]
}Standard Ethereum namespaces (eth_, net_, web3_) are also available and behave as per the Ethereum JSON-RPC specification.
All addresses are checksummed hex strings (0x...). All amounts are QUANTITY values (hex-encoded integers) unless otherwise noted. All hashes are DATA values (hex-encoded byte arrays).
token_ — Permissioned Tokens
token_ — Permissioned TokensThe token_ namespace provides the full lifecycle for ERC-3643 permissioned tokens: deployment, minting, transfers, compliance, NAV publishing, and document management.
Most write methods on this namespace require an authenticated session. Pass a valid bearer token in the Authorization header when calling the backend proxy, or set AUTH_MODE=advisory for development.
Deployment
token_deploy
token_deployDeploy a new ERC-3643 permissioned token contract.
Params
[deployParams: TokenDeployParams]
Returns
{ address: ADDRESS, txHash: HASH }
Minting and Burning
token_mint
token_mintMint tokens to a single address. Requires the caller to have the Operator or Admin role.
Params
[token: ADDRESS, to: ADDRESS, amount: QUANTITY]
Returns
{ txHash: HASH }
token_batchMint
token_batchMintMint tokens to multiple addresses in a single transaction.
Params
[token: ADDRESS, recipients: ADDRESS[], amounts: QUANTITY[]]
Returns
{ txHash: HASH }
token_burn
token_burnBurn tokens from an address. The caller must own the tokens or have an approved allowance.
Params
[token: ADDRESS, from: ADDRESS, amount: QUANTITY]
Returns
{ txHash: HASH }
Token Controls
token_pause
token_pausePause all transfers on a token. Only callable by the token owner.
Params
[token: ADDRESS]
Returns
{ txHash: HASH }
token_freeze
token_freezeFreeze transfers to or from a specific address.
Params
[token: ADDRESS, address: ADDRESS, frozen: boolean]
Returns
{ txHash: HASH }
token_forcedTransfer
token_forcedTransferExecute a forced transfer between two addresses, bypassing standard compliance checks. Requires Admin role. Used for regulatory recovery scenarios.
Params
[token: ADDRESS, from: ADDRESS, to: ADDRESS, amount: QUANTITY]
Returns
{ txHash: HASH }
token_recovery
token_recoveryRecover tokens from a lost wallet by transferring the full balance to a new address. Both the old and new addresses must have verified identities linked to the same investor record.
Params
[token: ADDRESS, lostWallet: ADDRESS, newWallet: ADDRESS, investorOnchainId: ADDRESS]
Returns
{ txHash: HASH }
token_canTransfer
token_canTransferDry-run a transfer to check whether compliance rules permit it, without submitting a transaction.
Params
[token: ADDRESS, from: ADDRESS, to: ADDRESS, amount: QUANTITY]
Returns
{ allowed: boolean, reason: string | null }
Investor Onboarding
token_onboardInvestor
token_onboardInvestorRegister an investor address against the token's identity registry. The investor must already have an on-chain identity (see id_createIdentity).
Params
[token: ADDRESS, investor: ADDRESS, identity: ADDRESS]
Returns
{ txHash: HASH }
token_getHolders
token_getHoldersReturn a paginated list of current token holders with their balances.
Params
[token: ADDRESS, offset?: QUANTITY, limit?: QUANTITY]
Returns
{ holders: [{ address: ADDRESS, balance: QUANTITY }], total: QUANTITY }
token_getHolder
token_getHolderReturn detailed information for a single holder.
Params
[token: ADDRESS, address: ADDRESS]
Returns
{ address: ADDRESS, balance: QUANTITY, frozen: boolean, identity: ADDRESS | null }
token_getTokenInfo
token_getTokenInfoReturn static and dynamic metadata for a token.
Params
[token: ADDRESS]
Returns
{ name: string, symbol: string, decimals: QUANTITY, totalSupply: QUANTITY, paused: boolean, owner: ADDRESS, compliance: ADDRESS, identityRegistry: ADDRESS }
NAV and Pricing
token_publishNAV
token_publishNAVPublish a new Net Asset Value for a fund token. The NAV is stored on-chain and used by subscription/redemption calculations.
Params
[token: ADDRESS, navPerShare: QUANTITY, timestamp: QUANTITY]
Returns
{ txHash: HASH }
token_publishPrice
token_publishPricePublish a generic price feed entry for a token (used for non-NAV instruments such as bonds or stablecoins with FX rates).
Params
[token: ADDRESS, price: QUANTITY, currency: string, timestamp: QUANTITY]
Returns
{ txHash: HASH }
token_getFeedHistory
token_getFeedHistoryRetrieve historical NAV or price feed entries.
Params
[token: ADDRESS, fromTimestamp: QUANTITY, toTimestamp: QUANTITY, limit?: QUANTITY]
Returns
{ entries: [{ value: QUANTITY, currency: string, timestamp: QUANTITY, txHash: HASH }] }
Compliance Modules
token_addComplianceModule
token_addComplianceModuleAttach a compliance module contract to a token. Modules are called on every transfer and can block or modify it.
Params
[token: ADDRESS, module: ADDRESS]
Returns
{ txHash: HASH }
token_setCountryAllowList
token_setCountryAllowListConfigure the country allow-list compliance module. Only investors with identity claims matching an allowed country code can hold the token.
Params
[token: ADDRESS, allowedCountryCodes: QUANTITY[]]
Returns
{ txHash: HASH }
token_setMaxBalance
token_setMaxBalanceSet the maximum token balance any single investor may hold.
Params
[token: ADDRESS, maxBalance: QUANTITY]
Returns
{ txHash: HASH }
Document Management
token_publishDocument
token_publishDocumentAttach a document to a token. The document content is stored via the torrent layer; only the content hash and metadata are stored on-chain.
Params
[token: ADDRESS, name: string, docType: string, uri: string, contentHash: HASH]
Returns
{ txHash: HASH, docId: HASH }
token_getDocument
token_getDocumentRetrieve a document record by ID.
Params
[token: ADDRESS, docId: HASH]
Returns
{ name: string, docType: string, uri: string, contentHash: HASH, publishedAt: QUANTITY }
token_listDocuments
token_listDocumentsList all documents attached to a token.
Params
[token: ADDRESS]
Returns
{ documents: [{ docId: HASH, name: string, docType: string, uri: string, publishedAt: QUANTITY }] }
Subscriptions and Redemptions
token_subscribe
token_subscribeSubscribe to a fund token by exchanging a stablecoin amount for token shares at the current NAV.
Params
[token: ADDRESS, stableAmount: QUANTITY]
Returns
{ txHash: HASH, sharesIssued: QUANTITY }
token_redeem
token_redeemRedeem token shares for the underlying stablecoin at the current NAV.
Params
[token: ADDRESS, shares: QUANTITY]
Returns
{ txHash: HASH, stableReturned: QUANTITY }
id_ — Identity
id_ — IdentityThe id_ namespace manages on-chain identities, claims, and claim access control using the OnchainID / ERC-734/735 standard.
id_createIdentity
id_createIdentityDeploy a new on-chain identity contract for an investor address.
Params
[owner: ADDRESS, managementKeys?: HASH[]]
Returns
{ identity: ADDRESS, txHash: HASH }
id_issueClaim
id_issueClaimIssue a signed claim to an identity. The caller must be a trusted claim issuer registered in the TrustedIssuersRegistry.
Params
[identity: ADDRESS, topic: QUANTITY, scheme: QUANTITY, data: DATA, uri: string]
Returns
{ claimId: HASH, txHash: HASH }
The topic field uses the ERC-735 claim topic registry. Common topics:
1
KYC/AML verification
2
Accredited investor status
3
Country of residence
4
Professional investor classification
101
Specific token eligibility
id_getClaim
id_getClaimRetrieve a claim by its ID.
Params
[identity: ADDRESS, claimId: HASH]
Returns
{ claimId: HASH, topic: QUANTITY, scheme: QUANTITY, issuer: ADDRESS, data: DATA, uri: string, signature: DATA }
id_grantClaimAccess
id_grantClaimAccessGrant a third party (e.g. a regulator or auditor) read access to an encrypted claim document stored via the torrent layer.
Params
[identity: ADDRESS, claimId: HASH, grantee: ADDRESS, encryptedKey: DATA]
Returns
{ txHash: HASH }
id_revokeClaim
id_revokeClaimRevoke a previously issued claim.
Params
[identity: ADDRESS, claimId: HASH]
Returns
{ txHash: HASH }
id_getIdentity
id_getIdentityLook up the on-chain identity address for a wallet address.
Params
[address: ADDRESS]
Returns
{ identity: ADDRESS | null, owner: ADDRESS | null }
auth_ — Authorization
auth_ — AuthorizationThe auth_ namespace exposes the UCAN capability system. UCAN delegations are encoded as JWTs and attached to transactions via EIP-8141 frame envelopes.
auth_createDelegation
auth_createDelegationCreate a UCAN capability delegation, granting an audience address the ability to invoke specified methods on behalf of the issuer.
Params
[issuer: ADDRESS, audience: ADDRESS, capabilities: Capability[], expiration?: QUANTITY]
Returns
{ delegation: string, cid: HASH }
auth_verify
auth_verifyVerify that a delegation JWT is valid, unexpired, and not revoked.
Params
[delegation: string]
Returns
{ valid: boolean, issuer: ADDRESS, audience: ADDRESS, capabilities: Capability[], expiration: QUANTITY | null }
auth_inspect
auth_inspectDecode and return the contents of a delegation JWT without verifying chain or revocation status.
Params
[delegation: string]
Returns
{ issuer: ADDRESS, audience: ADDRESS, capabilities: Capability[], expiration: QUANTITY | null, notBefore: QUANTITY | null }
auth_revoke
auth_revokeRevoke a previously issued delegation. Writes the delegation CID to the on-chain revocation registry.
Params
[cid: HASH]
Returns
{ txHash: HASH }
qm_ — QMTree State
qm_ — QMTree StateThe qm_ namespace exposes the QMTree Merkle state commitment. QMTree is the core data structure used to generate ZK proofs and verify state transitions.
qm_getRoot
qm_getRootReturn the current QMTree root hash at a given block.
Params
[blockNumber?: QUANTITY]
Returns
{ root: HASH, blockNumber: QUANTITY, txNum: QUANTITY }
qm_getLeaf
qm_getLeafReturn the value and position of a leaf node in the QMTree.
Params
[key: DATA, blockNumber?: QUANTITY]
Returns
{ key: DATA, value: DATA, leafIndex: QUANTITY, twig: HASH }
qm_getProof
qm_getProofReturn a Merkle inclusion proof for a leaf node.
Params
[key: DATA, blockNumber?: QUANTITY]
Returns
{ proof: HASH[], root: HASH, leafIndex: QUANTITY, value: DATA }
qm_call
qm_callExecute a read-only contract call against the QMTree state at a given root (without requiring the full chain state). Used for off-chain verification workflows.
Params
[to: ADDRESS, data: DATA, root: HASH]
Returns
{ result: DATA }
qm_callProof
qm_callProofExecute a contract call and return both the result and a proof of correct execution against the given QMTree root.
Params
[to: ADDRESS, data: DATA, root: HASH]
Returns
{ result: DATA, proof: ExecutionProof }
qm_verifyProof
qm_verifyProofVerify an execution proof against a given QMTree root without re-executing the call.
Params
[root: HASH, proof: ExecutionProof]
Returns
{ valid: boolean }
qm_getKeyProof
qm_getKeyProofReturn a proof of the current value bound to a key, suitable for use in a SNARK circuit.
Params
[key: DATA, blockNumber?: QUANTITY]
Returns
{ proof: HASH[], root: HASH, key: DATA, value: DATA }
qm_getExclusionProof
qm_getExclusionProofReturn a proof that a key does not exist in the QMTree (non-membership proof).
Params
[key: DATA, blockNumber?: QUANTITY]
Returns
{ proof: HASH[], root: HASH, key: DATA }
proof_ — ZK Proofs
proof_ — ZK ProofsThe proof_ namespace manages ZK proof generation, batching, and status queries. Proofs are generated by the Zilkworm prover and posted to Ethereum by the proof pipeline.
proof_getProof
proof_getProofReturn the ZK proof for a specific block.
Params
[blockNumber: QUANTITY]
Returns
{ blockNumber: QUANTITY, proof: DATA, status: ProofStatus, postedAt: QUANTITY | null, ethTxHash: HASH | null }
ProofStatus values: pending, generating, ready, posted, failed.
proof_getProofStatus
proof_getProofStatusReturn only the status of a proof, without the proof data itself.
Params
[blockNumber: QUANTITY]
Returns
{ blockNumber: QUANTITY, status: ProofStatus, generatedAt: QUANTITY | null }
proof_getBatchProof
proof_getBatchProofReturn the aggregate ZK proof for a batch of blocks.
Params
[fromBlock: QUANTITY, toBlock: QUANTITY]
Returns
{ fromBlock: QUANTITY, toBlock: QUANTITY, proof: DATA, root: HASH, status: ProofStatus }
proof_getLatestProved
proof_getLatestProvedReturn the block number and state root of the most recently proved (and Ethereum-posted) block.
Params
[]
Returns
{ blockNumber: QUANTITY, stateRoot: HASH, ethTxHash: HASH, postedAt: QUANTITY }
erigon_ — Storage and WebF Extensions
erigon_ — Storage and WebF ExtensionsThe erigon_ namespace exposes Cocoon's extended storage and web hosting capabilities: torrent-backed document storage and on-chain web site publishing via WebF.
Torrent Storage
erigon_resolveTorrent
erigon_resolveTorrentResolve a torrent-ccip content reference to its current download metadata.
Params
[infoHash: HASH]
Returns
{ infoHash: HASH, name: string, files: [{ name: string, size: QUANTITY, path: string }], trackers: string[], magnetURI: string }
erigon_publishTorrent
erigon_publishTorrentPublish a new torrent and write its on-chain content reference. The file data must be accessible to the node's torrent storage backend.
Params
[files: [{ name: string, data: DATA }], announce?: string[]]
Returns
{ infoHash: HASH, magnetURI: string, txHash: HASH }
erigon_getInscription
erigon_getInscriptionRetrieve an on-chain inscription (small content blob written directly into a transaction's calldata via EIP-8141 frame).
Params
[txHash: HASH]
Returns
{ txHash: HASH, contentType: string, data: DATA, size: QUANTITY }
WebF — On-Chain Web Hosting
erigon_publishWebSite
erigon_publishWebSitePublish a static web site by bundling its files into a torrent and writing the content root on-chain. The site is then accessible via the WebF gateway.
Params
[name: string, files: [{ path: string, data: DATA, contentType: string }], owner: ADDRESS]
Returns
{ siteId: HASH, infoHash: HASH, txHash: HASH, gatewayURL: string }
erigon_getWebSite
erigon_getWebSiteRetrieve metadata for a published web site.
Params
[siteId: HASH]
Returns
{ siteId: HASH, name: string, owner: ADDRESS, infoHash: HASH, publishedAt: QUANTITY, lastUpdated: QUANTITY, gatewayURL: string }
erigon_listWebSites
erigon_listWebSitesList all published web sites, optionally filtered by owner.
Params
[owner?: ADDRESS, offset?: QUANTITY, limit?: QUANTITY]
Returns
{ sites: [{ siteId: HASH, name: string, owner: ADDRESS, publishedAt: QUANTITY }], total: QUANTITY }
Error Codes
All methods return standard JSON-RPC errors. Cocoon-specific error codes:
-32001
TransferNotAllowed
A token_* write was blocked by a compliance rule. The message field contains the reason.
-32002
IdentityNotFound
The target address has no registered on-chain identity.
-32003
ClaimMissing
A required claim (KYC, accreditation, etc.) is absent or expired.
-32004
DelegationInvalid
A UCAN delegation is malformed, expired, or revoked.
-32005
ProofNotReady
The requested ZK proof has not been generated yet.
-32006
TorrentUnavailable
The requested torrent content is not available from any peer.
-32007
Unauthorized
The request lacks a valid session token and AUTH_MODE=strict is set.
Last updated