# Execute

Source: https://docs.settlemint.com/docs/operators/user-guides/system-addons/xvp-settlement/actions/execute
Manually execute an XvP settlement after approvals and any HTLC secret reveal are complete.
Use this action when auto-execute is disabled and the settlement is ready to commit on-chain.




Manual execution commits a ready XvP settlement on-chain. Use the execute action when auto-execute is disabled. Before execution, all local senders must approve. External-flow HTLC settlements also need the secret requirement to be satisfied.

## Before you execute [#before-you-execute]

Check these conditions before using the execute flow:

* The settlement has not executed, been cancelled, or passed its cutoff date.
* Every required local sender has approved and locked the required assets.
* For external-flow HTLC settlements, the hashlock secret has been revealed.
* You can access the settlement in DALP and complete the required wallet verification.

<Callout type="info" title="Manual execution is the normal review step when auto-execute is off">
  New XvP settlements start with auto-execute disabled unless it is explicitly enabled during creation. When
  auto-execute is off, a ready settlement remains waiting for an execute transaction instead of committing as soon as
  the final approval or secret reveal lands.
</Callout>

## Execute from the settlement page [#execute-from-the-settlement-page]

<Steps>
  <Step>
    ### Open the ready settlement [#open-the-ready-settlement]

    Go to **Settlements** and open the settlement you want to execute. Confirm that the settlement is still open and that the detail page shows approvals are complete.

    For an HTLC settlement, also confirm that the secret has already been revealed. If the secret is still missing, use the reveal-secret flow first.
  </Step>

  <Step>
    ### Review the flows [#review-the-flows]

    Open the execute action and review the local asset movements. Treat this as the final operational check before the settlement contract calculates net positions.
  </Step>

  <Step>
    ### Confirm with wallet verification [#confirm-with-wallet-verification]

    Click **Execute**, confirm the action, and complete the required wallet verification. DALP queues an `execute()` transaction against the settlement contract and returns a transaction hash when the queued transaction is submitted.
  </Step>

  <Step>
    ### Verify completion [#verify-completion]

    After the transaction confirms, check that the settlement is marked as executed and that the asset movements are visible in the settlement activity. The execution event records the address that submitted the transaction.
  </Step>
</Steps>

## Who can execute [#who-can-execute]

Through the DALP app or API, manual execution requires an authenticated user, wallet verification, and tenant-scoped access to the settlement.

At the settlement-contract level, `execute()` is not limited to the original senders or recipients. Any caller can submit the execute transaction while the settlement is still open. The contract only completes execution when every precondition is met.

## What DALP and the contract do [#what-dalp-and-the-contract-do]

| Stage               | Behaviour                                                                                                                                                                               |
| ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Access check        | DALP first checks that the requested settlement is readable in the current tenant context.                                                                                              |
| Wallet verification | The API route requires wallet verification before DALP queues the transaction.                                                                                                          |
| Transaction queue   | DALP encodes `execute()` with no function arguments and queues the call for the selected wallet.                                                                                        |
| Contract checks     | The settlement must be open, fully approved, and hashlock-satisfied. For HTLC settlements, hashlock-satisfied means the secret has been revealed.                                       |
| Net settlement      | The contract calculates each local participant's net position per local asset, debits locked balances, transfers ERC20 assets to recipients, and enforces a zero net-balance invariant. |
| On-chain record     | The contract marks the settlement as executed and emits the execution event with the caller address.                                                                                    |

## API shape [#api-shape]

The execute input identifies the settlement address. The contract call itself has no additional arguments.

```json
{
  "settlementAddress": "0x8a4f0f2f3c9e7b7a7b2a1c7c1d5e3f4a5b6c7d8e",
  "walletVerification": {
    "secretVerificationCode": "123456",
    "verificationType": "PINCODE"
  }
}
```

A submitted execute request returns the transaction hash for the queued on-chain call.

```json
{
  "transactionHash": "0x..."
}
```

## Troubleshooting [#troubleshooting]

| Issue                                                       | What to check                                                                                                                       |
| ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| Execute action is not visible                               | Confirm that auto-execute did not already commit the settlement and that the settlement is still open.                              |
| Execute action is disabled                                  | Confirm that every required approval is complete and, for HTLC settlements, that the secret has been revealed.                      |
| Transaction reports not fully approved                      | One or more required local senders still need to approve and lock assets.                                                           |
| Transaction reports secret not revealed                     | The settlement has an external HTLC flow and the secret must be revealed before execution.                                          |
| Transaction reports expired, cancelled, or already executed | The settlement is no longer open. Use the relevant recovery or review flow instead of retrying execution.                           |
| Transaction reports a net-balance invariant issue           | Stop and review the settlement flows. The contract rejected execution because the local net positions did not balance for an asset. |

## Related tasks [#related-tasks]

* [Approve settlement flows](/docs/operators/user-guides/system-addons/xvp-settlement/actions/approve): approve and lock the local assets before execution.
* [Reveal secret](/docs/operators/user-guides/system-addons/xvp-settlement/actions/reveal-secret): satisfy the HTLC hashlock before executing an external-flow settlement.
* [Withdraw expired](/docs/operators/user-guides/system-addons/xvp-settlement/actions/withdraw-expired): recover locked assets after a settlement passes its cutoff date without execution.
* [XvP settlement overview](/docs/operators/user-guides/system-addons/xvp-settlement/overview): review the full local and HTLC settlement lifecycle.
