# Execute

Source: https://docs.settlemint.com/docs/operators/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. Trigger this step when you disabled auto-execute at creation. The platform executes only after all local senders approve. External-flow HTLC settlements also require the secret to be revealed first.

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

Check these conditions before triggering execution:

* The settlement has not executed and the operator has not cancelled it.
* The settlement is before cutoff, unless a counterparty already revealed the secret for an external-flow HTLC settlement.
* Every required local sender has approved and locked assets.
* For external-flow HTLC settlements, the counterparty has revealed the hashlock secret.
* You can access the settlement and complete 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 you enable it at creation. When
  auto-execute is off, a ready settlement holds and waits for an execute call 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 detail page shows approvals are complete and the Execute button is visible.

    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. A revealed HTLC settlement can still show Execute after cutoff; execution remains the settlement path because the external leg is already committed.
  </Step>

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

    Review the local asset movements in the execute dialog. 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 dialog, and complete wallet verification. DALP queues an `execute()` transaction against the settlement contract and returns a transaction hash once the call is submitted.
  </Step>

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

    After the transaction confirms, check that the settlement shows as executed and that the asset movements appear in the settlement history. The execution event records the address that submitted the call.
  </Step>
</Steps>

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

Through the Platform API or Console, triggering 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 call while the settlement accepts it, or after cutoff when an HTLC settlement has already revealed its secret. The contract only completes the commit 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 carry full approval and satisfy the hashlock condition. For HTLC settlements, hashlock-satisfied means the counterparty revealed the secret. Cutoff only blocks execution prior to the secret reveal. |
| 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"
  }
}
```

The platform returns the transaction hash for the queued on-chain call.

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

## Troubleshooting [#troubleshooting]

| Issue                                                      | What to check                                                                                                                                                                            |
| ---------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Execute button is not visible                              | Confirm that auto-execute did not already commit the settlement and that the settlement is ready. For HTLC settlements after cutoff, verify that the counterparty revealed the secret.   |
| Execute button is disabled                                 | Confirm that every required approval is complete and, for HTLC settlements, that the counterparty revealed the secret.                                                                   |
| Transaction fails: not fully approved                      | One or more required local senders still need to approve and lock assets.                                                                                                                |
| Transaction fails: secret not revealed                     | The settlement has an external HTLC flow and the counterparty must reveal the secret before execution.                                                                                   |
| Transaction fails: expired, cancelled, or already executed | If the settlement expired before the HTLC secret reveal, use the relevant recovery or review flow instead of retrying execution. Cancelled or executed settlements cannot execute again. |
| Transaction fails: net-balance invariant                   | 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/system-addons/xvp-settlement/actions/approve): approve and lock the local assets before execution.
* [Reveal secret](/docs/operators/system-addons/xvp-settlement/actions/reveal-secret): satisfy the HTLC hashlock before executing an external-flow settlement.
* [Withdraw expired](/docs/operators/system-addons/xvp-settlement/actions/withdraw-expired): recover locked assets after a settlement passes its cutoff date without execution.
* [XvP settlement overview](/docs/operators/system-addons/xvp-settlement/overview): review the full local and HTLC settlement lifecycle.
