🏦Watchtower Architecture

Software Architecture - client, APIs and contracts

Architecture

WitnessChain Watchtowers' software stack comprise of

  1. Watchtower Client (written in Go)

  2. On-chain Smart Contracts on Ethereum & on a Layer-2 chain

    1. Layer 1: Operator Registry, Settlement (ServiceManager aka EigenTower) & Alert Manager

    2. Layer 2: DiligenceProofManager Contract

  3. Centralized Aggregator (to submit "batched" bounty settlements (rewards) on Ethereum)

Watchtower client

Proof of Diligence

At a high level, the process of L2 state validation in a watchtower node client has 4 stages

  1. Output State Root Extraction from L1

  2. Output State Root Extraction (Tracer execution) from L2 Node

  3. Comparison & generating proofs of diligence

  4. Smart Contract integration to publish the proofs

List of Key Smart Contracts and their key functions

1. OperatorRegistry

This is Registry-type contract for keeping track of operators. It is used for registering and deregistering new operators. Only registered and delegated EigenLayer operators are allowed into the watchtower network

addToOperatorWhitelist([OperatorAddress])

Called By

Contract Owner

Returns

None

Emits

  • Adds the list of operators to the whitelist mapping

suspend(operator)

Called By

Contract Owner

Returns

None

Emits

  • Removes the operator from the whitelist mapping

registerWatchtowerAsOperator(watchtower, expiry, signedMessage)

Called By

Node operator

Returns

None

Emits

  • Registers the operator as a watchtower

deRegister(watchtowerAddress)

Called By

Node operator

Returns

None

Emits

  • Deregisters the watchtower

  • The watchtower client will no longer be able to post any proofs, until the operator registers the watchtower address again

2. DiligenceProofManager

The DiligenceProofManager Contract contains functionality for miners (aka Watchtowers) to submit (mine) their Proofs of Diligence for a Bounty Period (which is the period between 2 L2 Txn Batch submissions). After the next L2 output state root is posted on L1, the bounty is rewarded to the miner. Bounties are given for every L2 Output (L2 Block).

setPoDClaimBounties(_chainID, _claimBounties)

Called By

Owner of the Contract

Returns

None

Emits

  • The owner of the Contract sets the Bounty Amount.

  • Consider PoD bounties are just reward points for now. Lets say 1 point for every L2 block mined successfully by a WatchTower. A detailed Points documentation is in progress.

setPoIClaimBounties(_chainID, _claimBounties)

Called By

Owner of the Contract

Returns

None

Emits

  • The owner of the Contract sets the Bounty Amount.

  • Consider PoI bounties are just reward points for now. Lets say 1 point for every L2 block mined successfully by a WatchTower. A detailed Points documentation is in progress.

submitPoDProof (chainID, l2_blockNumber, proofOfDiligence, signatureProofOfDiligence)

Called By

WatchTower (EigenLayer Node Operator)

Returns

None

Emits

NewBountyClaimed event

  • Watchtower(s) submits/mine a L2 block by submitting the Hash(intermediate state root) and signing the Hash.

  • Validations on Contract take care if the right sender is sending this transaction

submitPoIProof (chainID, l2_blockNumber, proofOfDiligence, signatureProofOfDiligence)

Called By

WatchTower (EigenLayer Node Operator)

Returns

None

Emits

NewBountyClaimed event

  • Watchtower(s) submits/mine a L2 block for a PoI proof.

  • Validations on Contract take care if the right sender is sending this transaction

3. AlertManager

This contract is used for keeping track of alerts raised by watchtowers

raiseAlert(chainID, l2BlockNumber, originalOutputRoot, computedOutputRoot, proofofDiligence)

Called By

Node Operator

Returns

None

Emits

  • Raise an alert when there is a mismatch in output root between what is exeucte on L2 Node and asserted on L1 Contract

getAlerts(chainID,L2BlockNumber)

Called By

Node Operator

Returns

Emits

None

  • Get all alerts raised so far a particular chainID and L2BlockNumber

4. WitnessHub (AVS ServiceManager Contract)

The WitnessHub Contract enables the aggregator to process settlements for collective submissions of Proofs of Diligence and Proofs of Inclusion provided by watchtowers on a Layer 2 (L2) blockchain. These submissions correspond to a Bounty Period, which is defined as the interval between two transactions on the L2 chain.

updateRewards (chainID, blockNumBegin, blockNumEnd, operatorsList, proofRewards, rewardHash)

Called By

Aggregator

Returns

None

Emits

NewRewardsUpdate

  • Accepts a list of operators and proof rewards, which correspond to the aggregated rewards for the operators across their watchtowers's proof submissions for a particular chain id and a range of blocks. This function may only be called by the aggregator.

Aggregator

An aggregator, a centralised entity managed by Witness Chain, listens for the PoD and PoI submissions made by the watchtowers on the L2 chain contracts (DiligenceProofManager). It employs a "weighted stake" strategy to determine the winning watchtower for each group of blocks.

This approach allows for a fair and transparent winning process. The winning watchtower's information, along with the number of wins and a Proof of Settlement, is then recorded on the WitnessHub settlement contract on Layer 1 (L1).

The aggregator has the flexibility to adjust the settlement frequency based on gas costs, optimizing the balance between operational efficiency and cost-effectiveness.

Last updated