Skip to main content
Experimental TechnologyNon-interactive swaps on Arkade is experimental technology in active development. All code and examples presented here are for exploration and proof of concept purposes only. Do not use in production environments.
Non-interactive swaps allow users to exchange assets without requiring both parties to be online simultaneously. This pattern leverages Arkade Script’s advanced capabilities to create secure, trustless swap mechanisms.

Overview

Unlike traditional atomic swaps that require coordination between parties, non-interactive swaps allow:
  • One party to create a swap offer that can be taken by anyone
  • Takers to complete the swap at their convenience without the maker being online
  • Automatic verification of swap conditions without trusted third parties

Contract Architecture

The non-interactive swap contract uses a combination of:
  1. Hash Preimage Verification - To ensure the correct asset is being swapped
  2. Transaction Introspection - To verify output amounts and destinations
  3. Timelock Mechanisms - To allow the maker to reclaim their assets after expiration

Example Implementation

Advanced Features

Partial Fills

Non-interactive swaps can be extended to support partial fills, allowing multiple takers to each fulfill a portion of the swap:

Price Oracles

For swaps that need to execute at market price rather than a fixed rate, oracle integration can be added:

Security Considerations

When implementing non-interactive swaps, consider these security aspects:
  1. Frontrunning Protection - Consider mechanisms to prevent frontrunning of attractive swap offers
  2. Fee Management - Ensure the contract accounts for transaction fees to avoid dust outputs
  3. Replay Protection - Implement nonces or other mechanisms to prevent replay attacks
  4. Timelock Selection - Choose appropriate timelocks that balance security with capital efficiency

Future Directions

The Arkade ecosystem is exploring several enhancements to non-interactive swaps:
  • Multi-asset Swaps - Supporting swaps involving more than two assets
  • Conditional Swaps - Swaps that execute only when certain external conditions are met
  • Privacy Enhancements - Techniques to improve the privacy of swap participants