A CLI tool to interact with Monad's staking contract and execute operations by interacting with it.
- Adding/Registering a Validator
- Delegating stake to a Validator
- Undelegating stake from a Validator
- Withdrawing pending undelegations using withdrawal IDs
- Claiming rewards
- Compounding rewards
- Changing Validator commission
- Querying staking state on the chain
- Please use hardware wallet for production environment
- Ledger wallets are supported and tested with
Ledger Nano S Plus
- Ledger wallets are supported and tested with
- Never commit your private key to version control
- Keep your config.toml file secure and private
- Use a funded address with sufficient balance for gas fees
- Python 3.8 or higher
- Git
- Access to a Monad RPC endpoint
- Private key with sufficient funds for transactions
- Clone the Repository
git clone https://github.com/monad-developers/staking-sdk-cli.git
cd staking-sdk-cli- Create a virtual environment and activate it
python -m venv cli-venv
source cli-venv/bin/activate # On Windows: cli-venv\Scripts\activate- Install project dependencies
pip install .To make changes to SDK code and have it reflected, use the pip install -e ..
- Fetch the latest commit on
mainbranch
cd staking-sdk-cli
git checkout main
git pull- Activate the virtual environment
source cli-venv/bin/activate # On Windows: cli-venv\Scripts\activate- Install project dependencies
pip install .- Make sure you are in a virtual environment with all dependencies installed as given in steps above to make a build successfully.
source cli-venv/bin/activate # On Windows: cli-venv\Scripts\activate
pip install pyinstaller- Run the pyinstaller command to create a spec
cd staking-cli
pyinstaller --additional-hooks-dir=./hooks --name monad-staking-cli --onedir --clean --noconfirm main.py- Create an executable
pyinstaller --noconfirm monad-staking-cli.spec- Execute the binary
./dist/monad-staking-cli/monad-staking-cli --helpThe folder dist/monad-staking-cli can be archived and distributed.
The default config path is config.toml
- Create and edit the configuration file
cp staking-cli/config.toml.example config.tomlThe stakin-cli tool supports two modes: CLI and TUI.
$ source cli-venv/bin/activate
$ python staking-cli/main.py --help
usage: main.py [-h]
{add-validator,delegate,undelegate,withdraw,claim-rewards,compound-rewards,change-commission,query,tui} ...
Staking CLI for Validators on Monad
positional arguments:
{add-validator,delegate,undelegate,withdraw,claim-rewards,compound-rewards,change-commission,query,tui}
add-validator Add a new validator to network
delegate Delegate to a validator in the network
undelegate Undelegate Stake from validator
withdraw Withdraw undelegated stake from validator
claim-rewards Claim staking rewards
compound-rewards Compound rewards to validator
change-commission Change validator commission
query Query network information
tui Use a menu-driven TUI
options:
-h, --help show this help message and exitInteractive Terminal User Interface mode for easier navigation.
$ source cli-venv/bin/activate
$ python staking-cli/main.py tui
╭────────── Staking Cli Menu ──────────╮
│ │
│ 1. Add Validator │
│ │
│ 2. Delegate │
│ │
│ 3. Undelegate │
│ │
│ 4. Withdraw │
│ │
│ 5. Claim Rewards │
│ │
│ 6. Compound │
│ │
│ 7. Change Commission │
│ │
│ 8. Query │
│ │
│ 9. Exit │
│ │
│ │
╰──────────────────────────────────────╯- See the Validator Onboarding for registering a new validator.
- See the Command Reference for more details.
- Setup: Create
config.tomlwith your details - Query: Check current validator set and epoch
- Delegate: Start with a small delegation to test
- Monitor: Query your delegation status
- Manage: Claim rewards, compound, or undelegate as needed
- All amounts are specified in MON units (not wei)
- Example:
--amount 1000= 1,000 MON tokens - The CLI automatically converts MON to wei for blockchain transactions
- SECP Private Key: 64 hexadecimal characters, without
0xprefix- Example:
a1b2c3d4e5f67890123456789abcdef0123456789abcdef0123456789abcdef
- Example:
- BLS Private Key: 64 hexadecimal characters, with
0xprefix- Example:
0x1a2b3c4d5e6f7890123456789abcdef0123456789abcdef0123456789abcdef
- Example:
- Validator registration: ~2M gas
- Delegation operations: ~1M gas
- The CLI automatically sets appropriate gas limits
If transactions fail with status 0:
- Check gas limits: Validator registration requires higher gas
- Verify amounts: Ensure minimum requirements are met
- Check network: Confirm RPC endpoint is accessible
- Validate keys: Ensure proper key formats
- "Invalid Validator ID": Use
query validator-setto see available validators - "Cannot withdraw yet": Wait for the required epoch delay
- "Insufficient funds": Ensure your address has enough MON for the operation
- "Key validation failed": Check key format and length
- Verify your RPC URL is correct and accessible
- Check if the network is experiencing downtime
- Ensure your internet connection is stable