Skip to main content

state_getMetadata - JSON-RPC Method

Description#

Retrieves the SCALE-encoded runtime metadata for Enjin Matrix. SDKs and indexers decode this blob to discover pallets, storage items, extrinsics, and RPC interfaces. Refresh metadata whenever state_getRuntimeVersion reports a higher specVersion.

Parameters#

ParameterTypeRequiredDescription
blockHashstring | nullNoBlock hash for historical metadata; null returns the latest

Returns#

FieldTypeDescription
resultstringHex-encoded SCALE metadata blob

Request Example#

{
"jsonrpc": "2.0",
"method": "state_getMetadata",
"params": [],
"id": 1
}

Response Example (truncated)#

{
"jsonrpc": "2.0",
"result": "0x6d6574610c02000053657373696f6e0008436f6e73656e737573...",
"id": 1
}

Code Examples#

curl https://api-enjin-matrixchain.n.dwellir.com/YOUR_API_KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "state_getMetadata",
"params": [],
"id": 1
}'

Implementation Notes#

  • Cache metadata keyed by specVersion to avoid redundant downloads across services.
  • When using Polkadot.js or SubXT, metadata is fetched automatically on connection, but manual retrieval is helpful for offline codegen.
  • Canary networks may expose new pallets ahead of mainnet—compare metadata diffs in staging before enabling features in production.