I'm new to ink! smart contracts, and trying to figure out how to set up my storage. I have a basic DAO. The DAO has members, and each member has a score (a u128) associated. So far a mapping sounds like the perfect thing.

Occasionally we will need the members sorted by their scores. I'm curious if it is practical to keep the data sorted in storage.

  • Which type are the scores set to?
    – forgetso
    Jul 11, 2023 at 13:52
  • @forgetso The score is a u128. I edited that into the question. Jul 11, 2023 at 16:06

1 Answer 1


If the DAO set is not too large, it would be best to use a BTreeMap.

Currently there is no ordered mapping available even in the pallet, IIRC.

  • I do not have proof for that (I work on this) but my best guess is that BTreeMap is not the best one if the cost usage matters. For demo/proof of concept, I agree that BTreeMap could be probably the best one. Jul 11, 2023 at 16:06

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.