Transactions flowing through the Connext network have the following lifecycle:
The end user initiates a transaction. To do so, an xcall function is called on the Connext contract where funds, gas details, target address object, chain info, as well as arbitrary data are specified.
xcall is designed to mimic solidity's lower-level call as much as possible.
The Connext contract will do the following:
- Swap passes token to the Nomad version of the same asset (if needed)
- Initiate the 30-60 minute message latency across blockchains by calling the Nomad contracts (included is a hash of the transaction details)
- Emit an event (that includes the transaction details)
Routers observe the origin chain and front the funds on the destination chain. Routers will then do the following:
- Simulate the transaction. If the tx fails, it must go through the Nomad process which is slower but can handle more “expressive” crosschain messages requiring permissioning
- Prepare the signed transaction object. Funds on the receving chain are used for this.
- Post object to the auctioneer (as a “bid”)
If the router does not have enough funds, they can also provide part of the transfer’s value.
- The auctioneer observes all underlying chains
- Bids for transactions are collected by the auctioneer every X blocks
- Correct router is selected by the auctioneer for a given transaction. Tx can be random
- Auctioneer posts bids in batches to relayer network. This submits the badges to the blockchain
An auctioneer submits a given bid to the chain. The contracts will then do the following:
- Verify that enough funds are available to execute the transaction
- Swap the Nomad-flavored funds of the router for the chain’s canonical asset
- Send swapped funds to correct target address
- If target address is a contract, calldata will be executed against the target
- Hash router param
- Store mapping of hash on router’s address in the contract
At this stage of the swap process, the transaction has already been successfully completed.
Later in the process, the Nomad message will arrive.
At this point, it is possible to submit a heavily batched transaction with the purpose of taking all pending hashes that were received over Nomad to look up if there are corresponding router addresses in the hash or router address mapping.
If this is the case, the Nomad assets are minted and distributed to the router.
Connext’s core security mechanism ensures that routers behave correctly. If a router gives an incorrect amount of funds to a user or if the wrong calldata is executed, the router will not get reimbursed.
There is a 30-60 minute lockup of a router’s funds when a transaction is relayed. This removes the lack of having to rebalance funds which has the consequence that routers have more capital available.