1
Derive secret and hashlock
Using the recoverable secret generation mechanism, derive a secret from the user’s wallet signature, source chain, destination chain, and timelock parameters. Hash the secret to create the hashlock.
2
Lock funds on source chain
Call the
userLock() function to lock funds with the derived hashlock and a timelock of . For a gasless experience, sign an intent and let a relayer submit it through the TrainRouter instead.3
Monitor the destination chain
- Watch for the
SolverLockedevent or query the lock directly by callinggetSolverLock(hashlock, solver). - Verify that the
hashlockof the lock on the destination chain matches your derived hashlock and provides sufficient time, ensuring it is at least .
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.
4
Transmit signature with secret to Solver
Sign a message containing the derived secret and transmit this signed message to the Solver or any available actor. This allows them to use the secret to unlock funds on both chains without requiring further user interaction.
This signature transmission can happen via off-chain channels (WebSocket, API, etc.). The signature includes the actual secret, which the Solver can now use.
5
Solver uses secret to release funds
The Solver reveals the secret on the destination chain to unlock the user’s funds and on the source chain to claim their own funds. Both the user and Solver can now complete their side of the transaction.