Stake Validator
Detailed guide on stake validators including overview, use cases, and example Anvil API interactions for managing stake rewards.
Overview
Stake validators (also called reward validators) control access to staking rewards associated with script-controlled stake addresses. They determine when and how accumulated rewards can be withdrawn, enabling programmatic control over staking operations.
Real-world Use Cases
DAO Treasury Management: Automated governance of reward withdrawals based on DAO votes
Delegated Staking Pools: Programmatically manage stake delegation and reward distribution
Reward Distribution Systems: Automate the fair distribution of staking rewards among multiple parties
Conditional Reward Access: Restrict reward withdrawals based on time, market conditions, or other parameters
Required Fields for Reward Withdrawals
PREREQUISITE: DEPLOYED SMART CONTRACT
Before you can interact with any validator, you must have a compiled and deployed smart contract blueprint. The validator hash used in these examples comes from your deployed blueprint.
Stake Validator API Interaction Example
Use the below examples to build transactions that interact with withdraw validators.
1. Registering a Script-Controlled Stake Address
2. Withdrawing Rewards from a Script-Controlled Stake Address
Important Technical Notes
Stake Address Lifecycle
Registration: Script-controlled stake addresses must be registered before they can receive rewards
Delegation: After registration, ADA must be delegated to a stake pool
Rewards Accrual: Rewards begin accruing after 2-3 epochs (10-15 days)
Withdrawal: Rewards can be withdrawn using the withdraw validator
Security Considerations
The redeemer is the only way to pass parameters to the validator
Include proper authorization checks in your validator logic
Consider time-locking or multi-signature requirements for high-value treasuries
Performance Optimization
Consider batching multiple reward withdrawals in a single transaction when possible
See Examples
Last updated
Was this helpful?