Size of the state

How would I go about measuring the size of the state that is being used for storage of the current contract? I have the idea to iterate through the state tree using the host functions, but what is the root prefix of the current contract? Is it 0?

You can get the entire state of the contract using GetInstanceState GRPC V2 endpoint.

See for an example, which also outputs the size of the state.

The state root is currently at the empty key &[]

1 Like