Exiting the Staking Protocol

Exiting the staking protocol involves either unstaking your STRK tokens as a validator or undelegating your stake as a delegator. Both processes require you to first signal your intent to exit, followed by an action to finalize the process after a waiting period.

Unstaking as a Validator

Validators can unstake their STRK tokens, which involves pausing rewards and exiting the staking contract.

Prerequisites
  • The validator must not currently be in the unstake process.

Procedure
  1. Signal Unstake Intent:

    1. Using a Starknet block explorer, navigate to the staking contract.

    2. In the contract interface, locate and select the unstake_intent function.

    3. Submit the transaction to initiate the unstake process. This will record the unstake intent, pause rewards collection, and set a waiting period.

  2. Finalize Unstake:

    1. After the waiting period has passed, return to the staking contract.

    2. In the contract interface, locate and select the unstake_action function.

    3. Enter the following parameters:

      • In staker_address, enter the validator’s address.

    4. Submit the transaction to finalize the unstaking process and transfer the staked STRK tokens back to the validator’s account.

Any address can initiate the unstake_action function once the waiting period has passed.

Ensure that enough time has passed since signaling your unstake intent. If the waiting period has not expired, the unstake_action function will fail.

Undelegating as a Delegator

Delegators can undelegate part or all of their stake from a validator’s delegation pool by following a similar process. The amount parameter determines how much of the stake will be undelegated, and it must be less than or equal to the total delegated amount.

Prerequisites
  • A Starknet-compatible block explorer or CLI tool.

  • The delegator must not currently be in the undelegation process.

  • The contract address of the delegation pooling contract.

Procedure
  1. Signal Undelegation Intent:

    1. Using a Starknet block explorer, navigate to the delegation pooling contract.

    2. In the contract interface, locate and select the exit_delegation_pool_intent function.

    3. Enter the amount parameter, which determines the size of the undelegation. The amount must be less than or equal to your total delegated amount.

    4. Submit the transaction to initiate the undelegation process. This will record the undelegation intent for the specified amount, pause rewards collection, and set a waiting period.

  2. Finalize Undelegation:

    1. After the waiting period has passed, return to the delegation pooling contract.

    2. In the contract interface, locate and select the exit_delegation_pool_action function.

    3. Enter the following parameters:

      • In pool_member, enter the delegator’s address.

    4. Submit the transaction to finalize the undelegation process and transfer the undelegated STRK tokens (based on the amount previously specified) back to the delegator’s account.

Any address can initiate the exit_delegation_pool_action function once the waiting period has passed.

Ensure that enough time has passed since signaling your undelegation intent. If the waiting period has not expired, the exit_delegation_pool_action function will fail. Additionally, ensure the amount provided in the initial intent matches the intended undelegation size.

Additional Notes

  • When a validator unstakes, any unclaimed rewards are automatically transferred to the reward address before the stake is returned.

  • Similarly, when a delegator undelegates, any unclaimed rewards are automatically transferred to the delegator’s reward address.

For more details on the staking and delegation processes, see Staking Contract Architecture.