Cross-Chain Transaction

Cross-chain transactions enable trading tokens between different blockchains, without using an intermediary party in the process.

This exchange of tokens will succeed atomically. If some of the actors do not agree, each of them will receive the locked tokens back after a determined amount of time.

When talking about tokens in NEM, we are actually referring to mosaics. Catapult enables atomic swaps through secret lock / secret proof transaction mechanism.

Secret lock transaction

Use secret lock transaction to send mosaics to a recipient once an account discovers an attached secret message, known as proof.

Once announced, the specified mosaics are locked at blockchain level using the hashed secret message.

Funds are unlocked and transferred when an account announces a valid Secret Proof Transaction. The account must demonstrate knowing the proof that unlocks the transaction. Applying a hashing algorithm to the proof, which should be equal to the hashed secret message.

If the transaction duration is reached and not proved, the locked amount is returned to the initiator of the secret lock transaction.

../_images/guides-transactions-atomic-cross-chain-swap.png

Atomic cross-chain swap between public and private network

Secret lock and proof transactions enable atomic cross-chain swaps, without the necessity of trusting a third party.

Mosaic

Locked mosaic.

Duration

The duration for the funds to be released or returned.

Hash Type

Hash algorithm used, with which secret is generated.

Secret

The proof hashed.

Recipient

The address who will receive the funds once unlocked.

Based on Bitcoin Atomic Cross Chain Trading.

Secret proof transaction

Secret proof transaction is used to unlock secret lock transactions.

To unlock a secret lock transaction, the account must demonstrate that knows the proof that unlocks the transaction.

Hash Type

Hash algorithm used, to check that proof hashed equals secret.

Secret

The proof hashed.

Proof

The proof seed.