Use Smart Contracts on Liquid to Deploy Financial Products
Liquid Network

Use Smart Contracts on Liquid to Deploy Financial Products

Allen Piscitello

In November 2021, Liquid added an upgrade for scripting with 31 additional opcodes focused on simplifying and improving covenants: transaction introspection, 64-bit arithmetic, and more. With these opcodes, Liquid can deploy advanced smart contracts that offer financial products to traders seeking to reduce the trust requirements commonly encountered in the traditional finance world.

Two examples of these financial products are non-custodial limit orders with partial fills and fully-collateralized options contracts. Blockstream has designed and implemented smart contracts to demonstrate these use cases, illustrating Liquid’s ability to serve as Bitcoin’s financial layer.

Limit Orders

A limit order allows a buyer or seller (referred to as a maker) of an asset to set a price they would be willing to buy or sell that asset on the market. A separate trader would then decide to “take” this offer and execute the trade. This is typically done on custodial exchanges where the exchange will escrow funds from both parties and then use an internal settlement system to allocate funds to each party. This system relies on trusting a third party with funds, which can be lost due to hacks of their system or insider theft, where the third party disappears or absconds with the funds.

It was possible to perform this kind of trade on Liquid in the past, with serious limitations such as either both parties’ keys needing to be continuously online or the trade needing to be filled completely. For example, if a maker wished to sell 5 L-BTC at a price of 20,000 USDt each, and a buyer wished to buy only 2 L-BTC at that price, there was no easy way to perform this trade without the maker intervening and modifying the order to match the buyer. This requires manual intervention or the use of keys to be online, which increases complexity and poses a security risk.

The Liquid introspection opcodes can instead be used to construct covenants - a type of smart contract that ensures that an output can be spent only if the transaction that spends it meets specific criteria. With covenants, the maker can lock 5 L-BTC into a covenant that allows anyone to remove any amount of L-BTC so long as they pay the seller 20,000 USDt per L-BTC they remove. The covenant also allows the seller to take the remaining collateral to cancel the order. The funding of the limit order covenant does not need to be published to the blockchain until a taker wants to execute the trade, saving blockchain space and potential fees.

Funding transaction: Alice adds 5 L-BTC into a limit order covenant. Trade transaction: Bob pays $40,000 USDt to receive 2 L-BTC (minus network fees) from the covenant.

Options Contracts

A more advanced use case is a covered call option contract, which is an option collateralized by the underlying asset. In this scenario, an option writer sells the right (but not obligation) to buy an asset at a set price up to some point in the future (called the expiry date). After that date, if this right has not been exercised, the grantor can reclaim the collateral. Options contracts can be used to earn income on an asset when the holder would be willing to sell at a higher price in the future, or as a way for an option grantee to gain exposure to an asset while risking minimal funds.

Options contracts are typically made available via third party escrowing funds or by trading with trusted counterparties who must be counted on to settle their obligations. When using a trusted third party, users are at risk of the funds being lost or frozen, whether by technical failure, regulatory action or outright theft. When trusting the counterparty, there is risk the counterparty will be unable to fulfill their obligations. Much of the TradFi market relies on this model, which means that only a well-connected set of large companies are trusted and that insurance must be provided to ensure they are able to meet their obligations. These problems disappear when using smart contracts without the need for any intermediaries.

Options Covenant Construction

There are two fundamental positions in an options contract - a grantor (who grants the option to buy their collateral) and a grantee (who is granted the option to buy the asset in the future). These positions can then be traded. In the implementation in Liquid, these two positions are represented by separate tokens: the Grantor Token and Option Token.

Options contracts have the following terms defined:

  • Collateral asset - An asset that is being sold by the maker. [1]
  • Settlement asset - An asset that must be paid by the taker to the maker.
  • Strike price - The amount of the settlement asset that must be paid for one contract size of the collateral asset.
  • Contract size - A minimum amount of the collateral asset that must be transferred, and must be a whole multiple of this value.
  • Exercise start date - The date at which an option can be exercised.
  • Exercise expiry date - The date at which the grantor can claim their collateral back.

Options Lifecycle


An options creator defines the parameters specified above in order to create the ability to generate Option and Grantor Tokens. Initially, no Option or Grantor Tokens are generated and no collateral is locked up. Liquid allows for the generation of these tokens through reissuance tokens - a special kind of asset that can be used in a transaction to generate an associated asset. The definition process results in two of these tokens, referred to as the Option Token Generator and the Grantor Token Generator. These tokens are put into a covenant that limits their ability to be generated unless a collateral is deposited into a separate covenant, referred to as the collateral covenant.


Any user can fund an option contract by depositing collateral into the collateral covenant. A user who deposits collateral into the collateral covenant is able to generate a pair of Option and Grantor Tokens for each contract size amount of collateral deposited. For example, if a contract size is 1M sats of L-BTC and if a user deposits 100M sats of L-BTC, they would be able to generate 100 of each token. The user is then free to sell the opposite position they wish to take (or both tokens if they wish to market make).


If a user wishes to cancel their position in an option contract, they are able to burn a pair of each of the Option and Grantor Tokens in order to retrieve a contract size amount of collateral. Users may do this when they want to lock in a profit or loss, but are unable to find a counterparty to trade out of their position.


If the contract expires, a holder of Grantor Tokens can burn their tokens and claim the associated collateral. The collateral covenant ensures that the transaction can only be completed after the expiry date. For every token burned, the user is able to claim one contract size amount of the collateral from the collateral covenant.


If a holder of an Option Token wishes to exercise their option, they are able burn the token while paying the strike price of the settlement asset to a settlement covenant. By doing this, they are able to claim a contract size amount of the collateral. This covenant exists to allow the holders of the Grantor Tokens to claim the payment made by the grantee.

Settlement Claim

A holder of a Grantor Token is able to claim the amount of the settlement asset paid by the user who exercised the option. This is done by burning any amount of the Grantor Tokens and claiming the appropriate amount of funds from the settlement covenant.

Read the Options Whitepaper

For more information about the details of these constructions, please read the new whitepaper "Non-Custodial Options using Elements," coauthored by myself, Sanket Kanjalkar, and Andrew Poelstra. For further discussion you can also join the Liquid community Telegram and ask questions directly.

In the coming weeks, we will release a reference implementation of these constructs so that you can create your own options contracts using Liquid. Or you can find inspiration to build other interesting use cases on Liquid.

[1]For a L-BTC call option, L-BTC is the collateral asset; for a L-BTC put, L-USD is. While these assets serve different market purposes, from a technical perspective they are essentially the same.

If you have specific preferences, please, mark the topic(s) you would like to read: