Lightning Nodes

Integrations Tutorial

Integrations Tutorial

This guide walks you through integrating Comet Platform with popular wallets, third-party services, and applications. Whether you're connecting node management tools like ThunderHub, integrating with mobile wallets, or building custom applications, you'll find step-by-step instructions and code examples to get you started.

Estimated reading time: 18 minutes

Note: Bitcoin Core nodes are not currently available on Comet Platform. References to Bitcoin Core in this guide are for future use when the feature becomes available. Currently supported node types: LND Node and LITD (TAPD) Node.

Introduction to Comet Integrations

Comet Platform provides flexible integration options that allow you to connect your nodes with a rich ecosystem of Bitcoin and Lightning Network tools. Whether you need a visual management interface, analytics dashboards, or custom application logic, Comet's open architecture makes integration straightforward.

Integration Methods

Direct Node Access

Connect directly to your LND or Tapd nodes using REST interface with macaroon authentication.

Comet Platform API

Use Comet's Platform API to manage node lifecycle, fetch metrics, and handle operational tasks programmatically.

Webhooks

Configure event-driven integrations that trigger actions in your systems when specific events occur on your nodes.

SDK Libraries

Leverage pre-built SDK libraries (Python, JavaScript, Rust, Go) for rapid application development.

Prerequisites

Before integrating with external tools, ensure you have:

  • An active Comet Platform account

  • At least one deployed node (LND, Tapd, or Bitcoin Core)

  • Node connection details (host, port, macaroon)

  • Basic understanding of your node type and its capabilities

Wallet Integrations

ThunderHub (Web UI)

ThunderHub is a popular web-based Lightning node manager that provides a clean interface for managing channels, making payments, and monitoring your node.

What You'll Need

  • LND node running on Comet Platform

  • Node connection URL (provided in Comet Dashboard)

  • Admin macaroon (fetchable via Comet API)

  • TLS certificate (if required)

Step 1: Fetch Node Connection Details

Log into your Comet Dashboard and navigate to your LND node details page. You'll find:

  • REST Host: your-node-id.comet.platform:8080

  • Connection Instructions: Click "Connect to Node" for detailed info

Step 2: Download Your Admin Macaroon

You can fetch your encrypted macaroon via the dashboard or API:

Via Dashboard:

  1. Go to Node Details → Security → Macaroons

  2. Click "Download Encrypted Macaroon"

  3. Decrypt locally using your password

Via API:

curl -X GET "https://api.comet.platform/v1/nodes/{node_id}/macaroon" \
  -H "Authorization: Bearer YOUR_API_TOKEN"

Decrypt the macaroon:

from comet_sdk import CometClient
import base64

client = CometClient(api_key="YOUR_API_KEY")
encrypted_macaroon = client.get_encrypted_macaroon(node_id="your-node-id")

# Decrypt with your password
macaroon_hex = client.decrypt_macaroon(encrypted_macaroon, password="your-password")

Step 3: Install ThunderHub

ThunderHub can be installed locally or deployed as a container:

Docker Installation:

docker pull apotdevin/thunderhub:latest

docker run -d \
  --name thunderhub \
  -p 3000:3000 \
  -v ~/.thunderhub:/data \
  apotdevin/thunderhub:latest

Local Installation:

git clone https://github.com/apotdevin/thunderhub.git
cd thunderhub
npm install
npm run build

Step 4: Configure ThunderHub

Create a configuration file at ~/.thunderhub/accounts.yaml:

masterPassword: "your-thunderhub-password"
accounts:
  - name: "Comet LND Node"
    serverUrl: "your-node-id.comet.platform:8080"
    macaroonPath: "/path/to/admin.macaroon"
    # certificatePath: "/path/to/tls.cert" --> No needed when using Comet's TLS
    network: "mainnet"  # or "testnet"

If Comet provides TLS certificates, download them via:

curl -X GET "https://api.comet.platform/v1/nodes/{node_id}/tls-cert" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -o tls.cert

Step 5: Start ThunderHub and Connect

npm run start

Navigate to http://localhost:3000 and log in with your master password. Your Comet LND node should appear in the accounts list.

Tips for ThunderHub Integration

  • Use REST API endpoints

  • Enable auto-unlock via Comet webhooks for seamless node restarts

  • Set up ThunderHub's built-in monitoring for channel rebalancing

  • Configure HTTPS if exposing ThunderHub publicly

RTL (Ride The Lightning)

RTL is another popular web interface for LND node management, offering comprehensive Lightning Network operations.

Installation and Setup

Docker Installation:

docker pull shahanafarooqui/rtl:latest

docker run -d \
  --name rtl \
  -p 3001:3000 \
  -v ~/.rtl:/data \
  shahanafarooqui/rtl:latest

Configuration

Create RTL-Config.json:

{
  "multiPass": "your-rtl-password",
  "port": "3000",
  "defaultNodeIndex": 1,
  "nodes": [
    {
      "index": 1,
      "lnNode": "Comet LND Node",
      "lnImplementation": "LND",
      "Authentication": {
        "macaroonPath": "/path/to/admin.macaroon",
        "configPath": ""
      },
      "Settings": {
        "userPersona": "OPERATOR",
        "themeMode": "DAY",
        "themeColor": "PURPLE",
        "logLevel": "INFO",
        "lnServerUrl": "https://your-node-id.comet.platform:8080",
        "fiatConversion": true,
        "currencyUnit": "USD"
      }
    }
  ]
}

Access RTL at http://localhost:3001 and log in with your configured password.

Zeus (Mobile)

Zeus is a powerful mobile Lightning wallet that can connect to your Comet LND node for remote management.

Setup Instructions

  1. Download Zeus from App Store or Google Play

  2. Prepare Connection Details:

  3. Add Node in Zeus:

  4. Test Connection:

Security Considerations

  • Enable biometric authentication in Zeus settings

  • Configure IP whitelisting in Comet for your mobile IP (if static)

  • Consider creating a custom macaroon with limited permissions for mobile use

Creating a Limited Macaroon for Zeus:

# Connect to your node via Comet CLI
comet node exec your-node-id -- lncli bakemacaroon \
  uri:/lnrpc.Lightning/GetInfo \
  uri:/lnrpc.Lightning/ListChannels \
  uri:/lnrpc.Lightning/SendPayment \
  uri:/lnrpc.Lightning/AddInvoice

# This creates a macaroon with only specific permissions

Zap (Mobile)

Zap provides a simplified Lightning experience for mobile users.

Connection Steps

  1. Download Zap from App Store

  2. Select "Connect Remote Node"

  3. Choose "LND Node"

  4. Scan QR code or manually enter:

BlueWallet (Mobile)

BlueWallet supports LND node connections via LNDHub or direct REST API.

LNDHub Integration

BlueWallet works best with LNDHub as an intermediary:

  1. Install LNDHub server:

git clone https://github.com/BlueWallet/LndHub.git
cd LndHub
npm install
  1. Configure LNDHub to connect to your Comet LND node:

// config.js
module.exports = {
  lnd: {
    url: 'your-node-id.comet.platform:8080',
    macaroon: 'path/to/admin.macaroon',
  }
};
  1. Start LNDHub and add the connection URL to BlueWallet

Electrum (Desktop)

Electrum is a Bitcoin wallet that can connect to your Bitcoin Core node on Comet Platform.

Configuration

  1. Open Electrum → Tools → Preferences → Server

  2. Enable "Select server manually"

  3. Enter your Bitcoin Core node details:

  4. For authenticated access, configure RPC credentials from Comet Dashboard

Sparrow (Desktop)

Sparrow Wallet offers advanced Bitcoin features and can connect to your Comet Bitcoin Core node.

Setup Instructions

  1. Open Sparrow Wallet → Preferences → Server

  2. Select "Bitcoin Core"

  3. Configure connection:

  4. Test connection and enable features like UTXO selection and transaction broadcasting

Third-Party Service Integrations

Payment Processors

Integrate your Comet Lightning node with payment processing platforms to accept Bitcoin payments.

BTCPay Server Integration

  1. Deploy BTCPay Server (self-hosted or via hosting provider)

  2. Configure Lightning Network settings:

  3. Test payment flow by creating an invoice

OpenNode Integration

Connect your node to OpenNode's payment APIs:

import requests

# OpenNode API credentials
opennode_api_key = "your_opennode_key"

# Create invoice via OpenNode
response = requests.post(
    "https://api.opennode.com/v1/charges",
    headers={"Authorization": f"Bearer {opennode_api_key}"},
    json={
        "amount": 1000,  # satoshis
        "description": "Payment for services",
        "callback_url": "https://yourapp.com/webhook"
    }
)

invoice = response.json()

Block Explorers

Connect your nodes to block explorers for enhanced transaction tracking.

Mempool.space Integration

Point your Bitcoin Core node metrics to Mempool.space:

# Configure Mempool backend to use your Comet Bitcoin Core node
{
  "CORE_RPC": {
    "HOST": "your-bitcoind-node.comet.platform",
    "PORT": 8332,
    "USERNAME": "your_rpc_user",
    "PASSWORD": "your_rpc_pass"
  }
}

Blockstream Explorer API

Use Blockstream APIs alongside your node:

import requests

# Verify transaction on Blockstream while syncing with your node
tx_id = "your_transaction_id"
response = requests.get(f"https://blockstream.info/api/tx/{tx_id}")
tx_data = response.json()

Analytics Platforms

Amboss Integration

Amboss provides Lightning Network analytics and reputation scoring.

  1. Sign up at amboss.space

  2. Add your node:

Sign Verification Message:

# Via Comet CLI
comet node exec your-node-id -- lncli signmessage "amboss-verification-message"
  1. Configure Amboss features:

1ML Integration

Submit your node to 1ML.com for public listing:

  1. Find your node public key in Comet Dashboard

  2. Search for your node on 1ML

  3. Verify ownership by signing a message

  4. Set alias and contact information

Monitoring Services

Prometheus + Grafana

Set up monitoring for your Comet nodes:

Prometheus Configuration:

scrape_configs:
  - job_name: 'comet_lnd'
    static_configs:
      - targets: ['your-node-id.comet.platform:9090']
    metrics_path: '/metrics'
    scheme: 'https'

Grafana Dashboard:

Use Comet's monitoring API to fetch metrics:

from comet_sdk import CometClient

client = CometClient(api_key="YOUR_API_KEY")
metrics = client.get_node_metrics(node_id="your-node-id")

# Metrics include:
# - CPU usage
# - Memory consumption
# - Network throughput
# - Channel counts
# - Payment success rates

Application Integrations

E-commerce Platforms

WooCommerce Integration

  1. Install WooCommerce Lightning payment gateway plugin

  2. Configure plugin settings:

  3. Test checkout flow

Example Payment Flow:

from comet_sdk import CometClient

client = CometClient(api_key="YOUR_API_KEY")

# Create invoice for customer
invoice = client.create_invoice(
    node_id="your-node-id",
    amount_sats=50000,
    memo="Order #12345",
    expiry=3600
)

# Return payment_request to customer
payment_request = invoice['payment_request']

Shopify Integration

Use Shopify's payment gateway APIs with your Comet Lightning node:

  1. Create Shopify app

  2. Implement payment webhook endpoint

  3. Generate Lightning invoices via Comet SDK

  4. Monitor payment status via Comet webhooks

Accounting Software

QuickBooks Integration

Automate accounting for Lightning transactions:

from comet_sdk import CometClient
from quickbooks import QuickBooks

comet = CometClient(api_key="COMET_KEY")
qb = QuickBooks(access_token="QB_TOKEN")

# Fetch settled invoices
invoices = comet.list_invoices(node_id="your-node-id", settled=True)

for inv in invoices:
    # Create QuickBooks invoice
    qb.create_invoice(
        customer="Lightning Customer",
        amount=inv['amount_paid'] / 100000000,  # Convert to BTC
        description=inv['memo'],
        reference=inv['r_hash']
    )

Custom Applications

Building a Payment Gateway

Python Example:

from flask import Flask, request, jsonify
from comet_sdk import CometClient

app = Flask(__name__)
client = CometClient(api_key="YOUR_API_KEY")

@app.route('/create-invoice', methods=['POST'])
def create_invoice():
    data = request.json
    amount = data['amount_sats']
    description = data['description']

    invoice = client.create_invoice(
        node_id="your-node-id",
        amount_sats=amount,
        memo=description
    )

    return jsonify({
        'payment_request': invoice['payment_request'],
        'r_hash': invoice['r_hash']
    })

@app.route('/check-payment', methods=['POST'])
def check_payment():
    r_hash = request.json['r_hash']

    invoice_status = client.lookup_invoice(
        node_id="your-node-id",
        r_hash=r_hash
    )

    return jsonify({
        'settled': invoice_status['settled']
    })

if __name__ == '__main__':
    app.run(port=5000)

Node.js Example:

const express = require('express');
const { CometClient } = require('comet-sdk');

const app = express();
const client = new CometClient({ apiKey: 'YOUR_API_KEY' });

app.post('/create-invoice', async (req, res) => {
  const { amount_sats, description } = req.body;

  const invoice = await client.createInvoice({
    nodeId: 'your-node-id',
    amountSats: amount_sats,
    memo: description
  });

  res.json({
    payment_request: invoice.paymentRequest,
    r_hash: invoice.rHash
  });
});

app.listen(3000, () => {
  console.log('Payment gateway running on port 3000');
});

Integration Patterns

Webhooks Integration

Configure webhooks to receive real-time notifications about node events.

Common Webhook Events:

  • Invoice settled

  • Channel opened/closed

  • Node online/offline

  • Payment received

  • Payment sent

Setting Up Webhooks:

from comet_sdk import CometClient

client = CometClient(api_key="YOUR_API_KEY")

# Register webhook endpoint
webhook = client.create_webhook(
    node_id="your-node-id",
    url="https://yourapp.com/webhooks/comet",
    events=["invoice.settled", "channel.opened"],
    secret="your-webhook-secret"
)

Webhook Handler Example:

from flask import Flask, request
import hmac
import hashlib

app = Flask(__name__)

WEBHOOK_SECRET = "your-webhook-secret"

@app.route('/webhooks/comet', methods=['POST'])
def handle_webhook():
    # Verify signature
    signature = request.headers.get('X-Comet-Signature')
    body = request.get_data()

    expected_sig = hmac.new(
        WEBHOOK_SECRET.encode(),
        body,
        hashlib.sha256
    ).hexdigest()

    if signature != expected_sig:
        return "Invalid signature", 401

    # Process event
    event = request.json

    if event['type'] == 'invoice.settled':
        handle_invoice_settled(event['data'])
    elif event['type'] == 'channel.opened':
        handle_channel_opened(event['data'])

    return "OK", 200

See our comprehensive Webhooks Guide for more details.

API/SDK Integration

For programmatic access, use Comet's API or SDK libraries.

REST API Example:

# List all nodes
curl -X GET "https://api.comet.platform/v1/nodes" \
  -H "Authorization: Bearer YOUR_API_TOKEN"

# Get node details
curl -X GET "https://api.comet.platform/v1/nodes/{node_id}" \
  -H "Authorization: Bearer YOUR_API_TOKEN"

# Create invoice via node
curl -X POST "https://your-node-id.comet.platform:8080/v1/invoices" \
  -H "Grpc-Metadata-macaroon: $(xxd -p -c 1000 admin.macaroon)" \
  -d '{
    "value": "10000",
    "memo": "Test invoice"
  }'

See our API Reference Guide for complete documentation.

Code Examples

Complete Payment Integration Example

Python Application with Flask:

from flask import Flask, render_template, request, jsonify
from comet_sdk import CometClient
import qrcode
import io
import base64

app = Flask(__name__)
client = CometClient(api_key="YOUR_API_KEY")
NODE_ID = "your-node-id"

@app.route('/')
def index():
    return render_template('payment.html')

@app.route('/api/create-payment', methods=['POST'])
def create_payment():
    amount_usd = float(request.json['amount_usd'])
    description = request.json['description']

    # Convert USD to sats (using exchange rate API)
    amount_sats = int(amount_usd * 100000000 / btc_usd_rate())

    # Create Lightning invoice
    invoice = client.create_invoice(
        node_id=NODE_ID,
        amount_sats=amount_sats,
        memo=description,
        expiry=3600
    )

    # Generate QR code
    qr = qrcode.make(invoice['payment_request'])
    buf = io.BytesIO()
    qr.save(buf, format='PNG')
    qr_base64 = base64.b64encode(buf.getvalue()).decode()

    return jsonify({
        'invoice': invoice['payment_request'],
        'r_hash': invoice['r_hash'],
        'qr_code': f'data:image/png;base64,{qr_base64}'
    })

@app.route('/api/check-payment/<r_hash>', methods=['GET'])
def check_payment(r_hash):
    invoice = client.lookup_invoice(node_id=NODE_ID, r_hash=r_hash)

    return jsonify({
        'settled': invoice['settled'],
        'amount_paid': invoice.get('amt_paid_sat', 0)
    })

def btc_usd_rate():
    # Fetch from exchange rate API
    import requests
    response = requests.get('https://api.coindesk.com/v1/bpi/currentprice.json')
    return response.json()['bpi']['USD']['rate_float']

if __name__ == '__main__':
    app.run(debug=True)</r_hash>

Best Practices

Security Best Practices

Use Limited Macaroons: Create macaroons with only the permissions needed for each integration

Enable IP Whitelisting: Restrict node access to known IP addresses

Rotate Credentials: Regularly rotate macaroons and API keys

Use HTTPS: Always use encrypted connections for API calls

Validate Webhooks: Verify webhook signatures to prevent spoofing

Store Secrets Securely: Use environment variables or secret managers for credentials

Performance Best Practices

Cache Node Data: Cache frequently accessed data to reduce API calls

Use Webhooks: Prefer event-driven webhooks over polling

Batch Operations: Group multiple operations when possible

Monitor Rate Limits: Respect API rate limits and implement backoff strategies

Integration Best Practices

Test on Testnet: Always test integrations on testnet before mainnet

Handle Errors Gracefully: Implement retry logic and error handling

Log Everything: Maintain detailed logs for debugging

Monitor Health: Set up monitoring for integration endpoints

Document Your Integration: Keep internal documentation for maintenance

Troubleshooting

Common Integration Issues

Problem: Cannot Connect to Node

  • Verify node is running (check Comet Dashboard)

  • Confirm connection URL and port are correct

  • Check firewall rules and IP whitelisting

  • Verify macaroon is valid and not expired

Problem: Authentication Failures

  • Ensure macaroon is properly formatted (hex for most tools)

  • Verify macaroon permissions are sufficient

  • Check if macaroon was decrypted correctly

  • Confirm TLS certificate matches if required

Problem: Webhook Not Receiving Events

  • Verify webhook URL is publicly accessible

  • Check webhook signature validation logic

  • Review Comet webhook logs in dashboard

  • Test webhook endpoint with curl

  • Ensure events are properly configured

Problem: Slow API Responses

  • Check node resource utilization

  • Review network latency between your app and Comet

  • Optimize queries (reduce unnecessary API calls)

  • Consider upgrading node tier for better performance

  • Implement caching for frequently accessed data

Problem: Payment Invoice Not Settling

  • Verify Lightning channel liquidity

  • Check if invoice has expired

  • Review payment route availability

  • Inspect node logs for error messages

  • Test with a small amount first

Getting Help

If you encounter issues not covered here:

  • Check Documentation: Review our Troubleshooting & FAQs

  • Community Discord: Join our Discord server for community support

  • Support Tickets: Open a support ticket for technical assistance

  • API Status: Check status.comet.platform for service status

Last Updated: January 5, 2026

Questions or feedback? Contact us at support@comet.platform.

Table of Contents

Copyright © 2025 Comet Cash

Czech Republic VASP License Registration Nº 22053751

info@cometcash.com

All rights reserved.

Copyright © 2025 Comet Cash

Czech Republic VASP License Registration Nº 22053751

info@cometcash.com

All rights reserved.