Menu
Strategy Intermediate 8 min read

Cost Comparison

Complete cost analysis of Bitcoin, Lightning, and Nostr for AI agents. Transaction fees, operational costs, and total cost of ownership.

costs fees comparison economics

Cost Comparison

Understanding the true cost of each protocol is essential for efficient agent operation. This guide covers transaction costs, operational overhead, and total cost of ownership.

Transaction Costs

Bitcoin On-Chain

Fee Prioritysat/vBCost (250 vB tx)Wait Time
High priority50-200$1.25-$5.00Next block
Medium priority20-50$0.50-$1.251-3 blocks
Low priority5-20$0.12-$0.503-6 blocks
Economy1-5$0.02-$0.12Hours/days

Note: Fees vary dramatically based on network congestion. During high-fee periods, even “low priority” can exceed $20.

async def estimate_bitcoin_fee(priority: str = "medium") -> dict:
    """Estimate Bitcoin transaction fee."""
    resp = await fetch("https://mempool.space/api/v1/fees/recommended")
    fees = resp.json()

    priority_map = {
        "high": fees["fastestFee"],
        "medium": fees["halfHourFee"],
        "low": fees["hourFee"],
        "economy": fees["economyFee"]
    }

    sat_per_vb = priority_map.get(priority, fees["halfHourFee"])
    typical_tx_size = 250  # vBytes for 1-in-2-out

    return {
        "sat_per_vb": sat_per_vb,
        "estimated_fee_sats": sat_per_vb * typical_tx_size,
        "priority": priority
    }

Lightning Network

Cost TypeAmountWhen
Routing fee0-50 sats + 0-0.1%Per payment
Base fee0-1 satPer hop
Channel open250-500 vB on-chainOpening channel
Channel close200-400 vB on-chainClosing channel

Effective cost per payment: Usually <$0.01 for payments under $1,000

def estimate_lightning_fee(amount_sats: int, hops: int = 3) -> dict:
    """Estimate Lightning payment fee."""
    # Typical routing fee structure
    base_fee_per_hop = 1  # sats
    proportional_fee = 0.0001  # 0.01% per hop

    total_base = base_fee_per_hop * hops
    total_proportional = int(amount_sats * proportional_fee * hops)

    return {
        "base_fee_sats": total_base,
        "proportional_fee_sats": total_proportional,
        "total_fee_sats": total_base + total_proportional,
        "fee_percentage": (total_base + total_proportional) / amount_sats * 100
    }

# Examples:
# 10,000 sats (3 hops): 3 + 3 = 6 sats (0.06%)
# 100,000 sats (3 hops): 3 + 30 = 33 sats (0.033%)
# 1,000,000 sats (3 hops): 3 + 300 = 303 sats (0.03%)

Nostr Protocol

Cost TypeAmountNotes
Publishing eventsFreeMost relays
Paid relay subscription$5-$20/monthSpam-reduced
NIP-05 identifier$0-$20/yearOptional
Zap feesLightning feeFor payments

Effective cost per message: $0 (or Lightning fee for zaps)

Operational Costs

Bitcoin Infrastructure

ComponentMonthly CostPurpose
Full node (self-hosted)$10-30Electricity + storage
Full node (cloud)$20-50VPS + storage
Block explorer API$0-100Depends on volume
Electrum server$20-40Light wallet backend

Lightning Infrastructure

ComponentMonthly CostPurpose
Lightning node$10-50VPS + monitoring
Channel capitalOpportunity costLocked funds
Watchtower$5-20Fraud protection
LSP subscription$0-30Channel management
Rebalancing feesVariableLiquidity maintenance

Capital lockup calculation:

def calculate_channel_opportunity_cost(
    channel_capacity_sats: int,
    annual_return_rate: float = 0.05  # 5% opportunity cost
) -> dict:
    """Calculate opportunity cost of channel capital."""
    btc_price = 100_000  # Approximate
    capacity_usd = (channel_capacity_sats / 100_000_000) * btc_price
    annual_cost = capacity_usd * annual_return_rate
    monthly_cost = annual_cost / 12

    return {
        "capacity_sats": channel_capacity_sats,
        "capacity_usd": capacity_usd,
        "monthly_opportunity_cost_usd": monthly_cost,
        "break_even_volume_sats": int(monthly_cost / 0.001 * 100_000_000)
    }

# Example: 10M sats channel
# Capacity: $10,000
# Monthly opportunity cost: $41.67
# Need to route $4,167 worth to break even at 0.1% fees

Nostr Infrastructure

ComponentMonthly CostPurpose
Relay hosting$5-50If running own relay
Paid relay subscriptions$5-20Quality access
NIP-05 domain$1-5Identity verification
Backup relays$0Redundancy

Total Cost of Ownership

Scenario 1: Low-Volume Agent (100 tx/month)

ProtocolTransaction FeesInfrastructureTotal Monthly
Bitcoin$50-500$20 (API)$70-520
Lightning$0.50-5$30 (node)$30-35
Nostr$0$10 (relays)$10

Recommendation: Lightning for payments, Nostr for communication

Scenario 2: High-Volume Agent (10,000 tx/month)

ProtocolTransaction FeesInfrastructureTotal Monthly
Bitcoin$5,000-50,000$50 (node)Impractical
Lightning$50-500$100 (multi-node)$150-600
Nostr$0$50 (private relay)$50

Recommendation: Lightning for payments, private Nostr relay

Scenario 3: Occasional Large Settlements

ProtocolTransaction FeesInfrastructureTotal Monthly
Bitcoin$10-50 per tx$0 (public APIs)$10-50
LightningN/A for largeN/AN/A

Recommendation: Bitcoin for settlements >$10,000

Cost Optimization Strategies

Bitcoin Optimization

  1. Batch transactions: Combine multiple outputs into single transaction
  2. Time transactions: Send during low-fee periods (weekends, early morning UTC)
  3. Use SegWit: 30-40% fee savings vs legacy addresses
  4. Consolidate UTXOs: During low-fee periods, merge small UTXOs
def optimal_bitcoin_send_time() -> dict:
    """Recommend optimal time to send Bitcoin transaction."""
    # Historical low-fee patterns
    return {
        "best_days": ["Saturday", "Sunday"],
        "best_hours_utc": [2, 3, 4, 5, 6],  # 2-6 AM UTC
        "avoid_days": ["Tuesday", "Wednesday"],
        "avoid_hours_utc": [14, 15, 16, 17]  # 2-5 PM UTC (US trading hours)
    }

Lightning Optimization

  1. Maintain balanced channels: Reduces rebalancing costs
  2. Use MPP: Multi-path payments find cheaper routes
  3. Choose low-fee nodes: Connect to efficient routing nodes
  4. Batch channel opens: Open multiple channels in one transaction

Nostr Optimization

  1. Use efficient relays: Avoid slow/expensive relays
  2. Cache relay lists: Reduce NIP-65 lookups
  3. Batch events: Combine related events when possible
  4. Use paid relays strategically: Better reliability, less spam

Cost Comparison Calculator

def compare_protocol_costs(
    amount_sats: int,
    transactions_per_month: int,
    urgency: str = "medium"
) -> dict:
    """Compare costs across protocols for given usage pattern."""

    # Bitcoin costs
    btc_fee_per_tx = estimate_bitcoin_fee(urgency)["estimated_fee_sats"]
    btc_monthly = btc_fee_per_tx * transactions_per_month

    # Lightning costs (assuming existing channels)
    ln_fee_per_tx = estimate_lightning_fee(amount_sats)["total_fee_sats"]
    ln_monthly = ln_fee_per_tx * transactions_per_month
    ln_infra = 30 * 100_000  # $30 in sats for node

    # Nostr (free for messages)
    nostr_monthly = 10 * 100_000  # $10 for relay access

    return {
        "bitcoin": {
            "per_tx_sats": btc_fee_per_tx,
            "monthly_sats": btc_monthly,
            "recommended": transactions_per_month < 10 and amount_sats > 1_000_000
        },
        "lightning": {
            "per_tx_sats": ln_fee_per_tx,
            "monthly_sats": ln_monthly + ln_infra,
            "recommended": transactions_per_month > 10 or amount_sats < 1_000_000
        },
        "nostr": {
            "per_tx_sats": 0,
            "monthly_sats": nostr_monthly,
            "recommended": True  # Always good for communication
        }
    }

Break-Even Analysis

When to Switch from Bitcoin to Lightning

Monthly TransactionsBitcoin CostLightning CostUse Lightning?
1-5$5-25$30 (node)No
5-20$25-100$31-35Maybe
20-100$100-500$32-50Yes
100+$500+$40-100Definitely

Break-even point: ~15-20 transactions/month for small payments


Machine-Readable Summary

{
  "topic": "cost-comparison",
  "audience": "ai-agents",
  "cost_categories": [
    "transaction_fees",
    "infrastructure",
    "opportunity_cost",
    "operational_overhead"
  ],
  "typical_costs": {
    "bitcoin_per_tx_sats": "500-50000",
    "lightning_per_tx_sats": "1-100",
    "nostr_per_tx_sats": 0
  },
  "break_even_monthly_txs": 15,
  "optimization_strategies": [
    "batch_transactions",
    "time_transactions",
    "use_segwit",
    "balance_channels"
  ]
}