/interbtc-ui

Kintsugi and Interlay App - Mint 1:1 backed BTC on Polkadot and Kusama

Primary LanguageTypeScriptApache License 2.0Apache-2.0

interBTC

interBTC: Trustless and open DeFi access for your Bitcoin.

About

The Interlay UI connects the Polkadot ecosystem with Bitcoin. It allows the creation of interBTC, a fungible token that represents Bitcoin in the Polkadot ecosystem. interBTC is backed by Bitcoin 1:1 and allows redeeming of the equivalent amount of Bitcoins by relying on a collateralized third-party. Similarly, the Kintsugi UI connects Kusama to Bitcoin using the kBTC token. In comparison to other bridge constructions (like tBTC, wBTC, or RenVM) anyone can become an intermediary by depositing collateral making interBTC the only truly open system.

The bridge itself follows the detailed specification: Explore the specification »

It is implemented as a collection of open-source Substrate modules using Rust: Explore the implementation »

Built with

You can visit bridge.interlay.io for the latest stable version of the website.

Quickstart

Make sure you have docker-compose installed locally.

You can run the UI with a local instance of the BTC-Parachain and in combination with Bitcoin regtest or Bitcoin testnet as follows:

Clone this repository and enter into the root folder.

git@gitlab.com:interlay/interbtc-ui.git
cd interbtc-ui

You can configure the application to use certain networks like the official test network, staging network, as well as a local environment. Please make use of the .env.* files to set build variables. The priority of these are defined here.

Local Development

To achieve this, create a file .env.development.local and fill it with the following contents for either the Interlay or Kintsugi network versions:

Interlay Network

REACT_APP_RELAY_CHAIN_NAME="polkadot"
DOCKER_RELAY_CHAIN_CURRENCY=DOT

Kintsugi Network

REACT_APP_RELAY_CHAIN_NAME="kusama"
DOCKER_RELAY_CHAIN_CURRENCY=KSM

Starting the UI Locally

Note: By default, use regtest for local development.

In one terminal, start the bridge, Bitcoin regtest, Vaults and oracles:

docker-compose --env-file .env.development.local up

On another terminal, start the UI:

yarn install && yarn start

Alternative Local Development Setup

From this repo, run:

rm -rf node_modules
docker-compose down -v
yarn install
docker-compose --env-file .env.regtest up

In another terminal, with the docker-compose services running, in the latest master branch from the lib (https://github.com/interlay/interbtc-api/) run: yarn install && USER_1_URI="//Charlie" yarn initialize

Then start the UI in another terminal:

set -a
source .env.regtest
yarn start-regtest

Connecting to the Interlay Development Environment

Note: This environment might be unstable. It uses the Bitcoin testnet work.

Copy the content of the .env.dev file to .env.development.local.

cp .env.dev .env.development.local

Start the UI:

yarn install && yarn start

Connecting to the Interlay Testnetwork

Note: This environment might be unstable. It uses the Bitcoin testnet work.

Copy the content of the .env.testnet file to .env.development.local.

cp .env.testnet .env.development.local

Start the UI:

yarn install && yarn start

Test

Test the project.

yarn test

Design System

Visualize the Tailwindcss configuration.

yarn tailwind-config-viewer

Locally run or build Storybook.

yarn storybook # locally run
yarn build-storybook # build

Help

Bitcoin Regtest

Regtest is a local Bitcoin instance that allows you to practically anything including sending transactions, mining blocks, and generating new addresses. For a full overview, head over to the Bitcoin developer documentation.

Sending Transactions

For the issue process, you need to send a transaction. On regtest this can be achieved with:

bitcoin-cli -regtest -rpcwallet=Alice sendtoaddress VAULT_ADDRESS AMOUNT

Mining Blocks

In regtest, blocks are not automatically produced. After you sent a transaction, you need to mine e.g. 1 block:

bitcoin-cli -regtest generatetoaddress 1 $(bitcoin-cli -regtest getnewaddress)

Getting Balances

You can query the balance of your wallet like so:

bitcoin-cli -regtest -rpcwallet=Alice getbalance

Docker

You can hard-reset the docker dependency setup with the following commands:

docker kill $(docker ps -q)
docker rm $(docker ps -a -q)
docker rmi $(docker images -q)
docker volume rm $(docker volume ls -q)

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b yourname/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin yourname/AmazingFeature)
  5. Open a Pull Request

If you are searching for a place to start or would like to discuss features, reach out to us:

License

(C) Copyright 2021 Interlay Ltd

interBTC-ui is licensed under the terms of the Apache License (Version 2.0). See LICENSE.

Contact

Website: Interlay.io

Twitter: @interlayHQ

Email: contact@interlay.io

Acknowledgements

We would like to thank the following teams for their continuous support: