← Back to all products

Staking Rewards Calculator

$8

Calculate staking APY, compounding returns, and validator selection impact on rewards.

📁 10 files
TOMLPythonMarkdown

📁 File Structure 10 files

staking-rewards-calc/ ├── LICENSE ├── README.md ├── pyproject.toml ├── security-notes.md ├── src/ │ ├── beacon.py │ ├── calculator.py │ ├── cli.py │ ├── formatter.py │ └── models.py └── tests/ └── test_calculator.py

📖 Documentation Preview README excerpt

staking-rewards-calc

CLI tool to calculate, project, and compare Ethereum staking rewards across validators and protocols.

Price: $7.99 | Store: staking-kit | Product #3


Overview

staking-rewards-calc is a Python CLI that implements the Ethereum consensus layer reward formulas (Altair spec) to estimate, project, and compare staking rewards. It supports native solo staking, liquid staking protocols (Lido, Rocket Pool, Coinbase), MEV estimation, and multi-month projections with compounding.

Features

FeatureDescription
EstimateAnnual/monthly/daily rewards based on validator count and effectiveness
ProjectMulti-month projections with optional compounding
CompareSide-by-side comparison across staking protocols (native, Lido, Rocket Pool, Coinbase)
HistoryFetch historical rewards from a Beacon Chain node
MEVOptional MEV reward estimation from historical block builder data
JSON outputPipe results to other tools with --json flag

Installation


# Install from source
pip install -e .

# Or install dependencies manually
pip install click rich web3 pyyaml python-dotenv

Prerequisites

  • Python 3.10+
  • (Optional) A Beacon API endpoint for the history command

Quick Start

1. Estimate annual rewards


# Single validator, default parameters
staking-calc estimate

# 5 validators with MEV
staking-calc estimate --validators 5 --effectiveness 0.98 --include-mev

# JSON output
staking-calc estimate --validators 10 --json

2. Project rewards over time



*... continues with setup instructions, usage examples, and more.*

📄 Code Sample .py preview

src/beacon.py """ staking-rewards-calc — Beacon API client for historical reward data Fetches validator rewards from a Beacon Chain node's REST API. Compatible with Lighthouse, Prysm, Teku, and Lodestar. """ from __future__ import annotations import json import urllib.request import urllib.error from typing import Any from .models import ( HistoricalReward, HistoryResult, ETH_PER_VALIDATOR, GWEI_PER_ETH, EPOCHS_PER_DAY, ) # --------------------------------------------------------------------------- # Beacon API helpers # --------------------------------------------------------------------------- def _beacon_get(base_url: str, path: str) -> dict[str, Any]: """ Make a GET request to the Beacon API. Args: base_url: Beacon node URL (e.g., "http://localhost:5052") path: API path (e.g., "/eth/v1/beacon/states/head/validators/123456") Returns: Parsed JSON response Raises: ConnectionError: If the Beacon node is unreachable ValueError: If the response is not valid JSON """ url = f"{base_url.rstrip('/')}{path}" try: req = urllib.request.Request(url, headers={"Accept": "application/json"}) with urllib.request.urlopen(req, timeout=30) as resp: return json.loads(resp.read().decode()) except urllib.error.URLError as e: raise ConnectionError(f"Cannot reach Beacon node at {base_url}: {e}") from e # ... 164 more lines ...
Buy Now — $8 Back to Products