Skip to content

Implement Staking Feature for Bee Nodes #517

@gacevicljubisa

Description

@gacevicljubisa

Feature Request: Implement Staking Feature for Bee Nodes

Description

Beekeeper currently supports various operations on Bee node clusters, such as funding, restarting, and managing postage stamps. To extend its capabilities for managing Swarm Bee nodes, I propose adding a new "staking" feature. This would allow users to stake BZZ on Bee nodes, retrieve current stake values, and unstake, all through Beekeeper's orchestration.

Implementing this in Beekeeper would streamline operations for cluster management, similar to how node-funder handles funding or stamper manages postage batches.

Proposed Functionality

Add a new top-level command stake with subcommands for the core operations:

  • beekeeper stake deposit : Stake a specified amount of BZZ in WEI on targeted nodes.
  • beekeeper stake get : Retrieve the current staked amount for targeted nodes.
  • beekeeper stake withdraw : Unstake (withdraw) from targeted nodes.

These operations should leverage the Bee debug API endpoints:

  • GET /stake: Retrieve staked amount.
  • POST /stake/{amount}: Deposit stake.
  • DELETE /stake: Withdraw stake.

Filtering should align with existing Beekeeper features:

  • Support targeting entire clusters defined in the Beekeeper config (e.g., via --cluster-name flag). Filter by node groups (e.g., --node-groups flag).
  • Support targeting entire Kubernetes namespace using label selectors (e.g., --label-selector flag, defaulting to something like app.kubernetes.io/name=bee, but customizable).

Operations should be parallelized where possible (e.g., using goroutines for concurrent API calls to multiple nodes), and include options for verbosity, and error handling (e.g., retry on failed API calls).

Reference Implementations

Simple bash scripts demonstrating the API interactions are available in the ethersphere/bee-scripts repo:

These scripts fetch node debug URLs via Kubernetes ingress and perform the CURL operations. Beekeeper could abstract this by integrating with its existing Kubernetes client and node discovery logic.

Benefits

  • Centralizes staking management in Beekeeper, reducing reliance on ad-hoc scripts.
  • Enables automated staking in integration tests or production clusters.

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions