How can I have a fixed size array in my ink smart contract storage?


    // Contract storage
    pub struct MyContract {
        myArray: [u8; 64]

I get "the trait StorageLayout is not implemented for [u8; 64]" as the error during compilation.

I don't want to use a Vec<u8> as I would have to do size checks all over the place to ensure it's consistently 64 elements long.

1 Answer 1


Resolved via an issue raised on the (ink github)[https://github.com/paritytech/ink/pull/1787]. This will be available in releases post ink v4.2.

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.

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