  Smart Contracts and transactions allow users to implement elaborate
constructions on cryptocurrency blockchains like Bitcoin and Ethereum. Many of
these constructions, including operational payment channels and atomic swaps,
use a building block called Hashed Time-Locked Contract (HTLC).
  In this work, we distill from HTLC a specification (HTLC-Spec), and present
an implementation called Mutual-Assured-Destruction Hashed Time-Locked Contract
(MAD-HTLC). MAD-HTLC employs a novel approach of utilizing the existing
blockchain operators, called miners, as part of the design. If a user
misbehaves, MAD-HTLC incentivizes the miners to confiscate all her funds. We
prove MAD-HTLC's security using the UC framework and game-theoretic analysis.
We demonstrate MAD-HTLC's efficacy and analyze its overhead by instantiating it
on Bitcoin's and Ethereum's operational blockchains.
  Notably, current miner software makes only little effort to optimize revenue,
since the advantage is relatively small. However, as the demand grows and other
revenue components shrink, miners are more motivated to fully optimize their
fund intake. By patching the standard Bitcoin client, we demonstrate such
optimization is easy to implement, making the miners natural enforcers of
MAD-HTLC.
  Finally, we extend previous results regarding HTLC vulnerability to bribery
attacks. An attacker can incentivize miners to prefer her transactions by
offering high transaction fees. We demonstrate this attack can be easily
implemented by patching the Bitcoin client, and use game-theoretic tools to
qualitatively tighten the known cost bound of such bribery attacks in presence
of rational miners. We identify bribe opportunities occurring on the Bitcoin
and Ethereum main networks where a few dollars bribe could yield tens of
thousands of dollars in reward (e.g., \$2 for over \$25K).
