Skip to content

uqlidi/coinswap

 
 

Repository files navigation

Coinswap

Functioning, minimal-viable binaries and libraries to perform a trustless, p2p Maxwell-Belcher Coinswap Protocol.

MIT or Apache-2.0 Licensed Build Status Lint Status Test Status Coverage Rustc Version 1.75.0+

Latest Release Website

⚠️ Warning

This project is under active development. Mainnet use is NOT recommended.

About

Coinswap is a trustless, self-custodial atomic swap protocol built on Bitcoin. Unlike existing solutions that rely on centralized servers as single points of failure, Coinswap's marketplace is seeded in the Bitcoin blockchain itself — no central host required, anyone with a Bitcoin node can participate.

For a quicker dive into the idea, see the Website.

Sybil resistance is achieved through Fidelity Bonds: time-locked UTXOs that make Sybil attacks economically costly while simultaneously bootstrapping the marketplace on-chain.

Two roles:

  • Makers are swap service providers. They earn swap fees for supplying liquidity, compete on fee rates in an open market, and signal reliability through larger fidelity bonds. Unlike Lightning nodes, maker servers need no active management — they run in install-fund-forget mode on any consumer hardware (Umbrel, Start9, Mynode, etc.), though liquidity must remain in the node's hot wallet to serve swap requests.

  • Takers are clients initiating swaps. They pay all the fees (swap + mining), require no fidelity bond, and select makers based on bond validity, available liquidity, fee rates, and past swap history.

Multi-hop routing mirrors Lightning: swaps are routed through multiple makers, and no single maker sees the full route. The taker relays all messages between makers over Tor, keeping each maker's view partial. Protocol complexity lives entirely on the taker side, keeping maker servers lightweight. Users can choose to do either the legacy P2WSH, or more modern Taproot+Musig2 based atomic swap contracts.

The project extends Chris Belcher's teleport-transactions proof-of-concept into a production-grade implementation with full protocol handling, functional testing, sybil resistance, CLI tools, and a GUI app. The same protocol can be extended for cross-chain swaps.

For protocol-level details, see the Coinswap Protocol Specifications.

For an in-depth exploration of the repository, it's recommended to use Deep Wiki.

Executables

CLI Apps

This crate compiles into the following CLI binaries. Useful for integration testing, and dev environments.

makerd: A maker server daemon. Requires Bitcoin Core, and Tor. Runs a maker daemon to handle swap requests.

maker-cli: CLI controller for the makerd. Manage server, access wallet, view swap statistics, and more. Demo

taker: A command-line Coinswap client app to perform swaps, discover market, etc. Demo

GUI Apps

GUI apps are built using the core library rust APIs (taker api, maker api) and FFIs built on top of it to support other languages. Suitable for power users and UI/UX stress testing.

The apps provide the full suite of Coinswap operations at "near production" quality. They can be locally compiled from their respective repos, or download precompiled binaries from their release pages.

taker-app: A Desktop Coinswap client, built with the JS FFIs, to manage the all operations of coinswap wallet, discover and manage marketplace, and much more.

maker-dashboard: A Webapp for maker management dashboard, built in rust, designed for headless servers or desktops. Create and manage multiple makers, connect with the market, earn swap fees and much more, with a nice and useful UI.

Check the demo doc for quick setup guides.

Note

These apps should be considered as "examples", rather than products. We encourage all Bitcoin wallet developers to take a look at our examples, ffis, and apis, to build their own apps, or integrate Coinswap within their existing apps. App ecosystem diversity is crucial for decentralization.

Development

Testing

Extensive functional testing simulates various protocol edge cases:

cargo test --features=integration-test -- --nocapture

The Test Framework spawns toy marketplaces in Bitcoin regtest to test swap scenarios. Each test in tests/integration covers different edge cases. Start with standard_swap to understand programmatic simulation.

Contributing

Git Hooks

The repo contains pre-commit githooks to do auto-linting before commits. Set up the pre-commit hook by running:

ln -s ../../git_hooks/pre-commit .git/hooks/pre-commit

Community

Dev community: Matrix

Dev discussions predominantly happen via FOSS best practices, and by using Github as the major community forum.

The Issues, PRs and Discussions are where all the hard lifting is happening.

About

Functioning, minimal-viable binaries and libraries to perform a trustless, p2p Maxwell-Belcher Coinswap Protocol

Resources

License

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Rust 98.0%
  • Shell 1.9%
  • Dockerfile 0.1%