abklabs / svmkit

SVMKit is a operational toolchain for SVM
https://abklabs.com
GNU General Public License v3.0
7 stars 2 forks source link

Use Stake to Authorize SPE Validators #6

Open kespinola opened 2 months ago

kespinola commented 2 months ago

Overview

This proposal leverages the stake pool protocol to manage and evenly distribute stake among authorized validators. By controlling stake distribution, unauthorized validators are effectively blocked from participating in the network. This approach is only viable if the SPE is able to operate with zero transaction fees and rewards for validators. The network's native token should only be used for distributing stake.

Steps

  1. Centralized Stake Management:
    • The central authority manages all staking activities and oversees the stake pool.
    • Validators must be authorized by the central authority to receive stake.
  2. Stake Pool Protocol:
    • Creation and Management: The central authority creates a stake pool for managing and distributing stake.
    • Pool Tokens: Delegators deposit SOL into the stake pool and receive pool tokens representing their share.
  3. Automated Distribution:
    • Even Distribution: Ensure the stake is evenly distributed among all authorized validators.
    • Dynamic Adjustments: Regularly rebalance the stake to maintain even distribution as new validators are authorized or existing ones are revoked.
  4. Rebalance Logic:
    • Implement an algorithm to automatically adjust stake allocations to ensure even distribution.
   def rebalance_stake(stake_pool, validators):
       total_stake = stake_pool.total_stake
       num_validators = len(validators)
       target_stake_per_validator = total_stake / num_validators

       for validator in validators:
           current_stake = stake_pool.get_stake(validator)
           adjustment = target_stake_per_validator - current_stake
           if adjustment > 0:
               stake_pool.delegate_stake(validator, adjustment)
           elif adjustment < 0:
               stake_pool.undelegate_stake(validator, -adjustment)
  1. Disable Fees and Rewards:
    • Set transaction fees and validator rewards to zero in the genesis configuration.
    • Ensure the native token is only used for staking and does not leave the authority of the network.

Benefits

kespinola commented 2 months ago

For zumanet stake was manually distributed. No issues with network halting while the stake was being distributed.

@FarinM to add notes on setting bootstrapping cluster.

FarinM commented 1 month ago

Example of authorizing validators using stake manually

Creating a new stake account

Create new keypair solana-keygen new -o ~/validator-stake-keypair.json

Initialize stake account solana create-stake-account ~/validator-stake-keypair.json <SOL amount>

Delegating stake to vote account solana delegate-stake ~/validator-stake-keypair.json ~/vote-account-keypair.json

Alternatively, you can use the vote account's public key

Deactivating Stake

solana deactivate-stake ~/validator-stake-keypair.json