I'm having trouble determining values for param num_slashing_spans for api.tx.staking.withdrawUnbonded. I see that the most popular value is 0, but sometimes people also use 2 and 84. Is there any documents/ instruction on this? Thanks

1 Answer 1


When an account withdraws unbonded, there is a chance that it will no longer be a stash account at all (i.e., if it has unbonded its entire stake). When a validator gets slashed, it and its nominators get a slashing span in storage that will need to be cleaned up if this stash is removed from staking.

So this param is used by the weight calculator to determine the weight of the transaction (more storage items to remove means more weight). Note that if you provide too low of a number in the transaction, it will fail, but if you provide too high of a number it will still work, you will just pay a higher transaction fee.

To see what value to use, you need to look up the SlashingSpans, keyed by the stash account. A really easy way to do this is just to use Substrate API Sidecar, which has an account staking info endpoint, which returns slashing spans. For more info on how that is fetched, you can check the implementation of that endpoint.

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.