offchain_localStorageSet - JSON-RPC Method
Description#
Stores a value in the node's offchain worker local storage. This RPC is primarily for debugging custom offchain logic and is typically restricted to validator operators running trusted infrastructure.
Parameters#
| Parameter | Type | Required | Description |
|---|---|---|---|
kind | string | Yes | Storage kind ("PERSISTENT" or "LOCAL") |
key | string | Yes | Hex-encoded key |
value | string | Yes | Hex-encoded SCALE-encoded value |
Request Example#
{
"jsonrpc": "2.0",
"method": "offchain_localStorageSet",
"params": [
"PERSISTENT",
"0x6d795f6f6666636861696e5f6b6579",
"0x01020304"
],
"id": 1
}
Response Example#
{
"jsonrpc": "2.0",
"result": null,
"id": 1
}
The call returns null on success. Read back the value using offchain_localStorageGet.
Notes#
- Only use this RPC on trusted nodes; writing arbitrary offchain values can influence custom logic executed by the node.
- Storage writes are not persisted across nodes—each node maintains its own offchain database.
- Combine with offchain worker metrics to validate job execution during staging deployments.