Claiming Rewards
Overview
Sequencer rewards accumulate in the Rollup contract but are not automatically distributed. You must manually claim them by calling the Rollup contract. This guide shows you how to check pending rewards and claim them using Foundry's cast command.
Prerequisites
Before proceeding, you should:
- Have a running sequencer that earned rewards (see Sequencer Setup Guide)
- Have Foundry installed with the
castcommand available (installation guide) - Know your Rollup contract address (see Useful Commands)
- Have your sequencer's coinbase address
- Have an Ethereum RPC endpoint for the network you're querying
Understanding Reward Claiming
How Rewards Accumulate
When your sequencer proposes blocks and participates in consensus, rewards accumulate in the Rollup contract under your coinbase address. These rewards come from:
- Block rewards distributed by the protocol
- Transaction fees from processed transactions
Rewards are tracked per coinbase address in the Rollup contract's storage but remain in the contract until you claim them.
Manual vs Automatic
Rewards are not automatically sent to your coinbase address. You must explicitly claim them by calling the claimSequencerRewards function on the Rollup contract.
Claim Requirements
Before claiming, verify these conditions:
- Rewards have accumulated: Query your pending rewards before attempting to claim.
- Sufficient gas: Ensure you have ETH to pay transaction gas costs.
Checking Reward Status
Set Up Your Environment
For convenience, set your RPC URL as an environment variable:
export RPC_URL="https://your-ethereum-rpc-endpoint.com"
export ROLLUP_ADDRESS="[YOUR_ROLLUP_CONTRACT_ADDRESS]"
Replace [YOUR_ROLLUP_CONTRACT_ADDRESS] with your actual Rollup contract address.
Query Your Pending Rewards
Check accumulated rewards:
cast call $ROLLUP_ADDRESS "getSequencerRewards(address)" [COINBASE_ADDRESS] --rpc-url $RPC_URL
Replace [COINBASE_ADDRESS] with your sequencer's coinbase address.
Example:
# Query and convert to decimal tokens (assuming 18 decimals)
cast call $ROLLUP_ADDRESS "getSequencerRewards(address)" 0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb --rpc-url $RPC_URL | cast --to-dec | cast --from-wei
# Output: 0.1
Claiming Your Rewards
The claimSequencerRewards function is permissionless - anyone can call it for any address. Rewards are always sent to the coinbase address, regardless of who submits the transaction.
Basic Claim Command
Use cast send to claim rewards:
cast send $ROLLUP_ADDRESS \
"claimSequencerRewards(address)" \
[COINBASE_ADDRESS] \
--rpc-url $RPC_URL \
--private-key [YOUR_PRIVATE_KEY]
Replace:
[COINBASE_ADDRESS]- The coinbase address whose rewards you want to claim[YOUR_PRIVATE_KEY]- The private key of the account paying for gas
Example:
cast send $ROLLUP_ADDRESS \
"claimSequencerRewards(address)" \
0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb \
--rpc-url $RPC_URL \
--private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
Using a Keystore File
For better security, use a keystore file instead of exposing your private key:
cast send $ROLLUP_ADDRESS \
"claimSequencerRewards(address)" \
[COINBASE_ADDRESS] \
--rpc-url $RPC_URL \
--keystore [PATH_TO_KEYSTORE] \
--password [KEYSTORE_PASSWORD]
Using a Hardware Wallet
If you're using a Ledger wallet:
cast send $ROLLUP_ADDRESS \
"claimSequencerRewards(address)" \
[COINBASE_ADDRESS] \
--rpc-url $RPC_URL \
--ledger
This will prompt you to confirm the transaction on your Ledger device.
Verifying Your Claim
Check that the transaction succeeded and your pending rewards were reset to zero:
# Check transaction succeeded (look for status: 1)
cast receipt [TRANSACTION_HASH] --rpc-url $RPC_URL
# Verify pending rewards are now zero
cast call $ROLLUP_ADDRESS "getSequencerRewards(address)" [COINBASE_ADDRESS] --rpc-url $RPC_URL
Troubleshooting
No Pending Rewards
Symptom: getSequencerRewards() returns zero.
Possible causes:
- Your sequencer has not proposed any blocks yet
- You already claimed all available rewards
- Your coinbase address is configured incorrectly
Solutions:
- Verify your sequencer is active and proposing blocks (check monitoring)
- Check your sequencer logs for block proposals
- Verify the coinbase address in your sequencer configuration matches the address you're querying
- Check if blocks you proposed have been proven (rewards are distributed after proof submission)
Transaction Fails with "Out of Gas"
Symptom: Transaction reverts due to insufficient gas.
Solution:
- Increase the gas limit when sending the transaction using
--gas-limit:cast send $ROLLUP_ADDRESS \
"claimSequencerRewards(address)" \
[COINBASE_ADDRESS] \
--rpc-url $RPC_URL \
--private-key [YOUR_PRIVATE_KEY] \
--gas-limit 200000 - Ensure your account has sufficient ETH to cover gas costs
Insufficient Funds for Gas
Symptom: Transaction fails because the sending account has insufficient ETH.
Solution:
- Check your account balance:
cast balance [YOUR_ADDRESS] --rpc-url $RPC_URL - Send ETH to your account to cover gas costs (recommended: at least 0.005 ETH)
Wrong Network
Symptom: Transaction fails or contract calls return unexpected results.
Solution:
- Verify your RPC URL points to the correct network (Ethereum mainnet)
- Verify the Rollup contract address matches your target network
- Check your account has ETH on the correct network
Best Practices
Claim Regularly: Claim rewards periodically to reduce accumulated balances in the Rollup contract. This minimizes risk and simplifies accounting.
Monitor Pending Rewards: Set up automated scripts to query pending rewards and alert you when they exceed a threshold.
Use Keystore Files: Avoid exposing private keys in command history. Use keystore files or hardware wallets for production operations.
Verify Before Claiming: Check pending rewards before claiming to ensure the transaction justifies the gas cost.
Track Claim History: Keep records of claim transactions for accounting purposes using transaction hashes on blockchain explorers.
Coordinate with Delegators: If operating with delegated stake, communicate with delegators about claiming and distribution schedules.
Next Steps
- Set up monitoring to track reward accumulation automatically
- Learn about becoming a staking provider if operating with delegators
- Review useful commands for other sequencer queries
- Join the Aztec Discord for operator support and community discussions