Bitcoin–Monero Cross-chain Atomic Swap
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
Go to file
Tobin C. Harding 65b0e54a5f Add a README.md file
Add a readme that describes the project. Specifically

- module structure
- what we prove and do not prove
- how we test
4 years ago
.github/workflows Swap Monero for Bitcoin 4 years ago
monero-harness Remove redundant license 4 years ago
xmr-btc Swap Monero for Bitcoin 4 years ago
.gitignore Initial commit 4 years ago
Cargo.toml Swap Monero for Bitcoin 4 years ago
LICENSE Initial commit 4 years ago
README.md Add a README.md file 4 years ago
bors.toml Swap Monero for Bitcoin 4 years ago
rust-toolchain Swap Monero for Bitcoin 4 years ago
rustfmt.toml Swap Monero for Bitcoin 4 years ago

README.md

XMR to BTC Atomic Swap

This repository is a proof of concept for atomically swapping XMR for BTC.

We define:

  • Alice to be the actor that initially holds XMR.
  • Bob to be the actor that initially holds BTC.

The repository is structured as a library and a single test function that executes the swap. The library has the following modules:

  • alice: Defines the state machine that describes the swap for Alice. This includes the messages sent to/from Alice.
  • bob: Defines the state machine that describes the swap for Bob. This includes the messages sent to/from Bob.
  • bitcoin: Keys, signing functions, transactions etc. for Bitcoin. Also includes a test wallet (see below).
  • monero: Keys, signing functions, transactions etc. for Monero. Also includes a test wallet (see below).

Currently we have a single test function that proves the following:

  • Interaction with both block chains and their respective wallets works.
  • The messages required are correct and can manually drive the state transitions to execute a swap.

Currently we do not do:

  • Actual network communication.
  • Watch the blockchain for transactions (we just assume they have been mined as soon as we broadcast and move onto the next state).
  • Verification that the UI is acceptable. Since we do everything in a single test function their is no user interaction, this is unrealistic for a real product.

Testing

We wrote a few additional libraries to facilitate testing:

Wallets

  • bitcoin module contains a test wallet by way of bitcoind.
  • monero: module contains a test wallet by way of monero-wallet-rpc.

Blockchain harnesses

We have written two harnesses for interacting with bitcoin and monero.

These harnesses wrap interaction with bitcoind and monerod/monero-wallet-rpc.

We use testcontainers-rs to spin up bitcoind, monerod, and monero-wallet-rpc in docker containers during unit/integration testing.