xmr-btc-swap/swap
Mohan 091ba57547
feat(wallet): Use mempool histogram for fee estimation (#358)
* feat(wallet): Use mempool.space as a secondary fee estimation source

* fix: warn if mempool client cannot be instantiated

* make clippy happy

* nitpick: rename clippy_check to clippy in justfile

* rename `estimate_fee_rate_from_mempool` to `estimate_fee_rate_from_histogram` for clarity

* dprint fmt

* make clippy happy

* change teacing level back to debug!

* change log levels

* refactors

* refactor: estimate_fee and min_relay_fee

* serde camel case

Co-authored-by: Byron Hambly <byron@hambly.dev>

* refactors

* Add comments, use Weight struct where possible

* fmt, fix testrs

* dont fallback to bitcoin::MAX, fail instead

* make mempool space optional

* fmt

* refactor: use estimate_fee(...) in max_giveable(...)

* refactor max_giveable(...)

* refactor max_giveeable to return fee as well, remove safety margin for fee

* fix compile

* fmtr

* fix(integration test): Use pre-calculated cancel / punish fees for assert_alice_punished

* fix(integration test): Use real fees for asserts

* sync wallet before transaction_fee call

* split send_to_address into sweep_balance_to_address_dynamic_fee

---------

Co-authored-by: Byron Hambly <byron@hambly.dev>
2025-05-27 15:41:24 +02:00
..
.sqlx remove sqlx cache data from git 2024-11-29 16:14:04 +01:00
migrations feat: cargo project at root 2024-08-08 00:49:04 +02:00
proptest-regressions/bitcoin feat(wallet): Use mempool histogram for fee estimation (#358) 2025-05-27 15:41:24 +02:00
src feat(wallet): Use mempool histogram for fee estimation (#358) 2025-05-27 15:41:24 +02:00
tests feat(wallet): Use mempool histogram for fee estimation (#358) 2025-05-27 15:41:24 +02:00
.gitignore upgrade(swap): Concurrent syncing, bdk upgrade, refactors (#180) 2025-05-18 22:54:03 +02:00
build.rs feat: cargo project at root 2024-08-08 00:49:04 +02:00
Cargo.toml Release version 1.1.2 (#354) 2025-05-24 20:47:02 +02:00
README.md fix(docs): Link to asb docs 2024-12-03 17:56:48 +01:00
sqlite_dev_setup.sh feat: cargo project at root 2024-08-08 00:49:04 +02:00
sqlx-data.json feat(gui): Allow to select from recently used monero addresses (#139) 2024-11-09 12:11:00 +01:00
tempdb update more links from docs/ to dev-docs/ 2024-11-29 16:11:40 +01:00

XMR to BTC Atomic Swap

This repository hosts an MVP for atomically swapping BTC to XMR. It implements the protocol described in section 3 of this paper.

More information about the protocol in this presentation and this blog post.

Currently, swaps are only offered in one direction with the swap CLI on the buying side (send BTC, receive XMR). We are working on implementing a protocol where XMR moves first, but are currently blocked by advances on Monero itself. You can read this blogpost for more information.

Quick Start

  1. Download the latest swap binary release for your operating system.
  2. Find a seller to swap with:
./swap --testnet list-sellers
  1. Swap with a seller:
./swap --testnet buy-xmr --receive-address <YOUR MONERO ADDRESS> --change-address <YOUR BITCOIN CHANGE ADDRESS> --seller <SELLER MULTIADDRESS>

For more detailed documentation on the CLI, see this README.

Becoming a market maker

Swapping of course needs two parties - and the CLI is only one of them: The taker that occasionally starts a swap with a market maker.

If you are interested in becoming a market maker you will want to run the second binary provided in this repository: asb - the Automated Swap Backend. Detailed documentation for the asb can be found in this README.

Safety

This software is using cryptography that has not been formally audited. While we do our best to make it safe, it is up to the user to evaluate whether or not it is safe to use for their purposes. Please also see section 15 and 16 of the license.

Keep in mind that swaps are complex protocols, it is recommended to not do anything fancy when moving coins in and out. It is not recommended to bump fees when swapping because it can have unpredictable side effects.

Contributing

We encourage community contributions whether it be a bug fix or an improvement to the documentation. Please have a look at the contribution guidelines.

Rust Version Support

Please note that only the latest stable Rust toolchain is supported. All stable toolchains since 1.74 should work.

Contact

Feel free to reach out to us in the COMIT-Monero Matrix channel.