Monero-BCH Atomic Swaps

I have added optimized versions of contracts:

Contract parameters are now not at the “head” (as with contracts compiled from CashScript) but inserted where they are used. OP_IF and stack state is optimized, too, and we save 18 bytes / TX.

I changed the approach for BTC-BCH refunds to improve privacy: instead of forwarding direct to Bob’s P2PKH we now forward to a simple P2SH contract that will then forward UTXO’s contents to Bob’s P2PKH address.

This way, if happy path is used, there will be no way to tell, by just looking at BCH blockchain, whether the BCH contract was used for BTC-BCH swap or for XMR-BCH swap.

For pure BCH swaps, just remove the block of opcodes (15 bytes) that verify token state is being passed on.

Input bytecode sizes (redeem script + unlocking data) are now:

bytecode XMR-CashTokens XMR-BCH BTC-CashTokens BTC-BCH
swaplock + swaplock_swap 203 188 203 188
swaplock + swaplock_refund_start 131 116 131 116
refund + refund_complete 203 188 58 43
refund + refund_recover 131 116

The BTC variant of the contract is usable for swapping BCH with LTC and EVM chains, too.
For Taproot chains, we can get really small footprint on their end and also hide the fact that the TX is part of a swap (happy path will look like ordinary P2PK spend, and Taproot tweak would be used to reveal the refund when necessary).

3 Likes

Some updates:

@PHCitizen has successfully completed the bounty, congratulations!

@mainnet_pat has successfully raised flipstarter funds to build a swap platform, and there’s been some progress already, here’s the latest update from Pat on X:

Finished the first version of the DLEQ Tools package for Rust and JavaScript GitHub - mainnet-pat/dleq-tools
It features all routines necessary to build adaptor signatures and prove that both parties are being honest during swap

This package compiles to #nodejs and browser-compatible #wasm module. Check it out on NPM dleq-tools - npm

Next step is to build the message exchange protocol. Going to try out the #libp2p with #webrtc transport for direct browser to browser communication. Stay tuned

3 Likes

we need a good GUI for XMR-BCH atomic swaps wallet

and/or a common GUI wallet interface for both coin-swaps, coin-join and atomic swaps implementation done in one place

2 Likes

New update by @mainnet_pat on X:

$BCH :arrows_counterclockwise: $XMR atomic swap update. Finished the core functionality of the swap and implemented the happy path and refund path in a big integration test suite as per contract v4 by bchautist. One last push to support to v4.1 and I can start working on the Web3 dApp!

Check out the great SwapLock contract research and optimization at BCR

Big thanks to Woodser for helping me out with great monero-ts library and all other Monero people for being friendly and responsive

4 Likes

I published something like a paper: Cross-chain Atomic Swaps With Bitcoin Cash (BCH) Using One-Time Verifiably Encrypted Signatures (VES)

and as a new topic for SEO reasons

6 Likes

New update from @mainnet_pat on X:

I have forked cashonize and ported it to Monero blockchain. It will be the wallet for the soon to come BCH-XMR atomic swaps app: https://monujo.cash

It is a simple noncustodial single-address web wallet for everyday spendings, do not store large sums there, always back up your seeds. It uses woodser’s monero-ts with some tweaks of mine.

It is a full wallet, so it does download the raw blockchain and can be heavy on network traffic, when restoring wallets, specify the height to reduce the bandwidth, especially on mobile devices with cellular networks

Also, “monujo” means “wallet” in Esperanto. Hope it is not gibberish as I’ve looked for many Esperanto words to brand this new wallet. I pronounce it spanish-like in my head [moh-nooh-hoh], hope it is right.

4 Likes

The nice thing about the ping pong swaps is the chains don’t have tow switch. And in to context of BTC, you only have to have a little bit, and I don’t want a lot of it.

1 Like

You are a wizard for pulling this off, FYA I noticed a new bounty has been put up to integrate BCH/XMR swaps into a wallet and make usable by the average user. Not sure if this is something that interests you or someone you know.

2 Likes

Little update, @mainnet_pat has been busy implementing the swap for BasicSwap DEX: [WIP] Add BCH Support by mainnet-pat · Pull Request #124 · basicswap/basicswap · GitHub

On October 20 he wrote:

This week’s report features progress on further work towards implementing the BCH swap interface. Major achievement is the happy path (lock-spend) BCH-XMR swap completion, yay! More work is needed on three other paths:

  • lock-refund
  • lock-refund-spend
  • lock-refund-refund

These will be easier to implement as most fundamentals are already in place.

3 Likes

https://x.com/mainnet_pat/status/1850240234622967990

https://x.com/mainnet_pat/status/1850240857842094336

Absolutely incredible news. The funding part is especially bullish! As BCH gains traction & momentum, more resources are appearing from outside to fuel further growth. This is exactly what we’d expect to see from a growing community & it’s amazing to see it vindicated. Great work pat!

3 Likes

This is great news, hopefully BasicSwap gets much easier to install and set up, last time I tried I totally failed about a year ago, and I am fairly technical.

2 Likes