We signed The Trustless Manifesto for the TRAIN protocol. View Transaction

Let's walk through how the protocol works end-to-end when Alice wants to transfer 1 ETH from Starknet to Optimism.

// steps
  1. Alice opens the Bridge dApp, connects her wallet, derives a secret from her wallet signature, and selects the route from Starknet to Optimism.
  2. The dApp queries the Solver Discovery contract and retrieves addresses of all Solvers that support that route.
  3. Alice calls lock on Starknet with 1 ETH and passes the Solver addresses.

At this stage, the locked funds can be released once the Timelock expires or when the correct secret is provided.

  1. A Dutch Auction starts — Bob and John (Solvers) compete on price until one of them wins.
  2. Bob wins the auction and calls lock on Optimism with 1 ETH.

Now, both funds are locked and can be released once Bob reveals the secret.

  1. The dApp begins local verification of the Optimism network by tracking Bob's transaction. If a Light Client is available, it is used; otherwise, the dApp retrieves data from multiple RPC endpoints or uses the node provider specified by the user. Once detected, it retrieves the secret hash.

  2. Alice transmits the secret with the lock information on Starknet.

At this point, both locks (on Starknet and Optimism) are tied to the same secret. The funds can be unlocked by providing the secret S that satisfies the lock condition.

  1. Bob monitors the source Starknet network. Once he confirms that Alice's lock is secured with the matching secret, he reveals the secret S on both networks, claiming his funds and releasing Alice's funds.
// summary
  • process takes <30 seconds
  • users' and solvers' funds are never taken into custody
  • any network can be added, anyone can become a solver
Read the full documentation

FAQ