Layerswap V8 Atomic Bridging protocol’s specification.

Introduction

This document specifies the Layerswap V8 Atomic Bridging protocol, a permissionless and trustless cross-chain asset transfer system based on improved Hashed Timelock Contracts (PreHTLCs). The protocol aims to facilitate seamless asset movement across multiple blockchain networks without relying on third parties or oracles.

Protocol Model

Presents a series of diagrams illustrating different transaction flows within the protocol, covering both standard scenarios and edge cases.

Standard flow

Visualizes the typical sequence of actions in a successful atomic swap transaction using the protocol.

sequenceDiagram
    participant P1 as Party 1
    participant SC as Source Chain
    participant P2 as Party 2
    participant DC as Destination Chain

	
    P1->>SC: commit()
    SC-->>P2: TokenCommitted
    P2->>DC: lock()
    DC-->>P1: TokenLocked
    P1->>SC: lockCommitment()
    SC-->>P2: TokenLocked
    P2->>DC: redeem()
    DC-->>P1: TokenRedeemed
    P2->>SC: redeem()
	  SC-->>P2: TokenRedeemed

Multihop flow (WIP)

sequenceDiagram
    participant P1 as Party 1
    participant SC as Source Chain
    participant P2 as Party 2
    participant IC as Intermediary Chain
    participant P3 as Party 3
    participant DC as Destination Chain

	
    P1->>SC: commit()
    SC-->>P2: TokenCommitted
    P2->>IC: commit()
    IC-->>P3: TokenCommitted
    P3->>DC: lock()
    DC-->>P1: TokenLocked
    P1->>SC: lockCommitment()
    DC-->>P2: TokenLocked
    P2->>IC: lockCommitment()
    IC-->>P3: TokenLocked
    P3->>DC: redeem()
    DC-->P1: TokenRedeemed
    P3->>IC: redeem()
    IC-->>P2: TokenRedeemed
    P2->>SC: redeem()

Edge Cases

Explores potential failure scenarios and how the protocol handles them to ensure fund safety and transaction integrity.

1.1. Party 2 fails to release Party 1’s funds.

sequenceDiagram
    participant P1 as Party 1
    participant SC as Source Chain
    participant P2 as Party 2
    participant DC as Destination Chain

	
    P1->>SC: commit()
    SC-->>P2: TokenCommitted
    P2->>DC: lock()
    DC-->>P1: TokenLocked
    P1->>SC: lockCommitment()
    SC-->>P2: TokenLocked
    P2->>SC: redeem()
	  SC-->>P1: TokenRedeemed
    P1->>DC: redeem()
    DC-->>P1: TokenRedeemed

1.2. Party 2 fails to release at all.

sequenceDiagram
    participant P1 as Party 1
    participant SC as Source Chain
    participant P2 as Party 2
    participant DC as Destination Chain

	
    P1->>SC: commit()
    SC-->>P2: TokenCommitted
    P2->>DC: lock()
    DC-->>P1: TokenLocked
    P1->>SC: lockCommitment()
    SC-->>P2: TokenLocked
    Note over P2,DC: Timelock passes
    P2->>DC: unlock()
	  DC-->>P2: TokenUnlocked
	  Note over P1,SC: Timelock passes
    P1->>SC: unlock()
    SC-->>P1: TokenUnlocked

2. Party 1 fails to add lock to the commitment

sequenceDiagram
    participant P1 as Party 1
    participant SC as Source Chain
    participant P2 as Party 2
    participant DC as Destination Chain

	
    P1->>SC: commit()
    SC-->>P2: TokenCommitted
    P2->>DC: lock()
    DC-->>P2: TokenLocked
    
    Note over P1,SC: Timelock passes
    P1->>SC: uncommit()
    SC-->>P1: TokenUncommited
		
		Note over P2,DC: Timelock passes
    P2->>DC: unlock()
    DC-->>P2: TokenUnlocked

3. Party 2 fails to act on commitment