$ account lightningnetwork
Lightning Network Daemon (lnd) is a full-featured Lightning Network node implementation written in Go. It enables users to participate in the Lightning Network by opening and managing payment channels, sending/receiving payments, routing payments for others, and enforcing channel contracts via blockchain monitoring. The architecture is modular, separating concerns into distinct subsystems: peer-to-peer networking (brontide, lnpeer), channel state management (channeldb, chanstate, lnwallet), payment switching and routing (htlcswitch, routing), blockchain monitoring (chainntnfs), contract enforcement (contractcourt), RPC services (lnrpc), watchtower functionality, and autopilot for automated channel management. Key entry points include the daemon (cmd/lnd/main.go), CLI (cmd/lncli/main.go), and various RPC servers. Data flows involve processing peer messages to update channel state, persisting state to pluggable backends (BoltDB, PostgreSQL, SQLite, etcd), monitoring blockchain events affecting channels, and handling RPC commands for node control and queries. External dependencies include Bitcoin full nodes (bitcoind/btcd or Neutrino), database libraries, and various Go utilities (btcutil, btcec, gRPC).