Skip to main content

Try BeL2

This tutorial will walk you through the process of setting up and using the BeL2 lending app. By the end, you'll have a good understanding of how BeL2 works and be ready to explore its more advanced features.

Understanding BeL2

Before we dive into the practical steps, let's briefly explore the technology behind BeL2. BeL2 (Bitcoin-Elastos Layer 2) is an innovative framework that connects the Bitcoin and EVM ecosystems using Zero-Knowledge Proofs (ZKPs). This enables secure and efficient cross-chain interactions, allowing Bitcoin to participate in decentralized finance (DeFi) applications while maintaining its robust security model.

The key components of BeL2 work together to make this possible:

  • ZKBTC Full Nodes handle the generation and verification of Zero-Knowledge Proofs for Bitcoin transactions.
  • Arbitrator Nodes are responsible for dispute resolution, time-based execution, maintaining decentralization while earning BTC fees.
  • Smart Contracts run on the Elastos Smart Chain (ESC), enabling complex financial operations and unlocks Bitcoin value to the tradiotional Defi.
  • Cross-Chain Interoperability allows secure interaction between Bitcoin and the Elastos Smart Chain.

BeL2 embodies the principles of being secure, smart, and stable.

Secure

By leveraging Bitcoin's robust security model and using Zero-Knowledge Proofs, BeL2 ensures that all transactions and cross-chain interactions are highly secure and verifiable.

Smart

The integration with smart contracts on the Elastos Smart Chain allows for complex, programmable financial operations, bringing the power of DeFi to Bitcoin.

Stable

BeL2's architecture provides a reliable and scalable infrastructure for decentralized finance, ensuring consistent performance and minimizing risks associated with cross-chain operations.

Now that we have a basic understanding of the technology, let's get started with using the BeL2 lending app!

Prerequisites

Before you begin, you'll need a few things set up:

  • Unisat wallet for Bitcoin interactions
  • A compatible Ethereum wallet
  • The following tokens on the mainnet
    • BTC (for borrowing)
    • ELA (for gas fees on Elastos Smart Chain)
    • USDT or USDC (for lending)

Setting Up Your Wallets

Unisat Wallet Setup:

  1. Install the Unisat wallet extension for your browser
  2. Create a new wallet or import an existing one
  3. Ensure you have some BTC in your Unisat wallet

EVM Wallet Setup (MetaMask or Elastos Essentials):

  1. Install MetaMask or Elastos Essentials
  2. Create a new wallet or import an existing one
  3. Add the Elastos Smart Chain to your wallet
  4. Ensure you have some ELA in your wallet for gas fees, and USDT or USDC if you plan to be a lender. ELA is available at Chainge.Finance

Make sure to use the Elastos Smart Chain:

You can also visit Chainlist to add the Elastos Smart Chain automatically.

Connecting to the BeL2 Lending App

Now that your wallets are set up, it's time to connect to the BeL2 lending app:

  1. Visit the BeL2 lending app at https://lending.bel2.org
  2. Click on the "Connect Wallet" button
  3. Connect both your Unisat wallet and your Ethereum wallet

Once you're connected, take some time to explore the app interface. You'll see your wallet balances and available actions. Familiarize yourself with the lending options, borrowing options, current interest rates, and where you can view your active positions.

Using the BeL2 Lending App

Now, let's walk through the process of using the app, both as a lender and as a borrower.

Lending

If you want to lend, follow these steps:

  1. Click on "Lend tokens"
  2. Specify the amount of USDT or USDC you want to lend out
  3. Set the loan terms (duration, tips, interest)
  4. Confirm the transaction in your Ethereum wallet

Borrowing

To borrow, follow these steps:

  1. Browse available lending orders
  2. Select an order you want to borrow from
  3. Click "Take Order"
  4. The app will guide you through the following steps
    1. Generate a preimage for the order
    2. Sign the payload containing the order ID
    3. Provide your Bitcoin address and public key
    4. Lock your BTC collateral by sending it to the generated script address
  5. Wait for the automation service to verify your BTC transfer using Zero-Knowledge Proofs
  6. Once verified, the borrowed USDT or USDC will be transferred to your wallet

Repayment Process

When it's time to repay a loan, the process is straightforward.

As a Borrower:

  1. Click "Repay" on your active loan
  2. The app will guide you through
    1. Approving the repayment amount (borrowed amount + interest)
    2. Generating the BTC unlock transaction
    3. Signing your part of the unlock transaction
  3. Confirm the repayment transaction in your Ethereum wallet

As a Lender:

  1. You'll be notified when a borrower has repaid
  2. The app will guide you through a. Reviewing the repayment details b. Signing your part of the BTC unlock transaction
  3. Broadcast the fully signed BTC transaction to the network

Monitoring Your Positions

After completing a lending or borrowing operation, you can monitor your positions in the app. Keep an eye on:

  • Interest accrued (for lenders)
  • Outstanding loan balance (for borrowers)
  • Collateral value and health factor (for borrowers)
  • Loan expiration dates

Important Things to Remember

As you use the BeL2 lending app, keep in mind that each lending order creates a new smart contract on the Elastos Smart Chain. Both USDT and USDC on ESC are supported, but orders must be fully taken - partial borrowing isn't an option. There are multiple ways to unlock BTCs after borrowing, including normal repayment, arbitration, and time-based unlocking methods. The BeL2 system uses Zero-Knowledge Proofs to verify Bitcoin transactions, ensuring both security and privacy.

ZKP Block Explorer

To gain deeper insights into the Zero-Knowledge Proofs used in BeL2, you can use our ZKP Block Explorer. This tool allows you to view and verify the ZKPs associated with Bitcoin transactions in the BeL2 system. To learn more about how to use the ZKP Block Explorer and understand its features, check out our ZKP Block Explorer guide.

What's Next?

Congratulations on completing your first interactions with BeL2! As you become more comfortable with the platform, you might want to explore different lending and borrowing strategies, learn about the various unlocking methods for BTCs, or dive deeper into how Zero-Knowledge Proofs are used in BeL2. You could also explore BeL2's role in bridging the Bitcoin and Ethereum ecosystems.

As you become more familiar with the basics, you'll be able to take full advantage of the power of Bitcoin-backed lending and other decentralized applications on the platform.

Happy exploring!