Bitcoin Lightning Network

Overview

The Bitcoin Lightning Network is a second-layer protocol that enables fast, low-cost, and scalable bitcoin payments by conducting transactions off-chain through payment channels. These channels enable participants to transact instantly, without waiting for on-chain block confirmations. The Lightning Network also supports microtransactions, making small payments more feasible. Final balances settle on-chain only when a channel closes, reducing load on the Bitcoin base layer.

Wallets Types

Currently, BitGo offers custody Lightning wallets. However, unlike other custody wallet types at BitGo, Lightning wallets are single-signature hot wallets.

Ticker Symbols

MainnetTestnet
lnbtctlntbc

Units

On the Bitcoin network, bitcoin is divisible by 10-8 and the base unit is a satoshi (sat). However, on the Lightning Network, bitcoin is divisible by 10-12 and the base unit is a millisatoshi (msat):

  • 1 bitcoin = 100,000,000 satoshi or 100,000,000,000 millisatoshi
  • 1 satoshi = 0.00000001 bitcoin or 1,000 millisatoshis
  • 1 millisatoshi = 0.00000000001 bitcoin or 0.001 satoshi

Tokens

The Lightning blockchain doesn't natively support tokens.

Fees

Lightning transactions have no minimum or default fees.

Create Wallet

When you create a Lightning wallet, BitGo creates a Lightning node with a hosting service provider. This process takes approximately 30 minutes to complete. BitGo sends you an email notification when the wallet is ready to use.

Endpoint: Generate Wallet

export BITGO_EXPRESS_HOST="<YOUR_LOCALHOST>"
export COIN="tlntbc"
export ACCESS_TOKEN="<YOUR_ACCESS_TOKEN>"
export LABEL="<YOUR_WALLET_NAME>"
export PASSPHRASE="<YOUR_BITGO_LOGIN_PASSPHRASE>"
export ENTERPRISE_ID="<YOUR_ENTERPRISE_ID>"

curl -X POST \
  http://$BITGO_EXPRESS_HOST/api/v2/$COIN/wallet/generate \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -d '{
    "label": "'"$LABEL"'",
    "passphrase": "'"$PASSPHRASE"'",
    "enterprise": "'"$ENTERPRISE_ID"'"
    "type": "hot",
    "subType": "lightningCustody" # required for lightning wallets
}'
const { BitGo } = require('bitgo');

// Fill in with actual access token
const accessToken = '<YOUR_ACCESS_TOKEN>';

// Initialize the SDK
const bitgo = new BitGo({
accessToken: accessToken,
env: 'test',
});

// Generate hot wallet
async function createCustodialHotWallet() {
const newWallet = await bitgo.coin('tlnbtc').wallets().generateWallet({
    label: '<YOUR_WALLET_NAME>',
    passphrase: '<YOUR_BITGO_LOGIN_PASSPHRASE>',
    enterprise: '<YOUR_ENTERPRISE_ID>'
    subType: 'lightningCustody'
});

console.log(JSON.stringify(newWallet, undefined, 2));
}

Create Address

Creating an address is an important step to opening a channel on the Lightning Network, because it prompts the Lightning node to generate a single-signature address for the funding transaction.

Endpoint: Create Address

export COIN="tlnbtc"
export WALLET_ID="<YOUR_WALLET_ID>"
export ACCESS_TOKEN="<YOUR_ACCESS_TOKEN>"

curl -X POST \
  https://app.bitgo-test.com/api/v2/$COIN/wallet/$WALLET_ID/address \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $ACCESS_TOKEN"
const { BitGo } = require('bitgo');
const accessToken = '<YOUR_ACCESS_TOKEN>';

// Initialize the SDK
const bitgo = new BitGo({
  accessToken: accessToken,
  env: 'test',
  customRootURI: 'https://app.bitgo-test.com',
});

// Enter your Lightning wallet
const walletId = '<YOUR_WALLET_ID>'
const existingWallet = await bitgo.coin('tlnbtc').wallets().get({ id: walletId });

const address = await wallet.createAddress(
);
console.log(JSON.stringify(address, undefined, 2));

See Also