M
Menuo.ca
menu & nutrition database

Lnd Emulator Utility Work 【OFFICIAL ✭】

Utility work refers to the scripts, automation, and system integrations that keep a node healthy. Examples include:

Building and testing these utilities against a live mainnet node is reckless. That is where the emulator becomes your sandbox. lnd emulator utility work


There’s no official “LND emulator” separate from LND itself. Instead, developers use: Utility work refers to the scripts, automation, and

Example to test quickly:

# Start LND in regtest (emulated environment)
lnd --bitcoin.active --bitcoin.regtest --bitcoin.node=bitcoind \
    --bitcoind.rpcuser=user --bitcoind.rpcpass=pass \
    --bitcoind.zmqpubrawblock=tcp://127.0.0.1:28332

Then use lncli to create wallet, get new address, mine blocks, open channels. Building and testing these utilities against a live


  • Ensure nodes support keysend.
  • Unlike a real LND node, simple emulators are often stateless. A payment that settles should update the channel balance. If your emulator doesn't track balance, you won't catch "insufficient local balance" errors. Solution: Use a stateful emulator like Polar, which maintains a simulated ledger.

    $ lnd-emulator --port 10009 --config test_scenarios/failure.yaml &
    $ go test ./... -cover
    $ lnd-emulator --port 10009 --config test_scenarios/success.yaml &
    $ npm run test:integration
    

    A unique utility feature required for the emulator to be useful is a "Control API"—an external interface (often REST) that allows the developer to manipulate the emulator's internal state.