The First Bitcoin Cash Atomic Swap Transaction Has Been Made

Bitcoin Cash saw its first atomic swap yesterday according to the announcement of a developer who provided proof of BCH’s very first atomic swap.

That means the currency can now be exchanged for other cryptocurrencies, such as bitcoin, in a trustless manner with little risk through a process that employs bitcoin’s – and bitcoin derivatives – in-built scripting language.

That allows for what are called hash time-locked contracts (HTLCs). As the name implies, that enables very simple agreements, such as I give you A, you give me B, within a time period.

If that time-limit expires, then the agreement is not executed, with the funds simply returned to you, although here it can be complex and there might be some very edge cases.

But in most instances, due to the addition of a second level to a simple transaction through requiring another hash (a sort of private key), an exchange can be performed in such a way that neither can cheat.

In its simplest form, an atomic swap occurs by two individuals verbally or otherwise agreeing with each other to say give 1 BTC for 5BCH. Then, they use an app which does what is conceptualized below.

Andy creates a conditional transaction to pay Bella if she can sign with a hash or if they both sign for it. He then creates a second transaction which basically sends the amount to himself but after 48 hours.

Bella does the same for BCH, with both sending each other the time-locked transaction, broadcasting to the network the main/first one.

Now all they need to do to claim the funds is to provide the cryptographic proof of payment, which they both can generate at this stage, or they both sign in agreement to release each of the funds.

Otherwise, if the proof is not sent to the network or if they both don’t sign in agreement, the funds just return back. Making it all trustless because within the time period they both can claim each other’s funds. And if for some reason they don’t, then they just return back.

The time limit here is quite important, so it is unclear how the bitcoin network can handle atomic swaps during congestions when sometime transaction are delayed for days.

Which may mean it isn’t fully trustless. You have to trust the network will be able to process your proof within the time period and in any event before the return to sender second contract.

But the feature might be useful in some cases, especially in allowing decentralized exchanges between different cryptocurrencies that have the script language.