I want to try and use Mapping with Sha2x256 or any other value that is large enough so that each of these will be unique.

I want mapping to be like this: unique_ids: Mapping <Sha2x256 ,u128>

Whenever I try to make Mapping <String, u128> I get an error "contract doesn't have a size known at compile-time"

So I'm trying anything else that can act as an unique id and will not repeat itself. It can be Sha2x256, Blake2s256 etc.

Does anyone have any advice?

1 Answer 1


You can't use String in ink! to store data because String processing comes with a lot of overhead and alternatively you can use Vec<u8> instead and if you really need String you can use ink_prelude::String view the link. You can go through this Question for further details

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.