Docs

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

ParameterTypeRequiredDescription
childStorageKeystringYesHex-encoded key identifying the child trie root.
keystringYesHex-encoded storage key within the child trie.
blockHashstringNoHex-encoded block hash. Defaults to the best block if omitted.

Response

FieldTypeDescription
resultnumber or nullSize 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 null if 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 null for non-existent keys rather than 0.