For the complete documentation index, see llms.txt. This page is also available as Markdown.

offchain_localStorageGet - Midnight

Example code for the offchain_localStorageGet JSON-RPC method. Complete guide on how to use offchain_localStorageGet JSON-RPC in GetBlock Web3 documentation.

This method reads a value from the node's off-chain worker local storage. Off-chain workers can persist data here for use across runs. Local storage is per-node and not part of the on-chain state.

Parameters

Parameter
Type
Required
Description

kind

string

Yes

Storage kind: PERSISTENT (durable) or LOCAL (transient per-session)

key

string

Yes

Hex-encoded storage key

Request Example

curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "offchain_localStorageGet",
    "params": [
        "PERSISTENT",
        "0x6d795f6b6579"
    ],
    "id": "getblock.io"
}'

Response Example

Response Parameters

Field
Type
Description

result

string | null

Hex-encoded stored value, or null if the key is not set

Use Cases

  • Inspecting off-chain worker state during development

  • Reading cached data persisted by an off-chain worker

  • Debugging off-chain worker behaviour

Error Handling

Status Code
Error Message
Cause

403

Forbidden

Missing or invalid <ACCESS-TOKEN>

-32602

Invalid params

Request parameters are missing or malformed

429

Too Many Requests

Rate limit exceeded for your plan

SDK Integration

Last updated

Was this helpful?