4

Anchor requires the allotment of 1 byte of space for a boolean value even though only 1 bit is required. Is there a way to use only 1 bit for booleans while still using Anchor for the serialization/deserialization?

0

1 Answer 1

2

You can't - Solana charges rent in lamports per byte-year, meaning the minimum amount of storage you can rent is one byte anyway. More info on rent can be found here.

Additionally, even if you could, I wouldn't recommend it: I assume you have other data types as well whose size you measure in bytes. Measuring some data types' size in bytes and some others' size in bits, makes serialization/deserialization significantly more error prone (which is also why I'd assume Solana made the above design decision in the first place).

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.