childstate_getStorageSize - Bittensor RPC Method
Get the byte length of a child storage value on Bittensor.
Returns the size in bytes of a value stored in a child trie. This is useful for checking whether a child storage entry exists and determining its size before fetching the full value, which can be helpful for resource planning and bandwidth management.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
childStorageKey | string | Yes | Hex-encoded key identifying the child trie root. |
key | string | Yes | Hex-encoded storage key within the child trie. |
blockHash | string | No | Hex-encoded block hash. Defaults to the best block if omitted. |
Response
| Field | Type | Description |
|---|---|---|
result | number or null | Size in bytes of the storage value, or null if the key does not exist in the child trie. |
Code Examples
Use Cases
- Existence check -- Determine whether a child storage key exists without fetching its value (returns
nullif absent). - Size estimation -- Estimate bandwidth and memory requirements before reading large child storage values.
- Storage monitoring -- Track the size of contract storage or other child trie entries over time.
Notes
- Child tries are used by pallets that isolate their storage. Most common Substrate storage lives in the main trie.
- The size returned is for the raw SCALE-encoded value, not the decoded value.
- Returns
nullfor non-existent keys rather than 0.
Related Methods
childstate_getStorage-- Read the actual value for a child storage keychildstate_getStorageEntries-- Batch-read multiple child storage valueschildstate_getStorageHash-- Get the hash of a child storage valuestate_getStorageSize-- Get the size of a main-trie storage value