You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
wow-btc-swap/README.md

2.1 KiB

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.