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

# Solver Implementation

> Describes the protocol implementation for the Solcer

<Steps>
  <Step title="Monitor the source chain">
    Subscribe to `TokenLocked` events to detect any locks made to your address with a hashlock.
  </Step>

  <Step title="Lock funds on the destination chain">
    * When a lock is detected, call `lock()` on the destination chain and pass the same `hashlock` with `timelock` of [$T + 2\Delta$](/protocol-spec/model/#standard-flow).
  </Step>

  <Step title="Verify the lock on source chain">
    * Monitor the source chain for the `TokenLocked` event details (or use the `getDetails()` function) on the detected lock.
    * Verify that the `hashlock` matches what the user used.
    * Verify that the `timelock` provides sufficient time to act, ensuring it is at least [$T + \Delta$](/protocol-spec/model/#standard-flow).
    * Verify that the `Id` is consistent and valid.
  </Step>

  <Step title="Receive secret from user">
    The user will sign and transmit the derived secret to you via off-chain channels. Verify that when hashed, this secret matches the hashlock on both chains.
  </Step>

  <Step title="Complete the exchange">
    * Once you receive the secret, call `redeem()` on the destination chain to unlock the user's funds. <strong>You are incentivized to do this quickly because a reward is reserved for whoever completes this transaction. If you delay, another actor can call redeem and claim the reward instead.</strong>
    * Call `redeem()` on the source chain to claim your primary fee/reward.
    * Pass in the secret value received from the user.
  </Step>
</Steps>

<Warning>
  [Edge Case: User Fails to Act on the Solver’s Lock](/protocol-spec/edge-cases#user-fails-to-act-on-the-solvers-lock)

  * If the commitment is not locked, wait for the `timelock` to expire.
  * Call `refund()` on the destination chain to reclaim your funds.
</Warning>
