Lombard
  • Unlocking Bitcoin's Potential
    • Introducing Lombard & LBTC
      • Our Value Proposition
      • The State of Bitcoin
      • Lombard's Mission & Vision
  • Lombard's Partners
    • Babylon's Bitcoin Staking
    • Lombard's Security Consortium
  • Bitcoin Staking Partners
  • LBTC: Liquid Bitcoin
    • Introduction to LBTC
    • DeFi Vaults
      • Lombard DeFi Vault
        • LBTC/LBTCv
      • Bitcoin Bera Vault
      • Sentora DeFi Vault
    • Lux & Luminary Program
      • Referral Program
      • Nov. '24 The Golden Bull
      • Dec. '24 Flash Event
    • Staking Yield Distribution
    • Supported Blockchains
    • User Guides
      • Staking BTC & Minting LBTC
      • Unstaking LBTC
      • Lombard DeFi Vault: Depositing & Withdrawing
      • Claiming BABY
      • LBTC Bridging to Sui
  • Technical Documentation
    • Smart Contracts
    • Protocol Fees
    • Protocol Architecture
      • Lombard Ledger (Consortium)
      • CubeSigner: Key Management
      • Bascule Drawbridge
      • LBTC Design
      • Babylon Staking
      • PMM Module
      • Trustless Relayer
    • Oracles
    • Audits & Bug Bounties
    • Sanctions & Risk Monitoring
    • Transaction Tracing
  • Frequently Asked Questions
    • FAQs
      • BABY FAQs
  • Developers
    • Lombard SDK V3
    • SDK FAQ
    • Lombard SDK V2 (deprecated)
  • Quick Links
    • Lombard Website
    • Lombard X (Twitter)
    • Lombard Dune Dashboard
    • Lombard Dune PoR
    • Lombard Discord Server
  • Legals
    • Terms of Service
    • Privacy Policy
    • UK Residents
Powered by GitBook
On this page
  • User Staking (Deposit BTC, Receive LBTC)
  • 1) Retrieve a BTC deposit address
  • 2) Get Exchange Rate BTC: LBTC
  • 3) Prompt the user to deposit Bitcoin
  • 4) Check the user's Bitcoin deposits
  • 5) User claims LBTC
  • User Unstaking:
  • 1) Show the Network Security Fee to the user
  • 2) Unstake the BTC
  1. Developers

Lombard SDK V1

Integrate native Bitcoin staking into your own frontend application, allowing your community easy access to all the benefits of LBTC.

Last updated 3 months ago

Lombard SDK V1 is depreciated. This document is available for informational purposes only.

Our TypeScript Lombard SDK can be integrated into any frontend application: wallets, portfolio management apps, staking dashboards, custody portals.

If you're interested in integrating our Lombard SDK please fill out this so we can issue you with a referral code.

User Staking (Deposit BTC, Receive LBTC)

1) Retrieve a BTC deposit address

Firstly, check for an existing Bitcoin deposit address. Each Bitcoin Deposit Address is associated with a destination chain and address (for minting LBTC), and a referral ID.

import { getDepositBtcAddress } from '@lombard.finance/sdk';
...
const depositBtcAddress = await getDepositBtcAddress({
  address: '0x...', // destination chain address
  chainId: 1, // destination chainID
  referralId: 'YOUR_REFERRAL_ID',
}); // bc1q...

If you have an address already, proceed to step 2. Otherwise, generate a new deposit address.

The user will first need to sign the destination address to prove ownership of their wallet address, as this will be the only place LBTC can be minted to for any deposits to the generated bitcoin deposit address.

import { signLbtcDestionationAddr } from '@lombard.finance/sdk';
...
// do connect to the wallet using web3.js or ethers.js or any other library
// and get the provider, account and chainId
const signedMessage = await signLbtcDestionationAddr({
  provider: window.ethereum,
  account: '0x...', // address of account on provider
  chainId: 1,
}); // '0x...'
import { generateDepositBtcAddress } from '@lombard.finance/sdk';
...
const depositBtcAddress = await generateDepositBtcAddress({
  address: '0x...',
  chainId: 1,
  signature: signedMessage,
  referralId: 'lombard',
}); // bc1q...

That's it! You now have an existing, or new, BTC deposit address, specify to the user. This address is a SegWit address for maximum compatibility, so your users can deposit from any wallet or centralized exchange.

2) Get Exchange Rate BTC: LBTC

It's important to show the user how much LBTC they will receive for any amount of BTC they wish to deposit. In the future we will allow automatic minting, where a small blockchain fee will be introduced to cover our costs.

import { getLBTCExchageRate } from '@lombard.finance/sdk';
...
const exchangeRate = await getLBTCExchageRate({
  chainId: 1,
  amount: 3,
});

3) Prompt the user to deposit Bitcoin

The user can now send BTC directly to the deposit address.

Note: The minimum amount is 0.0002 BTC (~$10 USD).

4) Check the user's Bitcoin deposits

import { getDepositsByAddress } from '@lombard.finance/sdk';
...
const deposits = await getDepositsByAddress({
  address: '0x...',
}); // [{...}]

5) User claims LBTC

After 6 Bitcoin confirmations, our security consortium will notarise the deposit and provide a signature. The user can then mint their LBTC with the signature provided.

import { claimLBTC } from '@lombard.finance/sdk';
...
// do connect to the wallet using web3.js or ethers.js or any other library
// and get the provider, account and chainId
const { receiptPromise, transactionHash } = await claimLBTC({
  data: 'PAYLOAD',
  proofSignature: 'SIGNATURE',
  provider: window.ethereum,
  account: '0x...',
  chainId: 1,
});
console.log(transactionHash); // '0x...'
const receipt = await receiptPromise; // {...}

User Unstaking:

1) Show the Network Security Fee to the user

2) Unstake the BTC

To unstake BTC from Lombard, a user simply unstakes against the ERC20 contract and waits for the 9-day withdrawal period, after which the BTC will be sent to the specified (not original) address.

import { unstakeLBTC } from '@lombard.finance/sdk';
...
// do connect to the wallet using web3.js or ethers.js or any other library
// and get the provider, account and chainId
const { receiptPromise, transactionHash } = await unstakeLBTC({
  btcAddress: 'bs...',
  amount: 1,
  provider: window.ethereum,
  account: '0x...',
  chainId: 1,
});
console.log(transactionHash); // '0x...'
const receipt = await receiptPromise; // {...}

Important: You must take all measures to reduce the risk of unauthorized users as per the same countries in our !

Using this signature, generate a new deposit Bitcoin address (note this can take several minutes for the to validate). Populate the referralId with the referral code we've provided you:

There is an in place to cover the Bitcoin network fee and to prevent malicious individuals from attacking the protocol. Hence, the user must only unstake amounts above this fee. This can be retrieved from the LBTC contract getBurnCommission function. Note: This will be added directly to the SDK in the future.

security consortium
Google Form
npm: @lombard.finance/sdknpm
unstaking (withdrawal) fee
Terms of Service
Logo