Auto-Claim Rewards
The validator can claim your staking rewards automatically. Once the unclaimed rewards reach a configured threshold, the validator sends a claim_rewards transaction to the staking contract.
This transaction will transfer the rewards to the designated reward address.
To configure this, 5 new flags are made available. Full descriptions are available in Configuration Options:
reward-addresssets the account that sends theclaim_rewardstransactions. It must be either the staker address or the staker's reward address.reward-priv-key(orreward-signer-url) to sign for theclaim_rewardstransactions.reward-claim-thresholdis the amount after which aclaim_rewardstransaction will trigger.reward-claim-max-feeis the maximum fee you're willing to pay to execute this transaction.
There are Metrics endpoints made available for this feature.
You can add these new flags to your current config:
- CLI flags
- Environment variables
- Config file
- Docker
- Binary
docker run --network host \
--user "$(id -u):$(id -g)" \
-v /path/to/config.json:/app/config/config.json \
nethermind/starknet-staking-v2 \
--config /app/config/config.json \
--reward-address "0x789" \
--reward-signer-url "http://localhost:8081" \
--reward-claim-threshold 100 \
--reward-claim-max-fee 1000000000000000000
./build/validator \
--config config.json \
--reward-address "0x789" \
--reward-signer-url "http://localhost:8081" \
--reward-claim-threshold 100 \
--reward-claim-max-fee 1000000000000000000
- Docker
- Binary
docker run --network host \
--user "$(id -u):$(id -g)" \
-v /path/to/config.json:/app/config/config.json \
-e REWARD_ADDRESS="0x789" \
-e REWARD_PRIVATE_KEY="0xabc" \
-e REWARD_CLAIM_THRESHOLD=100 \
nethermind/starknet-staking-v2 --config /app/config/config.json
REWARD_ADDRESS="0x789" \
REWARD_PRIVATE_KEY="0xabc" \
REWARD_CLAIM_THRESHOLD=100 \
./build/validator --config config.json
{
"provider": {
"http": "http://localhost:6060/rpc/v0_10",
"ws": "ws://localhost:6061/rpc/v0_10"
},
"signer": {
"operationalAddress": "0x123",
"url": "http://localhost:8080"
},
"reward": {
"address": "0x789",
"url": "http://localhost:8081",
"claimThreshold": 100,
"claimMaxFee": 1000000000000000000
}
}
- Docker
- Binary
docker run --network host \
--user "$(id -u):$(id -g)" \
-v /path/to/config.json:/app/config/config.json \
nethermind/starknet-staking-v2 --config /app/config/config.json
./build/validator --config config.json
Only the staker's own rewards are claimed, which include its commission on the delegated stake. Rewards of the delegation pool members are sent directly to the pool contracts by the staking protocol and claimed by the members themselves, so they are not affected by this feature.
The reward account pays the fee of the claim transactions, so it needs enough STRK to cover it. When the feature is enabled, the balance of the reward account is checked against --balance-threshold at startup and after every attestation window, just like the operational account, and reported through the validator_attestation_reward_balance and validator_attestation_reward_below_threshold metrics.
External Signing
The reward account can be signed for externally using the same HTTP protocol as the operational account. The external signer must hold the private key of the reward account, so it is usually a separate signer instance from the one used for attestations. It must be running when the validator starts, since its availability is checked at startup.