Skip to content

Conversation

akrem-chabchoub
Copy link
Contributor

@akrem-chabchoub akrem-chabchoub commented Sep 1, 2025

PR Description: Implement Staking Feature for Bee Nodes

Implements: #517

Overview

This PR implements a comprehensive staking feature for Beekeeper that allows users to manage BZZ stakes on Bee nodes through a centralized CLI interface. The feature supports both Kubernetes namespace targeting and Beekeeper cluster targeting with parallel execution and robust error handling.

Changes

  • Added beekeeper stake deposit command to deposit BZZ stake on targeted Bee nodes
  • Added beekeeper stake get command to retrieve current stake amounts from targeted nodes
  • Added beekeeper stake withdraw command to withdraw (migrate) stake from targeted nodes
  • Implemented cluster mode targeting with --cluster-name flag
  • Implemented namespace mode targeting with --namespace and --label-selector flags
  • Added node group filtering with --node-groups flag (defaults to "bee" nodes)
  • Added parallel execution support with --parallel flag for better performance
  • Implemented comprehensive error handling with user-friendly messages
  • Added proper K8s client initialization with PreRunE for namespace mode
  • Refactored code to eliminate duplication and improve maintainability

Usage Examples

# Deposit 1000 WEI stake on all bee nodes in a cluster
beekeeper stake deposit --amount 1000 --cluster-name local-dns

# Get current stake amounts from nodes in a namespace
beekeeper stake get --namespace local --label-selector app=bee

# Withdraw stake from specific node groups
beekeeper stake withdraw --cluster-name local-dns --node-groups bee,light

# Use parallel execution for better performance
beekeeper stake deposit --amount 5000 --cluster-name local-dns --parallel 10

Technical Details

  • Uses existing pkg/bee/api/stake.go API endpoints
  • Leverages pkg/orchestration for cluster management
  • Integrates with pkg/node for namespace-based discovery
  • Utilizes math/big for precise WEI amount handling
  • Implements parallel processing with goroutines and channels
  • Provides comprehensive input validation and error handling

@akrem-chabchoub akrem-chabchoub changed the title feat(cmd): setup init stake cmd feat(cmd): implement staking command Sep 1, 2025
@akrem-chabchoub akrem-chabchoub marked this pull request as ready for review September 4, 2025 16:00
@akrem-chabchoub akrem-chabchoub self-assigned this Sep 29, 2025
@gacevicljubisa gacevicljubisa added the on hold Temporarily halted by other development label Oct 3, 2025
@bcsorvasi bcsorvasi linked an issue Oct 7, 2025 that may be closed by this pull request
@bcsorvasi bcsorvasi added this to the bee-v2.7.0 milestone Oct 7, 2025
@zsgsp zsgsp removed this from the bee-v2.7.0 milestone Oct 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

on hold Temporarily halted by other development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement Staking Feature for Bee Nodes

4 participants