This allows you to verify that your app correctly handles uncooperative channel closures and funds returning to the on-chain wallet. Integration with CI/CD Pipelines
nodes: - id: alice balance: 10_000_000 - id: bob balance: 5_000_000 channels: - between: [alice, bob] capacity: 4_000_000 invoices: - node: bob id: inv1 amount: 200_000 events: - time: 1000 action: pay from: alice invoice: inv1
The LND Emulator Utility, also known as lntest , is a testing framework developed by the LND team that emulates the behavior of an LND node. It allows developers to create a simulated environment that mimics the behavior of a real LND node, enabling them to test and debug their applications without having to interact with the live Lightning Network.
package for writing integration tests against a local cluster of simulated nodes. code example lnd emulator utility
version: '3.8' services: bitcoind: image: lightninglabs/bitcoin-core:24.0 container_name: bitcoind environment: - BITCOIN_NETWORK=regtest command: - -regtest=1 - -rpcauth=lightning:d18873724c3b7a5482┌──────────────┐e259e$53db0937b42d765 - -rpcallowip=0.0.0.0/0 - -rpcbind=0.0.0.0 - -server=1 - -txindex=1 ports: - "18443:18443" alice: image: lightninglabs/lnd:v0.17.0-beta container_name: lnd-alice depends_on: - bitcoind command: - --bitcoin.active - --bitcoin.regtest - --bitcoin.node=bitcoind - --bitcoind.rpchost=bitcoind:18443 - --bitcoind.rpcuser=lightning - --bitcoind.rpcpass=lightning - --rpclisten=0.0.0.0:10009 - --restlisten=0.0.0.0:8080 ports: - "10009:10009" - "8080:8080" bob: image: lightninglabs/lnd:v0.17.0-beta container_name: lnd-bob depends_on: - bitcoind command: - --bitcoin.active - --bitcoin.regtest - --bitcoin.node=bitcoind - --bitcoind.rpchost=bitcoind:18443 - --bitcoind.rpcuser=lightning - --bitcoind.rpcpass=lightning - --rpclisten=0.0.0.0:10010 - --restlisten=0.0.0.0:8081 ports: - "10010:10010" - "8081:8081" Use code with caution. 2. Launch the Network Run the network in the background: docker-compose up -d Use code with caution. 3. Interact with the Emulator Nodes
Your preferred (Go, TypeScript, Python, etc.) Your operating system (macOS, Linux, Windows)
# Clone the emulator repository git clone https://github.com/example/lnd-emulator-utility cd lnd-emulator-utility make build This allows you to verify that your app
from pyln.client import LightningRpc
The LND Emulator Utility provides a comprehensive set of tools and APIs that allow developers to simulate various scenarios, such as:
Pair the emulator with lncli --network=simnet commands to interact programmatically. Mock channel balances and routing hints are fully configurable via JSON configs. package for writing integration tests against a local
If the failure rate triggers, you might see:
However, developing applications on LND presents a unique problem: . Opening channels, pushing funds, and simulating payment failures on mainnet is prohibitively expensive. Using testnet? It’s less expensive but still slow, unreliable (due to fluctuating testnet coin availability), and introduces network latency.
Testing software directly on the Bitcoin mainnet is expensive, slow, and risky. In the Bitcoin Lightning Network ecosystem, the serves as a critical tool for developers to safely build, test, and debug applications.