I'm working on an ink! smart contract that will store the IPFS hash for each AccountId. I see that in EVM it's efficient to convert the hash to bytes32. What about in ink!, is Vec<u8> efficient enough?

pub struct MyContract {
    cids: Mapping<AccountId, Vec<u8>>,
  • I think we can also use Hash instead of Vec<u8>
    – go11li
    Commented Mar 4, 2023 at 5:16

1 Answer 1


Since the IPFS hash is fixed length (32 bytes), you can use [u8; 32] array instead of Vec<u8> which is more efficient.

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.