> ## Documentation Index
> Fetch the complete documentation index at: https://docs.layerzero.network/llms.txt
> Use this file to discover all available pages before exploring further.

# LayerZero Worker Services

> LayerZero's separation of verification and execution into independent worker services enables configurable security models and permissionless message...

LayerZero's separation of verification and execution into independent worker services enables configurable security models and permissionless message delivery. Worker services are off-chain infrastructure that Message Libraries coordinate to verify and deliver crosschain messages while following onchain rules.

## Two Types of Workers

### DVNs (Decentralized Verifier Networks)

**DVNs** are LayerZero's implementation of the "verifier networks" discussed in previous modules. Each DVN is an independent verification service that implements one of the verification approaches from [Module 1](./interoperability-foundations) (ZK proofs, committee consensus, light clients, etc.).

### Executors

**Executors** are permissionless services that deliver verified messages to destination chains. They compete to provide fast, reliable message delivery while following execution parameters set by Message Libraries.

## DVN Architecture & Implementation

DVNs prove message authenticity according to Message Library rules and fit into the X-of-Y-of-N configuration model:

```mermaid wrap theme={null}
graph LR
subgraph "Chain A"
SENDER["Sender OApp"]
ENDPOINT_A["LayerZero<br/>Endpoint"]
LIB_A["SendLib"]
end

    subgraph "Verification Layer"
        DVN1["DVN 1<br/>ZK Proofs"]
        DVN2["DVN 2<br/>Committee A"]
        DVN3["DVN 3<br/>Committee B"]
        DVN4["DVN 4<br/>Middlechain"]
        DVN5["DVN 5<br/>Native Bridge"]
        DVN6["DVN 6<br/>Custom"]
    end

    subgraph "Chain B"
        LIB_B["ReceiveLib"]
        ENDPOINT_B["LayerZero<br/>Endpoint"]
        RECEIVER_B["Receiver OApp"]
    end

    subgraph "Config"
        CONFIG["X-of-Y-of-N<br/>Required: DVN1, DVN2<br/>Optional: DVN3, DVN4, DVN5, DVN6<br/>Threshold: 2-of-4-of-6"]
    end

    SENDER --> ENDPOINT_A
    ENDPOINT_A --> LIB_A

    LIB_A --> DVN1
    LIB_A --> DVN2
    LIB_A --> DVN3
    LIB_A --> DVN4
    LIB_A --> DVN5
    LIB_A --> DVN6

    DVN1 --> LIB_B
    DVN2 --> LIB_B
    DVN3 --> LIB_B
    DVN4 --> LIB_B
    DVN5 --> LIB_B
    DVN6 --> LIB_B

    LIB_B --> ENDPOINT_B
    ENDPOINT_B --> RECEIVER_B

    CONFIG -.-> LIB_A
    CONFIG -.-> LIB_B
```

### DVN Implementation Examples

**DVN 1 (ZK Proofs)**: Uses zero-knowledge cryptography for mathematical verification
**DVN 2 (Committee A)**: Uses multi-signature consensus from validator set A
**DVN 3 (Committee B)**: Uses multi-signature consensus from validator set B
**DVN 4 (Middlechain)**: Uses shared security from intermediate consensus layer
**DVN 5 (Native Bridge)**: Uses existing chain-to-chain sequencer bridge infrastructure for verification
**DVN 6 (Custom)**: Uses specialized verification logic for specific use cases

**X-of-Y-of-N in Practice**: The configuration shows a **2-of-4-of-6** setup where DVN1 and DVN2 are required, and any 2 of the 4 optional DVNs (DVN3, DVN4, DVN5, DVN6) must also verify.

### DVN Configuration

```solidity wrap theme={null}
// Configure DVNs per pathway (matching our 2-of-4-of-6 example above)
SetConfigParam[] memory params = new SetConfigParam[](1);
params[0] = SetConfigParam({
    eid: remoteEid,              // The remote chain
    configType: 2,               // 2 = ULN config
    config: abi.encode(
        UlnConfig({
            confirmations: 15,
            requiredDVNCount: 2,     // DVN1 (ZK) + DVN2 (Committee A)
            optionalDVNCount: 4,     // DVN3, DVN4, DVN5, DVN6 available
            optionalDVNThreshold: 2, // Need 2 of the 4 optional DVNs
            requiredDVNs: sortedAddresses([zkProofsDVN, committeeADVN]),  // Must be sorted!
            optionalDVNs: sortedAddresses([committeeBDVN, middlechainDVN, nativeBridgeDVN, customDVN])
        })
    )
});

endpoint.setConfig(address(this), receiveLib, params);
```

### DVN Providers

DVNs are independent verification services. Common providers include LayerZero Labs, Google Cloud, Polyhedra (ZK), and others. Each has different trust models, latency, and cost characteristics.

See the [DVN Providers page](/v2/deployments/deployed-contracts) for current addresses and availability per chain.

## Executor Architecture & Implementation

Execution is permissionless - anyone can deliver verified messages:

```solidity wrap theme={null}
// Executors are optional and permissionless
// You can opt-out of automated execution and manually call:
// - lzReceive() directly
// - lzCompose() for composed messages
// - Use LayerZero Scan UI for manual execution
```

### Execution Model

**Permissionless**: Anyone can be an executor
**Optional**: You can opt out and execute manually
**Competitive**: Multiple executors reduce costs
**Manual Fallback**: Always available via LayerZero Scan or direct calls

**Note**: Execution is separate from verification. DVNs verify, Executors deliver.

### Execution Options Configuration

```solidity wrap theme={null}
import {OptionsBuilder} from "@layerzerolabs/oapp-evm/contracts/oapp/libs/OptionsBuilder.sol";

// Options configure EXECUTION, not verification
bytes memory options = OptionsBuilder.newOptions()
    .addExecutorLzReceiveOption(
        200_000,    // Gas for lzReceive execution
        0           // Native token amount for receiver
    )
    .addExecutorNativeDropOption(
        1_000_000_000_000_000,    // 0.001 ether (uint128)
        bytes32(uint256(uint160(receiver))) // Receiver as bytes32
    )
    .addExecutorOrderedExecutionOption(); // For strict ordering

// DVNs are NOT configured via options - they're set via pathway config
_lzSend(dstEid, payload, options, fee, refundAddress);
```

## Worker Service Coordination

Message Libraries coordinate both DVNs and Executors to ensure secure and reliable message delivery:

1. **Message Libraries** define the rules for verification and execution
2. **DVNs** verify messages according to their specialized verification methods
3. **Executors** deliver messages once verification requirements are met
4. **Onchain enforcement** ensures all rules are followed before message execution

This separation enables:

* **Independent scaling**: DVNs and Executors can scale independently
* **Competitive markets**: Multiple providers can compete on cost and performance
* **Flexible security**: Applications can choose verification approaches per pathway
* **Reliable delivery**: Multiple execution options with manual fallbacks

## See Also

* Module 3: [LayerZero as Master Interface](./layerzero-protocol-architecture) - Message Libraries and pathway configuration
* Module 5: [Application Design Patterns](./application-design-patterns) - Using worker services in applications
* [Deployments](../deployments/deployed-contracts) - Current DVN and Executor addresses
