HyperSwap
The HyperSwapSDK manages HyperSwap — a public good enabling direct multi-party swaps with unlimited assets and zero fees, using merkle trees to eliminate on-chain storage costs.
Concepts
Section titled “Concepts”How HyperSwap Works
Section titled “How HyperSwap Works”Traditional atomic swaps require on-chain state for each offer. HyperSwap eliminates this by using merkle trees:
- Create offers — A maker creates multiple swap offers (e.g., “I’ll trade 100 AKTA for 50 USDC”)
- Build merkle tree — All offers are hashed into a merkle tree
- Store root — Only the merkle root is stored on-chain
- Accept with proof — A taker accepts an offer by providing the merkle proof
This allows a single user to create thousands of swap offers with minimal on-chain storage.
Atomic Execution
Section titled “Atomic Execution”Swaps execute atomically — either both sides of the trade complete, or neither does. There’s no counterparty risk.
Initialization
Section titled “Initialization”import { HyperSwapSDK } from '@akta/sdk/hyper-swap'
const hyperSwap = new HyperSwapSDK({ algorand })Key Features
Section titled “Key Features”- Zero fees — A public good with no protocol fees
- Unlimited assets — Trade any ASA for any other ASA or ALGO, with no limit on the number of assets per swap
- Merkle tree storage — Thousands of offers from a single on-chain root
- Atomic execution — Zero counterparty risk
- Cancel support — Makers can cancel their offers
HyperSwap operations through a wallet use the HyperSwapPlugin. See Wallet Plugins.