Fusion Universal Kit

A universal SDK 1inch Fusion+ atomic swap protocol across any EVM and Bitcoin-based chains.

Fusion Universal Kit

Created At

Unite Defi

Project Description

Fusion Universal Kit is an atomic swap protocol that enables trustless, decentralized exchanges between Ethereum Virtual Machine (EVM) chains and Bitcoin. Built as an extension of the Fusion+ protocol from 1inch, this kit provides a complete solution for cross-chain asset swaps with enhanced security and user experience.

🔄 How Atomic Swaps Work

The Fusion Universal Kit enables trustless cross-chain swaps through a six-step process that ensures both parties can either complete the swap or recover their funds. The entire process is orchestrated through Hash Time-Locked Contracts (HTLCs) on both chains, creating a secure bridge between EVM and Bitcoin networks.

Step 1: Order Creation and HTLC Setup

The swap begins when a maker creates an order specifying the assets they want to exchange. For example, Alice wants to swap 0.001 ETH for 0.0001 BTC. The system generates a unique hashlock (a cryptographic hash of a secret) that will be used to coordinate the swap across both chains. The taker then creates a Bitcoin HTLC using this shared hashlock, which locks the Bitcoin funds in a special address that can only be unlocked by revealing the secret or after a timeout period.

Step 2: Escrow Deployment and Bitcoin Funding

Once the Bitcoin HTLC is created, the maker deploys an EVM escrow contract that locks their ETH. This escrow contract uses the same hashlock as the Bitcoin HTLC, creating a cryptographic link between the two chains. The taker then funds the Bitcoin HTLC by sending the specified amount of Bitcoin to the HTLC address. At this point, both assets are locked in their respective chains, but neither party can access the other's funds without cooperation.

Step 3: Secret Revelation and Asset Claiming

The critical moment occurs when the maker reveals the secret (the preimage of the hashlock) to claim their Bitcoin from the HTLC. This revelation happens on the Bitcoin network through a special transaction that includes the secret in the witness data. Once the secret is revealed on-chain, it becomes publicly visible to everyone, including the taker.

Step 4: Cross-Chain Completion

With the secret now publicly available, the taker can use it to withdraw the ETH from the EVM escrow contract. The escrow contract verifies the secret matches the original hashlock before releasing the funds. This completes the atomic swap - Alice receives her Bitcoin, and Bob receives his ETH, all without requiring trust between the parties or any centralized intermediary.

How it's Made

HTLC Script Structure

The Bitcoin HTLC uses a sophisticated script that enables both claim and refund scenarios:

OP_IF
  OP_SHA256
  <hashlock>
  OP_EQUALVERIFY
  <receiverPublicKey>
  OP_CHECKSIG
OP_ELSE
  <locktime>
  OP_CHECKLOCKTIMEVERIFY
  OP_DROP
  <senderPublicKey>
  OP_CHECKSIG
OP_ENDIF

Key Features

  • P2WSH Address: Uses native SegWit for better efficiency
  • Dual Paths: Supports both claim (with secret) and refund (after timeout)
  • Time-Locked Refunds: Automatic refund capability after locktime
  • Signature Verification: Secure multi-signature requirements

Claim Transaction Structure

// Witness Stack for Claim: <signature> <secret> <1> <witnessScript>
const witnessStack = [
  signature,           // Receiver's signature
  secret,             // Revealed secret
  Buffer.from([1]),   // Choose IF branch
  witnessScript       // Full HTLC script
];
background image mobile

Join the mailing list

Get the latest news and updates