Solidity Storage Values Analysis
Data Byte Sizes
Reference: https://tomatosauce.jp/datatype-bytesize/
In Solidity, each data type has the following size:
Type
Bytes
bool
1
bytes1
1
bytes8
8
bytes16
16
bytes32
32
address
20
contract
20
uint8/int8
1
uint16/int16
2
uint32/int32
4
uint64/int64
8
uint128/int128
16
uint256/int256
32
Access Storage Slot Values
Reference: https://coinsbench.com/12-privacy-ethernaut-explained-8ee480f303f2
Below is the Solidity contract example.
The Solidity’s each slot can store data until 32 bytes. For example below, the ‘Slot 2’ stores multiple variables because each value is just 1 byte, which are 2 bytes in total so less than 32 bytes.
Using Web3.js, we can get values of the above variables from outside.
Display Values
There are methods to see the storage slot values in appropriate format.
Last updated