BITFLOW Stable Swap: Testnet Guide

BitFlow Finance
8 min readOct 22, 2022

BITFLOW Labs’ Stable Swap DEX is live on Testnet for Early Access Users. Your feedback from testing the product will directly impact the user interface and protocol, as we aim to become the #1 decentralized stable swap protocol.

BITFLOW members who participate in testing, provide feedback, and help us improve the application will be rewarded — stay tuned for details! Please check out this guide on how to use our testnet.

  • The BITFLOW Testnet Early Access is open to everyone that registers for our Beta Access and joins our private community on Discord. You may register here and follow the email instructions.
  • Public Testnet Coming Soon!
  • In case of any issues, bugs, or suggestions for improvements, please post on the BITFLOW Discord 🗨┃ report-bugs channel.

About Testnet

The testnet is a separate blockchain from the Stacks mainnet analogous to a staging environment. It’s a network developers use to test their apps, smart contracts, or changes to the protocol in a production-like environment. It produces blocks at roughly the same rate as the mainnet; about 1 block every 10 minutes on average.

BitFlow StableSwap Beta: How to use the Testnet

First you want to make sure you have the Hiro Wallet app installed. If not you can find here, then set your Hiro wallet to TESTNET:

HIRO Wallet is now https://leather.io/

Connecting to BITFLOW Testnet you must first make sure you have switched from the Stacks Mainnet to the Testnet.

1 — Open the Hiro Wallet App by clicking HIRO (browser extension)

2 — Click “…”, then click “Change Network”.

3 — Select the default Stacks Testnet, and the Hiro Wallet app will display testnet name.

HIRO Wallet APP — Switching from the Stacks Mainnet to the Testnet

Ways to Use The Protocol:

  • Navigate to https://beta.bitflow.finance/
  • Go to the Faucet page, mint some stable coins and xBTC.
  • Trade stable coins on the Swap page
  • Add / remove liquidity on the Pool page
  • Use xBTC and LP tokens to generate / claim Rewards on the Earn page
Click “Connect your Wallet” Button on beta.bitflow.finance to start!

Faucet

The BITFLOW testnet faucet provides you with free xUSD, USDA, xBTC token to test with. Note: These are not the same as Tokens on mainnet and have no value!

How to receive Testnet xUSD/USDA/xBTC on Stacks Chain?

1 — Connect your Hiro Wallet to https://beta.bitflow.finance/

2 — After you connect, you’ll see the top menu navigation; click FAUCET to navigate to the BitFlow Faucet page.

3 — Select a Token from the Dropdown (xUSD/USDA/xBTC)

4 — Enter Amount

5 — Click on Confirm

6 — Tokens coming your way shortly!

The FAUCET deposit process requires an on-chain transaction to receive confirmation. This normally takes 10–15 mins in the testnet environment (this is because we are using same blocktime as mainnet).

POOL

How to provide Liquidity on BITFLOW Testnet Pools

1- First make sure you’ve followed the previous steps and grab free test tokens from our FAUCET page.

2 — Navigate to the POOL page

3 — Click ADD TO POOL

4 — Select your first Token (xUSD or USDA)

5 — Enter Amount

6 — Select the token pair to which you want to add Liquidity

7 — Enter Amount

8 — Click “Confirm” which will bring up the smart contract confirmation window where you would select “Confirm”

How to add Liquidity?

In the example below we are looking to add $2000 worth of stablecoin liquidity to the xUSD/USDA pool.

Click “Confirm” and you will be taken to a confirmation screen:

By adding Liquidity, you can earn the liquidity pool fees simply by staking on the EARN page.

How to remove Liquidity?

Removing liquidity means you want to convert your LP tokens back into the two types of tokens you originally deposited.

1 — Navigate to the POOL page

2 — Click REMOVE LIQUIDITY button

3 — Select the LP Token (USDA-xUSD-LP)

4 — Enter a percentage % of your liquidity to withdraw.

5 — Click “Confirm” which will bring up the smart contract confirmation window where you would select “Confirm”

Note: Your LP tokens represent your percentage of all the stablecoins in the pool, so depending on trading activity.. the number of each token that you get out might be different from what you put in.

For Example:

  • You Add-Liquidity: Send 100 USDA, 100 xUSD → Receive some % of LP tokens
  • Suppose traders swap xUSD for USDA more than the other way around.
  • Now, there is more xUSD in the pool than USDA
  • Remove-Liquidity: Send some % of LP tokens → 80 USDA, 120 xUSD

EARN

Earning Rewards involves escrowing your liquidity pool (LP) tokens. The first step is to acquire LP tokens (USDA-xUSD-LP), by adding liquidity to the BITFLOW pools. Please see “How to provide Liquidity on BITFLOW Testnet Pools” above.

BitFlow is a Real Yield protocol. What does this mean?

  1. All of the yield comes directly from trading activity
  2. Liquidity providers are rewarded with the same underlying tokens they escrowed.

Here’s the breakdown of how you can maximize your earnings:

  • The protocol charges 6 basis points (6% of 1%) on all swaps.
  • 3 bps reserved for LP token escrowers
  • 1 bp reserved for xbtc escrowers
  • 1 bp reserved for LPs that also escrow xBTC
  • 1 bp reserved for the protocol (so that we can keep the lights on)

When you escrow your LP tokens on the earn page, you’re signing an agreement that you will not remove liquidity from the pool for as many cycles as you choose. And in return, you will receive a share of the trading fees collected by the protocol during these cycles while your LP tokens are escrowed.

We made a design choice to share a percentage of the trading fees with verified BTC holders as well. With BitFlow Escrow, we’re starting with xBTC, and in v2 of our protocol, we will integrate native BTC escrow in a non-custodial manner. With Bitflow, your stablecoins and BTC work together to compound your wealth.

Escrow

This panel is where you can enter the amount of xBTC and/or LP tokens you wish to escrow and select the number of cycles you’ll lock up your tokens for.

1 — First, select the “EARN” tab on the top menu bar to view the escrow panel

2 — Select your Token (USDA-xUSD-LP or xBTC)

3 — Enter Amount of Tokens

4 — Using the Slider Select the Number of Cycles you are committing to (1 Cycle ~ 12 Hours)

5 — Click “Confirm” which will bring up the smart contract confirmation window where you would select “Confirm”

After signing, you should see that your transaction has been broadcasted, taking you to the “Explorer” link to verify your transaction status.

Please note that during the escrow period you select your testnet LP tokens (and the ability to remove the liquidity you are providing) are truly locked away and inaccessible until the conclusion of your final escrow cycle. (Takes 1 Cycle ~ 1 Block to claim it)

Rewards

By visiting the EARN page you can see your Rewards Panel, with your Principal in Escrow (xBTC or USDA-xUSD-LP), Your Principal to Claimed (Cycle Completed), and your total Stable Coin Rewards.

Claiming your rewards is the next step — Please follow these instructions:

View Rewards

1 — First visit the EARN page and wait a few moment while reward balances are scanned. You’ll see the Following message: Scanning in Progress: Rewards and Balances may take 2–3 minutes to load — please do not refresh page.

2 — When complete, Rewards balances will show you Principal in Escrow, Principal to Claim and My Rewards from previous cycles, updated every 12 hours = 1 Cycle.

Claim Rewards

2 — Click the “CLAIM REWARDS” button on the Rewards Panel

3 — Click “Confirm” which will bring up the smart contract confirmation window where you would select “Confirm”

Note: You can claim rewards from a cycle only after the cycle has ended.

SWAP

The Swap function on BITFLOW provides a trustless and decentralized exchange (DEX) of price-similar assets on the Stacks blockchain (such as xUSD/USDA or different versions of wrapped Bitcoin).

These traders pay fees to the protocol, which are then proportionally claimed by liquidity providers.

Using Swap

1 — First, select the “SWAP” tab on the top menu bar to navigate to the swap panel

2 — Select a Token at the top, “base token” or token that you currently hold (xUSD or USDA).

3 — Enter Amount that you will submit in the exchange

4 — Then select the token below, the “quoted” token, or token that you will receive in the exchange.

5 — Enter the MINIMUM amount you are willing to accept in return. The smart contract will return as much as possible above that amount. If trade lowers the price of the other asset too much, then the swap will fail because of too much “slippage” and you will retain your tokens.

5 — Once you are ready to move forward, click “Confirm” which will bring up the smart contract confirmation window where you would select “Confirm” to sign the transaction.

After signing, you should see that your transaction has been broadcasted, taking you to the “Explorer” link to verify your transaction status.

The central down-pointing arrow represents the direction of the swap transaction. For example, xUSD will be exchanged for USDA.

Please note that it may take up to 10–15 minutes for your balance to be updated in your wallet. BITFLOW is built through Stacks smart contracts which settle on Bitcoin. This transaction time reflects the Bitcoin block speed and processing on the Stacks network.

Thank you testing BITFLOW!

--

--

BitFlow Finance

A decentralized stable swap protocol that generates rewards for liquidity providers & native Bitcoin holders