This infographic depicts the successful execution of an atomic swap between the Particl and Decred blockchains.
Atomic Swaps are fully trustless cross-chain trades between two users of different cryptocurrencies. Decentralized escrow smart contracts are created on both chains to make sure both participants honor their end of the deal.
With the ability to trade cryptocurrencies between different blockchains without the need of a third-party, atomic swaps are believed to have the potential to spawn a brand new trustless ecosystem within the cryptocurrency scene itself. Particl intends to make the best out of this new feature by allowing any atomic swap-ready currency to be used on its privacy marketplace and Dapp platform.
- Left: The initiator can only claim the DCR coins if his secret key is included in the redeem transaction
- Right: The participant can extract the secret key from the initiator's redeem transaction and in turn claim PART coins.
- Timeline 1 - Both parties generate a deposit address on the blockchain they want to receive the coins
- Timeline 2 - Both contracts are now time-locked and the funds they contain can only be claimed if both parties follow through with the procedure. After a set period of time, funds can be refunded to the original party if the atomic swap still hasn't gone through.
- Timeline 3 - Initiator Redeem Transaction
- Timeline 4 - Participant Redeem Transaction
Initiator:
- 1- Generates a secret key and produces a hash of it
- 2- Uses the secret key to generate a Particl escrow smart contract
- 3- Includes the secret key's hash into the smart contract and makes it publicly auditable
- 4- Sends PARTs into the smart contract
Participant:
- 5- Audits the initiator's smart contract and extracts its secret key's hash
- 6- Uses the secret key's hash to generate a Decred smart contract
- 7- Sends DCRs into the smart contract
Initiator:
- 8- Claims the funds contained in the DCR smart contract thus revealing to the participant the secret key that allows for the withdrawal of the funds in the PART smart contract.
- 9- Claims the PARTs from the initiator's contract by using the secret key previously shared by the initiator.
- Decred Blockchain bar: Initiator's DCR address -> Smart Contract -> Redeem Tx
- Particl Blockchain bar: Participant's PART address -> Smart Contract -> Redeem Tx
would be good to add this directly to the repo: https://github.com/particlcommunity/pops/pop-0004