1

Create a commitment

Call the commit() function to lock funds for a specified party with a timelock of T+βT + \beta.
2

Monitor the destination chain

  • Watch for the TokenLocked event or use the Id on the destination chain by calling getDetails().
  • Verify that the hashlock of the HTLC on the destination chain provides sufficient time to act, ensuring it is at least T+2ΔT + 2\Delta.
  • Once detected, capture the hashlock value.
The state of the destination chain should be read from a Light Client if one exists; if not, it should be read from multiple RPC providers.
3

Add lock to your PreHTLC on the source chain

Call addLock(), passing in the captured hashlock and timelock of T+ΔT + \Delta.
NaN

(signature flow) Sign a message instead of adding a lock

The user signs a message containing the Id, hashlock, and timelock.
Edge Case: Solver Fails to Act on the User’s Commitment/Intent
  • Wait for the timelock to expire.
  • Call refund() on the source chain to reclaim your funds.
Edge Case: Solver Fails to Release Any Funds
  • Wait for the timelock to expire.
  • Call refund() on the source chain to reclaim your funds.
Edge Case: Solver Fails to Release the User’s Funds
  • If funds are not released on the destination chain, watch the source chain for the TokenRedeemed event (or getDetails() function).
  • Once detected, capture the secret and call redeem() on the destination chain.