P2P Bitcoin-Settled Derivatives: Forward Contracts
Introduction to Forward Contracts
A forward contract is a derivative between two parties to buy or sell an asset at a specified future time at a predetermined price. Forwards are a very common instrument to hedge against volatility. So using US Dollar forwards someone can hedge the volatility in the US Dollar to bitcoin exchange rate.

For example, Alice enters into a US Dollar forward contract with Bob. Alice agrees to buy 5000 Dollar from Bob one month from now, at $100 per Bitcoin (i.e., 100,000 satoshi (=0.01 bitcoin) per dollar).
Alice is a miner and has to to pay monthly electricity bills, and wants to mitigate the volatility risk. This contract will entitle her to $5000 when it matures, regardless of the bitcoin exchange rate then. Bob is a trader and engages in this contract as a means of speculation, expecting the price of bitcoin to increase and turn a profit.
They agree to settle the contract in bitcoins. Parties will pay each other the difference between the agreed price and the market price in bitcoin¹. So if bitcoin depreciates in dollar value (i.e., bitcoin price goes down), Bob will pay Alice the difference. Similarly, if bitcoin appreciates, Alice will have to pay Bob.
US Dollar Forward Contracts on Bitcoin
With this forward contract, the price volatility risk is mitigated, but it introduces the counterparty risk. Alice or Bob may not honor the contract when it expires and refuse to pay.
We implement the contract using a smart contract on Bitcoin in two steps:
- Alice and Bob each locks up 50 bitcoins ($5000 * 0.01 bitcoin/dollar) into the following contract. There is no need for a 3rd party custodian for the collateral.
- When the contract matures and the oracle publishes the spot price, the collateral can be split using the published price. The counterparty risk is mitigated since neither party can cheat.
The oracle in the smart contract uses Rabin Signature to sign price feed (Line 29) and OP_PUSH_TX to split the collateral 100 bitcoins.
There are three possibilities when the contract expires:
- The price is equal to 100K sats/dollar (i.e., $100 per bitcoin). The payoff at Line 38 is 0. Alice and Bob each gets back their 50 bitcoins.
- The price is higher than 100K sats/dollar. For example, it is 200K sats/dollar (i.e., bitcoin price drops to $50). Bob shall pay Alice 5000 * (200K -100K) = 500 million sats = 5 bitcoins. Alice gets 55 bitcoins and Bob 45.
- The price is lower than 100K sats/dollar. For example, it is 50K sats/dollar (i.e., bitcoin price increases to $200). Alice shall pay Bob 5000 * (100K -50K) = 250 million sats = 2.5 bitcoins. Alice gets 47.5 bitcoins and Bob 52.5.
Discussion
We have only implemented the basic smart contract as a proof of concept. There are many ways to make it more practical, of which we list a few.
- Maximal exposure: when prices increases to 1100K sats/dollar (bitcoin price drop to $90.9). Bob shall pay Alice 5000 * (1100K -100K) = 5000 million sats = 50 bitcoins. If the prices increases further, Bob cannot pay the full amount with the 50 bitcoin collateral. More collateral is needed to counter more volatility risk.
- Settle on dollars: when a USD token is available on bitcoin, the contract can be settled in USD, instead of bitcoins. Also collateral in USD can be used.
- Fail-safe: if the oracle does not publish the needed price data, we can add a public function in the smart contract to let Alice and Bob both sign to get their collateral back.
- Multiple oracles: to mitigate the risk of a malicious oracle, more than one can be used.
Summary
We have shown a bitcoin-settled USD forward contract. It can be easily extended to any financial instrument where bitcoin-denominated funds need to be divided based on an external future value.
The underlying asset can be anything like gold, wheat, or oil. As long as there is an oracle that publishes a price, a forward contract can be built using the smart contract above.
[1] This type of forward is called a non-deliverable forward.