Building Defi for Bitcoin on Liquid.
This project includes:
bobtimus: a daemon which acts as an automated market-maker offering buy and sellL-BTC/L-USDttrades based on a rate pulled fromKraken. It also serves a website which acts as an interface for browser extensions to reachbobtimus' HTTP API.waves_wallet: a Liquid wallet as a browser extension. When visitingbobtimus' website, awaves_walletuser can performL-BTC/L-USDtatomic swaps in a couple of clicks.
Install nigiri from https://github.com/vulpemventures/nigiri
curl https://getnigiri.vulpem.com | bashFor our scripts you will need jq as well. You can get it from https://stedolan.github.io/jq/.
Start nodes:
./waves-scripts start_nodesFor our tools to work we need to know which asset ID is the native asset (i.e. Bitcoin).
./waves-scripts load_native_assetThis will create a file in your directory with an asset ID in it called .native_asset_id
If successful, we need to mint a new asset. This asset will be our USDT asset for the purpose of atomic swaps and lending.
The asset ID of this new asset will be in .usdt_asset_id
./waves-scripts mint_usdtOnce the environment setup is done you can go ahead and start bobtimus:
./waves-scripts start_bobtimusThis will start bobtimus in a detached mode. Its PID can be found in .bobtimus and the logs in ./logs/bobtimus.
While bobtimus is hosting a production version of waves on http://localhost:3030 you probably want a development
build while working on it.
For that run the following command and keep the terminal open. Your waves application will be reachable under
http://localhost:3004.
Note that you can use this in the browser that includes the web-extension (see next section). For trading with Bobtimus the web extension is required, so you will have to complete running the taker web extension
./waves-scripts start_webappLast but not least, you will need the web extension:
- Make sure you are in the directory of the web extension:
cd extension - Make sure you installed nodejs dependencies:
yarn install - Build the web extension, including
wasmbuild of the web extension's wallet, run:yarn watch- On MacOs we encountered probems with the default
clangcompiler.- You can overcome this by installing
llvm:brew install llvm - Then run:
CC=/usr/local/opt/llvm/bin/clang AR=/usr/local/opt/llvm/bin/llvm-ar yarn watch
- You can overcome this by installing
- On MacOs we encountered probems with the default
- Once
yarn watchhasCompleted successfullyrun:yarn start
If everything was successfully, you now see a firefox browser with the extension enabled and the browser console being opened. The latter one is useful for degbugging purposes as it will print all kinds of stuff.
With atomic swaps serving as the foundation, financial products such as borrowing and lending are on the horizon.
If you have any questions about this project or want to keep up with its development, join the COMIT-Liquid Matrix channel.