Skip to content

citadel-tech/coinswap

 
 

Coinswap

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

MIT or Apache-2.0 Licensed CI Status CI Status CI Status Coverage Rustc Version 1.75.0+

⚠️ Important

Coinswap v0.1.0 marketplace is now live on Custom Signet. Check it out here (Tor Browser required).

⚠️ Warning

This library is currently under beta development and is in an experimental stage. There are known and unknown bugs. Mainnet use is strictly NOT recommended.

About

Coinswap is a decentralized atomic swap protocol that enables trustless swaps of Bitcoin UTXOs through a decentralized, Sybil-resistant marketplace.

Existing atomic swap solutions are centralized, rely on large swap servers, and have service providers as single points of failure for censorship and privacy attacks. This project implements atomic swaps via a decentralized market-based protocol.

The project builds on Chris Belcher's teleport-transactions and has significantly matured with complete protocol handling, functional testing, Sybil resistance, and command-line applications.

Anyone can become a swap service provider (Maker) by running makerd to earn fees. Takers use the taker app to swap with multiple makers, routing through various makers for privacy. The system uses a smart-client-dumb-server philosophy with minimal server requirements, allowing any home node operator to run a maker.

The protocol employs fidelity bonds for Sybil and DoS resistance. Takers coordinate swaps and handle recovery; makers respond to queries. All communication occurs over Tor.

For technical details, see the Coinswap Protocol Specification.

Setup & Installation

Dependencies

sudo apt install build-essential automake libtool

Tor Installation: Required for all operations. Download from torproject.org for your OS. Bitcoin Core automatically detects Tor and creates anonymous services. See the Tor guide for configuration details.

Bitcoin Core: Requires fully synced, non-pruned node with RPC access on Custom Signet with -txindex enabled. Follow the bitcoind setup guide.

Build and Install

git clone https://github.com/citadel-tech/coinswap.git
cd coinswap
cargo build --release

Install the necessary binaries in your system:

sudo install ./target/release/taker /usr/local/bin/
sudo install ./target/release/makerd /usr/local/bin/  
sudo install ./target/release/maker-cli /usr/local/bin/  

Verify Setup

makerd --help
maker-cli --help
taker --help

# Test connection to market
taker fetch-offers

Applications

makerd: Server daemon for swap providers. Requires continuous uptime and Bitcoin Core RPC connection. Demo

maker-cli: RPC controller for makerd. Manage server, access wallet, view swap statistics. Demo

taker: Swap client acting as a Bitcoin wallet with swap capability. Demo

❗ Important

Always stop makerd with maker-cli stop to ensure wallet data integrity. Avoid using ctrl+c.

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 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: Discord

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

Topics

Resources

License

Unknown and 2 other licenses found

Licenses found

Unknown
LICENSE
Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Rust 99.8%
  • Shell 0.2%