Skip to main content

state_call - JSON-RPC Method

Description#

Invokes a runtime API exposed by the Enjin Matrix runtime. Calls are executed against the node's current state and return SCALE-encoded responses. Typical uses include querying the runtime metadata (Metadata_metadata), fetching session information, or invoking custom APIs without submitting extrinsics.

Parameters#

ParameterTypeRequiredDescription
methodstringYesName of the runtime API function (e.g., Metadata_metadata)
datastringYesHex-encoded SCALE input payload
blockHashstring | nullNoBlock hash for historical calls

Returns#

FieldTypeDescription
resultstringSCALE-encoded return value

Request Example#

{
"jsonrpc": "2.0",
"method": "state_call",
"params": [
"Metadata_metadata",
"0x",
null
],
"id": 1
}

Response Example (truncated)#

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

The response is the same SCALE blob returned by state_getMetadata and can be decoded with the same tooling.

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_call",
"params": ["Metadata_metadata", "0x", null],
"id": 1
}'

Tips#

  • Ensure inputs are SCALE-encoded. Many runtime APIs expect tuples or composites; consult metadata to build the payload.
  • Blocking methods may be disabled on public RPC endpoints; run against a trusted node when invoking privileged APIs.
  • Combine with state_callAt (via blockHash) to inspect past runtime behaviour.