In my pallet, I am writing a function that checks if a user has some minimum amount of free balance, and if they do, proceed with the transaction by locking a DepositFee amount. I found that set_lock perfectly fits my use case however it asks for a LockIdentifier. What should I use here? Can it be any single name or does it have to be unique for each transaction made to this pallet function?

1 Answer 1


Every account may have up to one lock in place from each of up to MaxLocks identifiers at any time.

Your identifier should not be already used in any Substrate crate. A simple namespacing scheme would be to use your pallet's name or obviously identifiable parts thereof. E.g. the lock used for the Phragmen Elections pallet is "phrelect".

If your pallet may need to give a large number of independent locks for each account ID, then you will likely need to create a lock aggregation system within your pallet. For an example of this see update_lock in the Balances pallet.

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.