O3 Docs
Search…
Litepaper V2

What is O3 Swap V2?

Based on O3 Swap V1, V2 is designed for cross-chain transactions between Ethereum Layer 1 and Layer 2 networks via atomic swaps. An atomic swap enables users to directly exchange the desired tokens from their encrypted wallets based on smart contracts. By this mechanism, V2 allows secure and instant transactions between traders and relayers to achieve truly non-custodial swaps and contribute to an entirely interoperable crypto ecosystem.

How does It Work?

V2 Structure

The core mechanism of O3 Swap V2 is the Hash Time-Locked Contract (HTLC), which is an EVM-compatible solution to generate a unique message for each cross-chain transaction. The user's signature on this message is used as proof for the target chain and the source chain to withdraw the asset. The whole process is executed on smart contracts without third-party involvement.
  1. 1.
    Proxy Contracts: This is the smart contract used to deposit the assets from users and relayers to achieve the exchange of assets between two different chains.
  2. 2.
    Source Chain: The chain where cross-chain transactions were initiated from.
  3. 3.
    Target Chain: The destination of cross-chain transactions.
  4. 4.
    User: The trader who initiates cross-chain transactions.
  5. 5.
    Relayer: The relayer handles users' cross-chain requests.
  6. 6.
    Event Monitor: The program is used to read the user’s deposit events.

Cross-chain Process

Step1:

The user initiates a transfer out request to the O3 contract deployed on the source chain, generates a hash lock, and sets the time limit for the cross-chain transaction. After the contract receives the request, the asset to be transferred will be deposited into the contract during the transaction time limit. It can only be withdrawn if the answer of the hash lock is provided or the transfer time limit expires.

Step2:

The event monitor will continuously monitor the actions of the O3 contract on each chain. When it finds a new cross-chain request on the source chain, it will automatically initiate a transfer request to the O3 contract deployed on the target chain and use the same hash lock provided by the user with a shorter withdrawal time limit. After deducting the relayers’ cost and network fees from the transfer amount set by the user, the equivalent amount from the relayer is deposited into the O3 contract on the target chain.

Step3:

After the user confirms the relayer has deposited the corresponding transfer amount on the target chain, the user can submit the hash lock answer to the O3 contract on the source chain. Once the O3 contract verifies the answer, it will unlock and transfer the amount set by the user on the source chain to the relayer.

Step4:

When the relayer has received the asset on the source chain, it immediately submits the hash lock answer provided by the user to the O3 contract on the target chain. At this time, the relayer’s asset deposited on the target chain will be released to the user to complete the whole cross-chain transaction.

O3 Cross-chain Relayer

The O3 cross-chain relayer achieves interoperability of Layer2 networks by allowing the contract on the target chain to verify event changes on the source chain. As the core function in the V2 cross-chain process, it is designed to relay cross-chain messages from the source chain to keep all relevant contracts updated and decrease the transaction time between Layer2 and Layer1 networks greatly and safely by HTLC technology.
O3 cross-chain relayer will be run by O3 Labs at the beginning of the V2 launch. After a period of stable operation, third-party applications will be opened to become relayers in the next phase.
Relayer requirement
  1. 1.
    A stable Linux server (2Cores, 4G RAM, at least 10G free disk space)
  2. 2.
    An evidence of stable and sufficient liquidity for relayer.

What are the advantages of HTLCs?

1. Instant transactions from Ethereum Layer 2 to Layer 1:

Optimistic Rollup is EVM and Solidity compatible which is easier and more convenient for developers to run the project on than other Layer 2 solutions. However, the long dispute periods (around 7 days) are fatal for the Optimistic Rollup adoption. O3 Swap V2 will greatly shorten the withdrawal time from Layer 2 by applying atomic swaps.

2. More decentralized and secure cross-chain transactions:

By applying the method of HTLC on V2, the cross-chain transactions between Ethereum Layer 1 and Layer 2 can be completed under a more decentralized environment, greatly decreasing the risks caused by third-party services. It will bring more transparent and higher security to users and relayers because no one can control both assets at the same time.

3. V1 and V2 service together:

O3 Swap V1 and V2 will exist at the same time with different use cases. V1 will continue to provide the cross-chain service between heterogeneous chains. V2 will run on our own cross-chain network and support the Ethereum Layer 2 to Layer 1 instant transactions.

Roadmap

2021 Q4
2022 Q1
2022 Q2
2022 Q3
Develop cross-chain 2.0 solution & launch one of V2's core components — O3 Bridge.
  1. 1.
    Publish the Token Economy V2.
  2. 2.
    Launch the O3 DAO & build the O3 Governance Community.
  1. 1.
    Launch V2 components, including O3 Hub & O3 Swap.
  2. 2.
    Complete architecture and development of the SDK of O3 Relayer.
  1. 1.
    O3 Network online & launch O3 Relayers Election Voting.
  2. 2.
    Launch the O3 Economy System.
Last modified 1mo ago