1

Monitor the source chain

Subscribe to TokenCommitted events to detect any commitments made to your address.

2

Lock funds on the destination chain

  • Generate S and hashlock.
  • When a commitment is detected, call lock() on the destination chain and pass the generated hashlock with timelock of T+2ΔT + 2\Delta.
3

Verify the commitment lock

  • Monitor the source chain for the TokenLockAdded event (or getDetails() function) on the existing commitment.
  • Once detected, verify that the hashlock matches the one you previously generated.
  • Verify that the timelock provides sufficient time to act, ensuring it is at least T+ΔT + \Delta.
3*

(signature flow) hashlock addition on behalf of the user

Call the addLockSig() function, providing both the user’s signature and the message data (Id, hashlock, timelock).

4

Complete the exchange

  • Once verified, call redeem() on both the source and destination chains.
  • Pass in the previously generated S value.

Edge Case: Party 1 fails to add lock to the commitment

  • If the commitment is not locked, wait for the timelock to expire.
  • Call refund() on the destination chain to reclaim your funds.

Was this page helpful?