Cross-Consensus Atomic Swap

Cross-consensus atomic swap

Hash time lock contract, or HTLC for short, is a composition of a hash lock and a time lock.[1] The hash lock authorizes a claim transaction. The time lock authorizes a refund transaction. The result of this contract is either claim or refund for both parties[2], assuming that transactions are timely confirmed by the consensus algorithms. It is also named an atomic swap.

Hash Lock

Hash lock is a cross-consensus authorization mechanism that requires a preimage of a cryptographic hash.

Implemented types:

Time Lock

Time lock is a cross-consensus authorization mechanism that requires a specified consensus time or height to pass.

Implemented types:

Summary

Atomic swaps can be seen as two-way cross-consensus communication, albeit limited to exchange of fungible or non-fungible tokens. As well HTLC is a building block of second layer (L2) solutions such as payment channel networks.

RPC API

RPC API implementation is targeted for Blacknet version 0.3.

The proposed API is subject to change due to an issue 144.

References

  1. gmaxwell, Re: P2PTradeX: P2P Trading between cryptocurrencies, .
  2. satoshi, Re: BitDNS and Generalizing Bitcoin, .