Get Lightning Balance
Retrieve your Lightning wallet balance from BitGo to view inbound, outbound, and on-chain funds. See the Guide.
-
You retrieve your Lightning wallet balance by calling the Get Wallet By ID endpoint. The response includes both Lightning channel balances (inbound and outbound liquidity in millisatoshis) and on-chain Bitcoin balances (in satoshis). Your total owned balance is
balanceString+outboundBalance.
// 1. Get Lightning Balance from BitGo
export BITGO_EXPRESS_HOST="<YOUR_LOCAL_HOST>"
export WALLET_ID="<YOUR_WALLET_ID>"
export ACCESS_TOKEN="<YOUR_ACCESS_TOKEN>"
curl -X GET \
http://$BITGO_EXPRESS_HOST/api/v2/wallet/$WALLET_ID \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $ACCESS_TOKEN"
// 1. Get Lightning Balance from BitGo
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 });
console.dir(existingWallet);
Response
// 1. Get Lightning Balance from BitGo Response
{
"offchain": {
"inboundBalance": "500000000",
"inboundPendingBalance": "0",
"inboundUnsettledBalance": "0",
"outboundBalance": "1000000000",
"outboundPendingBalance": "0",
"outboundUnsettledBalance": "0",
"outboundLockedBalance": "0",
"outboundReservedBalance": "100000000",
"outboundSpendableBalance": "900000000"
},
"balanceString": "15000000",
"confirmedBalanceString": "15000000",
"spendableBalanceString": "15000000"
}