ListKMSContracts
GET /kms
ctx controls cancellation and request lifetime.
Returns: *ListKMSContractsResponse, a paginated list of KMSContract values, or an error.
Returns the available KMS contracts. This method always requests API version 2026-06-23.
KMSContract includes the contract ID, slug, contract address, chain ID, node count, K256Pubkey, and CAPubkey. For the off-chain Phala KMS, the contract address is "phala" and the chain ID is 0.
GetKMSContract
GET /kms/{slug}
ctx controls cancellation; slug accepts a contract slug or kc_-prefixed contract ID.
Returns: *KMSContract for the resolved contract, or an error.
Returns one KMS contract by slug. A kc_-prefixed contract ID also resolves.
ListKMSContractNodes
GET /kms/{slug}/nodes
ctx controls cancellation; slug accepts a contract slug or kc_-prefixed contract ID.
Returns: *ListKMSContractNodesResponse with the contract’s node replicas, or an error.
Returns the KMS node replicas under a contract, including each node’s RPC URL and version.
Legacy node methods
GetKMSList takes a request context. GetKMSInfo also requires a KMS node ID or slug. They return the earlier node-centric KMS shapes or an error.
Both methods are deprecated and remain pinned to API version 2026-05-22.
Use ListKMSContracts, GetKMSContract, and ListKMSContractNodes for new code.
GetAppEnvEncryptPubKey
GET /kms/{kmsType}/pubkey/{appId}
ctx controls cancellation, kmsType is a KMS node ID or slug, and appID is the app ID.
Returns: *AppEnvPubKeyResponse containing the public key response, or an error.
Returns the public key used to encrypt environment variables for an app.
NextAppIDs
GET /kms/phala/next_app_id
ctx controls cancellation and request lifetime.
Returns: *NextAppIDsResponse with the reserved app IDs, or an error.
Reserves app IDs from the Phala KMS for deterministic provisioning.
GetKMSOnChainDetail
GET /kms/on-chain/{chain}
ctx controls cancellation; chain is the chain name, such as "base" or "ethereum".
Returns: *KMSOnChainDetail with the chain and its KMS contracts, or an error.
Returns the contracts, registered devices, OS images, and verification anchors for an on-chain KMS.
Compute a compose hash
GetComposeHash normalizes an AppCompose before hashing by default. Pass false as the second argument to hash the typed compose without normalization. This default differs from older SDK behavior.
AppCompose models only a subset of fields. For a complete decoded document, use GetComposeHashFromMap; it normalizes a copy without changing the input. Decode JSON with json.Decoder.UseNumber to preserve numeric values. DumpAppComposeFromMap returns the normalized canonical JSON used for hashing. These two hash manifest_version and init_script as given. To get the hash Phala Cloud computes for a CVM, use GetComposeHashFromMapForOSImage (or DumpAppComposeFromMapForOSImage) with the CVM’s OS image version, for example "0.6.0": below 0.6.0 the compose carries manifest_version 2 and a single init_script string, from 0.6.0 manifest_version “3” and a list.
Compute and verify mr_config_id
UseGetMrConfigIdHex when your inputs are hex strings:
KeyProviderKMS, set kpIDHex to the contract’s K256Pubkey, not its CAPubkey.
GetMrConfigId for fixed-size byte inputs and GetMrConfigIdV1 for the V1 compose-hash-only format.

