This offline checker handles one specific review task: inspect the account entries in a saved getMultipleAccounts response without decoding account data or contacting an RPC service. Solana documents that this method returns account state in request order and that its result contains a value array whose entries can be null. The checker labels entries by their zero-based position in that array; it does not infer account addresses that are not included in the saved response.
Before you start
- Intended runner: Python 3.12; no third-party packages or installation are required.
- Input must be a saved JSON response shaped like a JSON-RPC object with a result object containing a value array, or the same JSON supplied through stdin using the - argument.
- Owner validation checks only that owner is a non-empty string; lamports validation requires a non-negative Python integer and rejects booleans. It does not validate public-key syntax, decode account data, or verify the response against a request.
Build and check
- Save the code as check_accounts.py using Python 3.12.
- Save a getMultipleAccounts response as a local JSON file, or prepare it for stdin.
- Run the script with the file path or `-` to read stdin.
- Review the printed indices against the response value-array order; a null entry is reported rather than treated as a missing index.
- If the process exits nonzero, inspect stderr for input or response-shape errors, or the report for invalid account fields.
Limits to understand
- The zero-based index identifies an entry in result.value; the response alone may not provide the original requested public keys.
- This checks only response structure, owner string presence, and lamports type/range; it does not validate account data or establish that a response came from Solana.
- A syntactically valid JSON document can still be large or consume substantial parsing resources; use an appropriately bounded trusted local fixture.
- No timeout is needed because the script performs no network calls.
What this example adds
The method’s ordered value array becomes an easy-to-review JSON report: each entry retains its zero-based position, nulls are explicit, and malformed present accounts are marked invalid with reasons. Input and shape failures produce a diagnostic on stderr and a nonzero exit status; account-level validation failures still print the full report and also return nonzero. This is a local-file utility, not a Solana RPC client or a test of the external service.
Run it
Save the script as check_accounts.py, then run `python3.12 check_accounts.py saved-response.json`. To supply the saved response on stdin, run `python3.12 check_accounts.py - < saved-response.json`. The program performs no network requests, retries, or writes to files; it reads the chosen local input and writes its report to stdout.Example input
{"jsonrpc":"2.0","id":1,"result":{"context":{"slot":341197247},"value":[{"owner":"11111111111111111111111111111111","lamports":42,"data":["","base64"]},null,{"owner":"ExampleOwner","lamports":0}]}}Expected output
[
{
"index": 0,
"status": "valid",
"owner": "11111111111111111111111111111111",
"lamports": 42
},
{
"index": 1,
"status": "null"
},
{
"index": 2,
"status": "valid",
"owner": "ExampleOwner",
"lamports": 0
}
]
