Skip to main content

Mint and Redeem

FAssets allows non smart contract tokens to be used with smart contracts on Flare. This guide details how to:

  • Mint: Convert testnet XRP (on XRPL Testnet) → FTestXRP (on Songbird Testnet Coston).
  • Redeem: Convert FTestXRP (on Songbird Testnet Coston) → testnet XRP (on XRPL Testnet).

Prerequisites

Tooling:

note

If you are using Windows, it is strongly recommended to use Windows Subsystem for Linux (WSL v2).

Setup

Install repository

  1. Clone the fasset-bots repository and switch to the open_beta branch:

    git clone https://github.com/flare-labs-ltd/fasset-bots.git
    cd fasset-bots
    git checkout open_beta
  2. Install the dependencies and build the project:

    yarn && yarn build
  3. Copy the environment file from .env.example to .env:

    cp .env.example .env

Configure Access Keys

The FAsset user operates with multiple keys for the Flare and underlying network chains.

  1. Generate the user's secrets:

    yarn key-gen generateSecrets --user -o secrets.json

    Among other things, this command creates wallets on the XRP Ledger and Flare networks that you will use throughout the rest of this guide.

    info

    This command can only be executed once, after which all secret keys will be generated. You must use a separate directory for each role you want to perform: agent, bot, or minter and redeemer.

    warning
    • The addresses in secrets.json are for hot wallets and should not hold large token amounts, as their private keys are on an always-online machine. Keep your main account in an offline wallet and transfer funds as needed.
    • As soon as you create the secrets.json file, back it up, and remember to back it up again whenever you add new keys. Store the backup securely, preferably on an external drive in a physical vault, as unauthorized access can compromise the agent. You need to make regular backups only if you make changes.

    :::

  2. Fund the user's Songbird Testnet Coston wallet with some CFLR to pay for gas. The user wallet's address is in the secrets.json file under the user.native.address key. You can get CFLR tokens from the Coston Faucet.

  3. Prevent other users from reading secrets.json:

    chmod 600 secrets.json
  4. Fill the native_rpc, xrp_rpc and indexer fields in the secrets.json file with the following values, note that these values only apply to Songbird Testnet Coston:

    "native_rpc": "AavSehMLhcgz3crQHH5YJ3Rt8GMQGdV9aViGilADXGnTcjij",
    "xrp_rpc": "4tg3AxysaZodxTqsCtcMnBdBIEkR6KDKGTdqBEA8g9MKq4bH",
    "indexer": "123456",

Minting FAssets

  1. Determine your FAssets lot size:

    yarn user-bot info -f FTestXRP

    Find the line in the command output that displays the lot size in this format:

    Lot size: 20 FTestXRP
  2. Find your generated XRP Ledger testnet wallet address in user.testXRP.address from the secrets.json file you created above, and fund it using either one of the faucets:

    info

    The minimum amount of FAssets you can mint is one lot, determined by the previous command. Furthermore, agents charge a fee, and you should pay for a transaction on the XRP network. Once you have selected an agent and know its fee, request enough XRP from the faucet to pay for it, plus the transaction cost.

  3. Mint the FTestXRP FAssets either by:

    Automatic agent selection: Replace LOTS with the number of lots from the first command output.

    yarn user-bot mint LOTS --fasset FTestXRP --secrets secrets.json

    OR

    Manual agent selection: List out the FAssets agents along with their minting fees:

    yarn user-bot --fasset FTestXRP agents

    Replace AGENT_ADDRESS with an agent address from the list obtained before, and LOTS with the number of lots from the first command output.

    yarn user-bot mint -a AGENT_ADDRESS LOTS --fasset FTestXRP --secrets secrets.json

Redeeming FAssets

Redeem the FTestXRP for the underlying asset obtained in the previous step by running the following command and replacing LOTS with the number of lots you want to redeem:

yarn user-bot redeem LOTS --fasset FTestXRP --secrets secrets.json

If the agent pays immediately, the redemption process takes about 5 minutes. However, if the agent delays, the redeemer must wait 500 XRPL Testnet blocks or 900 seconds, plus 5 minutes for a Flare Data Connector proof, to execute the redemption default.

What's next

Provide economic security and contribute to the stability and efficiency of FAssets, by running an: