0

I read a Note in documentation of Solidity:

The type bytes1[] is an array of bytes, but due to padding rules, it wastes 31 bytes of space for each element (except in storage). It is better to use the bytes type instead.

I know that elements in memory always occupy multiples of 32 bytes, so each element of bytes1[] wastes 31 bytes. On the other hand, the bytes type is similar to bytes1[], but it is packed tightly in calldata and memory. Therefore, bytes in memory can store data in the same way as it does in storage? Can somebody explain more details about the difference between bytes and bytes1[]?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.