Alright, the swap has finally been demonstrated on BCH & XMR mainnets!
Timeline:
-
@PHCitizen published his Rust implementation and performed TXs on testnets
- Few hours later @mainnet_pat published a mannet TX, done using his independent implementation with mainnet-js and cashscript libraries alongside cross-compiled Rust WASM for DLEQ. Also, he optimized the BCH contract a little by removing an unnecessarry sha256 op (which I already updated - v4.1.0).
- Shortly after, PHCitizen performed TXs on mainnets and is waiting for review to claim the bounty.
We leave it to PHCitizen to complete and claim the bounty, and we wish him luck in his future endeavors!
@mainnet_pat is interested in building a real app out of this, and for that he’s seeking funding. I’m part of that flipstarter, too, but pat will be doing bulk of the work tho, I’m just doing some contract stuff & research.
I already went ahead and done some research, and realized this VES scheme will work just as well with BTC/LTC/DOGE, and can be made even simpler because those chains are scriptable (we just need OP_IF and OP_CHECKSEQUENCEVERIFY on their end), so we need just the 1 TX on BCH end for both swap & refund paths because the refund path will refund Bob directly instead of sending to the 2nd stage of the refund contract.
This is OK, because Alice doesn’t need Bob for the refund (as she does in XMR-BCH swap, where the 2nd stage is relying on another VES with roles inverted) because timelock on BTC/LTC/DOGE will just release refund path to her directly.
The BTC/LTC/DOGE contract is just this:
OP_IF
// When Alice pulls from the BCH contract, Bob will learn Alice's
// key share of this key and he can just sweep it by using this path.
<key_combined_alice_bob_ves.public_key> OP_CHECKSIG
OP_ELSE
// If timelock expires then Alice can sweep BTC back to herself using
// her own key.
<timelock_1> OP_CHECKSEQUENCEVERIFY OP_DROP
<key_alice.public_key> OP_CHECKSIG
OP_ENDIF
and I added it to my contract repo here: contracts/v4-BTC-CashTokens · master · ac-0353f40e / cross-chain-swap-ves · GitLab
Oh yeah, we can swap not just BCH but any BCH+CashTokens UTXO for XMR/BTC/LTC/DOGE. When swapping pure BCH the contract is lighter for 15 bytes of covenant code which verify CashTokens contents but other than that it all works the same.