Skip to content

Conversation

@Mobile-Crest
Copy link
Contributor

Ask Amount for Each Subnet When Staking to Multiple

Summary

Implements per-subnet amount prompting when staking to multiple netuids, improving user control and transparency over stake distribution.

Changes

CLI (bittensor_cli/cli.py)

  • When multiple netuids are provided (e.g., --netuids 1,2,3), the CLI now prompts for an amount for each subnet individually
  • Each prompt displays the remaining balance after previous stakes
  • Single netuid behavior remains unchanged
  • Empty/None netuids (all subnets) continues to ask for a single amount per netuid

Stake Add Function (src/commands/stake/add.py)

  • Updated function signature to accept amount: Union[float, list[float]]
  • Added logic to handle both single amounts and per-netuid amount lists
  • Maintains backward compatibility with existing single-amount behavior

Example Usage

Before:

btcli stake add --netuids 1,2,3
# Prompted once: "Amount to stake (TAO τ)"
# Same amount applied to all subnets

After:

btcli stake add --netuids 1,2,3
# Prompted for each:
# "Amount to stake to netuid 1 (TAO τ) (remaining balance: 100.0)"
# "Amount to stake to netuid 2 (TAO τ) (remaining balance: 90.0)"
# "Amount to stake to netuid 3 (TAO τ) (remaining balance: 80.0)"

Contribution by Gittensor, learn more at https://gittensor.io/

@Mobile-Crest
Copy link
Contributor Author

@thewhaleking
can you please check this pull request when you get a chance? thanks

@ibraheem-abe
Copy link
Contributor

@Mobile-Crest Some e2e coverage will be good for this. Maybe add this behaviour in the current add_stake test we have

@Mobile-Crest
Copy link
Contributor Author

Mobile-Crest commented Dec 19, 2025

@Mobile-Crest Some e2e coverage will be good for this. Maybe add this behaviour in the current add_stake test we have

is it possible to e2e test user prompt?

@Mobile-Crest Mobile-Crest marked this pull request as draft December 20, 2025 17:00
@Mobile-Crest Mobile-Crest marked this pull request as ready for review December 20, 2025 17:49
Copy link
Contributor

@thewhaleking thewhaleking left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very silly to have --amount AND --amounts that do nearly-identical-but-different things. Look at how similar items are done throughout this file.

@Mobile-Crest
Copy link
Contributor Author

This is very silly to have --amount AND --amounts that do nearly-identical-but-different things. Look at how similar items are done throughout this file.

we already have --netuid and --netuids,
I thought they pair each other

@thewhaleking
Copy link
Contributor

This is very silly to have --amount AND --amounts that do nearly-identical-but-different things. Look at how similar items are done throughout this file.

we already have --netuid and --netuids, I thought they pair each other

In stake add, --netuid is simply an alias of --netuids. They are a single arg, much like --wallet-path and -p.

@Mobile-Crest
Copy link
Contributor Author

Mobile-Crest commented Dec 22, 2025

This is very silly to have --amount AND --amounts that do nearly-identical-but-different things. Look at how similar items are done throughout this file.

we already have --netuid and --netuids, I thought they pair each other

In stake add, --netuid is simply an alias of --netuids. They are a single arg, much like --wallet-path and -p.

then should I make amount an alias of amounts arg?
if multiple netuids and single amount, apply same amount to those subnets
if multiple netuids and multiple amounts, apply corresponding amount, but item length must be same

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants