Blog

Developer Guide

Soroban Smart Contract Monitoring: What Developers Should Track in Production

You deployed your Soroban smart contract to mainnet. It is live, processing transactions, managing state. But how do you know if it is working correctly? How do you find out when something goes wrong before your users do?

What Can Go Wrong

  • Failed invocations: Transactions that call your contract but revert
  • Unexpected storage changes: State modifications that do not match expected patterns
  • Gas spikes: Invocations consuming abnormally high resources
  • Event anomalies: Missing events or unexpected event patterns
  • Storage bloat: Contract storage growing beyond expected bounds
  • Core Metrics to Track

    1. Invocation Success Rate

    The most fundamental metric. A healthy contract should have a 95%+ success rate. Failures below that indicate a bug, UI issue, or configuration problem.

    2. Gas Consumption

    Track average and P95 gas per invocation. A sudden spike usually indicates an inefficient code path, unexpectedly large storage entries, or a new usage pattern.

    3. Error Types

    Error TypeMeaning
    `InvokeHostFunctionFailed`Contract execution reverted
    `InsufficientBalance`Caller lacks XLM for fees
    `ExceededResourceLimit`Transaction hit CPU/memory limits
    `StorageEntryNotFound`Missing storage entry

    4. Storage State

    Track persistent, temporary, and instance storage entry counts and sizes. Storage has direct cost implications — entries that expire must be restored at additional cost.

    5. Event Volume

    If your contract emits events, monitor volume over time, events by topic, and gaps where events should be firing but are not.

    Setting Up Monitoring

    Using Stellar RPC Events

    Poll the getEvents RPC method at regular intervals:

    {
      "jsonrpc": "2.0",
      "id": 1,
      "method": "getEvents",
      "params": {
        "startLedger": 61000000,
        "filters": [{
          "type": "contract",
          "contractIds": ["YOUR_CONTRACT_ID"],
          "topics": [["*"]]
        }],
        "pagination": { "limit": 100 }
      }
    }

    Alerting Rules

    AlertConditionSeverity
    **Success rate drop**Below 90% over 1 hourCritical
    **No invocations**Zero calls in 30 min (if normally active)Warning
    **Gas spike**P95 gas 2x baselineWarning
    **Storage growth**10%+ increase in 24 hoursInfo
    **Error burst**5+ failures in 5 minutesCritical

    Common Production Issues

    TTL Expiration

    Soroban storage entries have time-to-live values. If an entry expires, it must be restored before it can be read, causing unexpected failures. Monitor TTL values for critical entries.

    Frontend Staleness

    If your frontend caches contract state, users may submit transactions based on stale data. Monitor the delta between frontend state and actual contract state.

    Tools

    LumenQuery provides contract monitoring tools:

  • [Smart Contract Explorer](/contracts): Decoded call history, storage viewer, event stream
  • [Network Analytics](/analytics): Network-level Soroban activity metrics
  • [Live Transactions](/dashboard/transactions): Real-time transaction stream with Soroban highlighting

  • *Monitor your Soroban contracts in production with LumenQuery. Decoded calls, storage viewer, and event streaming — start free.*