Skip to main content
This explainer covers the basics of onchain and offchain monitoring options for your OP Stack chain. Onchain monitoring services allow chain operators to monitor the overall system and onchain events. Offchain monitoring lets chain operators to monitor the operation and behavior of nodes and other offchain components.

Onchain monitoring services

Onchain monitoring services provide insights into the overall system, helping chain operators track and monitor onchain events. dispute-mon is the open source onchain monitor for the OP Stack’s proof system: it watches dispute games, not other onchain events. For the rest of your chain’s contracts and accounts, use OP Enterprise security monitoring or your own monitors.

dispute-mon

Every chain operator must run op-dispute-mon. It’s an essential security monitoring service that tracks game statuses, providing visibility over the last 28 days. dispute-mon watches the proof system: it compares each game’s root claim with the root your trusted nodes report (an output root, or a super root for super-root and ZK games), and flags games that are forecast to resolve, or have resolved, incorrectly. It does not check whether a proven withdrawal was actually initiated on L2. If someone proves a withdrawal that was never initiated on L2 against a valid root, for example through a bug in the OptimismPortal contract’s withdrawal proof verification, dispute-mon does not flag it. Cover that case with OP Enterprise security monitoring or your own monitor that checks every withdrawal proven to the OptimismPortal contract against the L2ToL1MessagePasser contract on L2. dispute-mon is set up and built the same way as op-challenger. This means that you can run it the same way (run just op-dispute-mon in the op-dispute-mon directory). A basic configuration option would look like this:
OP_DISPUTE_MON_HONEST_ACTORS is a CSV (no spaces) list of addresses that are used for the honest op-challenger instances. Additional flags:
  • OP_DISPUTE_MON_GAME_WINDOW: This is the window of time to report on games. It should leave a buffer beyond the max game duration for bond claiming. If Fault Proof game parameters are not changes (e.g. MAX_CLOCK_DURATION), it is recommended to leave this as the default.
  • OP_DISPUTE_MON_MONITOR_INTERVAL: The interval at which to check for new games. Defaults to 30 seconds currently.
  • OP_DISPUTE_MON_MAX_CONCURRENCY: The max thread count. Defaults to 5 currently.

ZK dispute games

For a chain using ZK proofs, set OP_DISPUTE_MON_SUPERROOT_RPC to one or more trusted super root sources: an op-supernode for an interop set, or the chain’s op-node with its safe head database enabled. op-dispute-mon compares each ZK game’s proposal with these sources, the same way it does for other super-root games. It also exports op_dispute_mon_zk_games_pending_lifecycle_action, the number of ZK games waiting for an honest actor to act:
  • action="resolution": games that anyone can resolve, but that nobody has resolved yet. The parent has resolved, and either the game is over or the parent lost.
  • action="bond_distribution": resolved, final games that nobody has closed or claimed a bond from yet.
Alert when either value stays above zero for longer than L1 finality plus a few monitoring intervals. Before the challenger acts on an unchallenged game whose parent lost, it waits for L1 finality, so short periods above zero are normal. A value that stays above zero usually means op-zk-proposer or op-challenger is not running or cannot send transactions. You can find more info on op-dispute-mon on the repo.

OP Enterprise security monitoring

OP Enterprise security monitoring is a suite of onchain security monitors for your OP Stack chain. It watches the contracts and accounts your chain depends on and alerts on events that could signal a security incident. Critical monitors run with redundancy. The monitors set up for your chain depend on its configuration. It covers:
  • Bridge and withdrawal integrity: deposits and withdrawals between L1 and L2 behave as expected, including that every withdrawal proven on L1 was initiated on L2.
  • Proof system outcomes: proposals and dispute games resolve to the correct state of your chain.
  • Privileged roles and contract configuration: activity by the multisigs and other privileged roles that control your chain’s contracts, and changes to contract configuration, such as pausing.
  • Balances and operational accounts: the accounts your chain needs to keep funded stay funded.

Monitor your chain without OP Enterprise

If your chain does not use OP Enterprise security monitoring, build or source your own onchain monitors. Start with:
  1. Run op-dispute-mon for the proof system, and alert on the games it flags and on your challenger’s balance. See Run a fault-proof challenger.
  2. Check every withdrawal proven to the OptimismPortal contract against the L2ToL1MessagePasser contract on L2.
  3. Alert on every action by a privileged role, using Privileged roles in OP Stack chains as the list of roles and what each one can change.
  4. Track the balances of your batcher, proposer, and challenger accounts.
Treat this list as a starting point, not a complete list: what your chain needs to monitor depends on its configuration and changes as the protocol evolves.

Offchain component monitoring

Offchain monitoring allows chain operators to monitor the operation and behavior of nodes and other offchain components. Some of the more common components that you’ll likely want to monitor include op-node, op-geth, op-proposer, op-batcher, and op-challenger. The general steps for enabling offchain monitoring are pretty consistent for all the OP components:
  1. Expose the monitoring port by enabling the --metrics.enabled flag
  2. Customize the metrics port and address via the --metrics.port and --metrics.addr flags, respectively
  3. Use Prometheus to scrape data from the metrics port
  4. Save the data in influxdb
  5. Share the data with Grafana to build your custom dashboard

op-node

op-node metrics and monitoring is detailed in the Node Metrics and Monitoring guide. To enable metrics, pass the --metrics.enabled flag to op-node and follow the steps above for customization options. See this curated list for important metrics to track specifically for op-node.

op-geth

To enable metrics, pass the --metrics.enabled flag to the op-geth. You can customize the metrics port and address via the --metrics.port and --metrics.addr flags, respectively.

op-proposer

To enable metrics, pass the --metrics.enabled flag to the op-proposer. You can customize the metrics port and address via the --metrics.port and --metrics.addr flags, respectively. You can find more information about these flags in our Proposer configuration doc.

op-batcher

To enable metrics, pass the --metrics.enabled flag to the op-batcher. You can customize the metrics port and address via the --metrics.port and --metrics.addr flags, respectively. You can find more information about these flags in our Batcher configuration doc.

op-challenger

The op-challenger operates as the honest actor in the fault dispute system and defends the chain by securing the OptimismPortal and ensuring the game always resolves to the correct state of the chain. For verifying the legitimacy of claims, op-challenger relies on a synced, trusted rollup node as well as a trace provider (e.g., Cannon). See the OP-Challenger Explainer for more information on this service. To enable metrics, pass the --metrics.enabled flag to op-challenger and follow the steps above for customization options.

Next steps

  • If you encounter difficulties at any stage of this process, please reach out to developer support.