In a recent blog post, we outlined one example use case for the new Liquid scripting upgrades: fully-collateralized options contracts that remove the need for trusted intermediaries. That post detailed the options lifecycle and commonly used terms, so if you need to become more familiar with them, we recommend starting there. It also provides plenty of background and outlines the process of issuing and managing an options contract on Liquid.
“Option contracts are a type of derivative financial instruments where 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.”
This post is to share the release of a new Liquid options client. The client runs locally, connects to the Liquid Network, and can be called from a simple web front end or local application using RPC. We have also released some new documentation that explains how to install and use the client.
If you want to understand the technical details of how the options client works you can read the whitepaper "Non-Custodial Options using Elements", coauthored by Allen Piscitello, Sanket Kanjalkar, and Andrew Poelstra.
The current release of the options client is intended as a proof of concept and we would not recommend using it to power a production options platform just yet as there are known limitations, but it provides a good example of the advanced financial instruments that are possible on Liquid.
The documentation provides details of how to:
- Install, run, and update the options client.
- Connect the options client to an Elements test network node.
- Use the RPC interface from a variety of development languages.
The site provides Python and Node.js examples of calling the options client and links to examples for other languages, such as; C#, Ruby, Java, Go, and Perl. An example local website that uses the options client is also provided to demonstrate how easy it is to build on top of the options client.
The options client currently allows the following actions to be performed over RPC, which allow for the full lifecycle management of an options contract:
- Initialize, Fund, Cancel, Expire, Exercise, and Settle.
- List locally created and imported contracts.
- View contract information (assets, strike price, etc).
- Export, Import, Remove a contract.
An example HTTP API has been written in Python using the Flask framework. This allows developers to access the options client via HTTP calls and uses JSON formatted data to serve requests. The example includes data access and scheduled job templates for developers, allowing them to wrap extra logic, persist data that is external to the options client, and integrate external services so that they are accessible from a front end.
An example website is also provided that shows how the API above can be used. The example website is written in Python using the Flask framework, but any language that can make HTTP API calls (such as JavaScript) can also be used to interact with the API.
The examples are intended to demonstrate how the options client could serve a web-based application and are not intended to serve as a production-ready application. They are intended to help get you up and running and understand the workflow of options contracts enabled by Liquid covenants.
We hope that the documentation and examples will demonstrate how easy it is to start leveraging the smart contract capabilities of Liquid.
Further Updates
We will continue to update the documentation if any new features are added to the options client. For further information, you can connect with us through the Liquid Developer Telegram channel or on the new Build On L2 community platform.