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>
    – Ganesh11
    Mar 4 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 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.