惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

L
LINUX DO - 最新话题
G
Google Developers Blog
J
Java Code Geeks
The GitHub Blog
The GitHub Blog
F
Full Disclosure
H
Help Net Security
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Vercel News
Vercel News
酷 壳 – CoolShell
酷 壳 – CoolShell
Recent Announcements
Recent Announcements
Help Net Security
Help Net Security
The Hacker News
The Hacker News
IT之家
IT之家
Y
Y Combinator Blog
Martin Fowler
Martin Fowler
L
Lohrmann on Cybersecurity
C
CERT Recently Published Vulnerability Notes
V
Visual Studio Blog
博客园 - 聂微东
Hacker News: Ask HN
Hacker News: Ask HN
H
Hacker News: Front Page
Know Your Adversary
Know Your Adversary
Security Latest
Security Latest
Security Archives - TechRepublic
Security Archives - TechRepublic
Simon Willison's Weblog
Simon Willison's Weblog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
T
Troy Hunt's Blog
Last Week in AI
Last Week in AI
Schneier on Security
Schneier on Security
N
News and Events Feed by Topic
博客园 - 【当耐特】
有赞技术团队
有赞技术团队
AWS News Blog
AWS News Blog
Blog — PlanetScale
Blog — PlanetScale
博客园_首页
Google DeepMind News
Google DeepMind News
Cloudbric
Cloudbric
N
News | PayPal Newsroom
A
About on SuperTechFans
S
Schneier on Security
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Hugging Face - Blog
Hugging Face - Blog
M
MIT News - Artificial intelligence
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
雷峰网
雷峰网
T
The Exploit Database - CXSecurity.com
罗磊的独立博客
K
Kaspersky official blog
The Cloudflare Blog
I
Intezer

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
LND Explained: A Developer's Intro to Bitcoin's Lightning Network Daemon
Brendan Akudo · 2026-06-15 · via DEV Community

You've heard of Bitcoin. You've maybe heard of the Lightning Network. But what exactly is LND, and why should developers care? Let's break it down — technically, but from the ground up.

The Problem: Bitcoin is Superb but Slow
Bitcoin's base layer — the blockchain itself — is intentionally slow. Every transaction must be broadcast to thousands of nodes, verified, and bundled into a block that gets mined roughly every 10 minutes. The network handles about 7 transactions per second (TPS).

Compare that to Visa's ~24,000 TPS and you quickly see the problem. Bitcoin in its raw form isn't built for buying coffee, splitting a bill, or paying a freelancer in real time.

But there's a solution — and it lives on top of Bitcoin.

Enter the Lightning Network
The Lightning Network is a Layer 2 (L2) payment protocol built on top of Bitcoin. Instead of recording every single payment on the blockchain, it lets two parties open a private payment channel, transact off-chain as many times as they want, and only settle the final balance on-chain when they're done.

Think of it like running a tab at a bar:

Opening the tab = one blockchain transaction
Each round of drinks = instant off-chain payment
Closing the tab = one final blockchain transaction

The result? Near-instant payments, near-zero fees, and massive throughput — without sacrificing Bitcoin's security.

What is LND?

LND stands for Lightning Network Daemon. It's the most widely used implementation of the Lightning Network protocol, built and maintained by Lightning Labs.

Key facts for developers:

  1. Written in Go 🐹
  2. Exposes a gRPC API (port 10009) and a REST API (port 8080)
  3. Controlled via a CLI called lncli
  4. Uses macaroons for authentication (think JWT, but for Lightning)
  5. Connects to a Bitcoin node (bitcoind or btcd) as its source of truth

Other Lightning implementations exist — like Core Lightning (CLN) and Eclair — but LND has the largest developer ecosystem and is the best entry point.

How LND Fits Into the Stack

Here's the architecture at a glance:

Your App / Bot / Service


LND (port 8080 / 10009) ← you talk to this


Bitcoin Node (bitcoind) ← watches the blockchain


Bitcoin Network ← the real blockchain

LND handles all the Lightning-specific logic: managing channels, routing payments, generating invoices, and keeping track of your node's state. Your application talks to LND through its API and never needs to interact with raw Bitcoin directly.


Core Concepts You Need to Know

  1. 🟠 Your Node

When you run LND, you become a node on the Lightning Network. Your node has:

  • A public key (your identity on the network)
  • A wallet (holds on-chain Bitcoin for opening/closing channels)
  • A set of channels (your active payment connections)
bash
lncli getinfo

This prints your node's public key, alias, active channels, and whether it's synced to the chain.


🔗 Payment Channels

A payment channel is a direct financial connection between two Lightning nodes, backed by Bitcoin locked in a multisig address on-chain.

When you open a channel with someone:

You commit some Bitcoin into a shared on-chain address (the channel capacity)
The funds are split between local balance (yours) and remote balance (theirs)
You can now send payments instantly without touching the blockchain

# Open a channel with another node
lncli openchannel \
  --node_key=<their_pubkey> \
  --local_amt=500000     # satoshis (0.005 BTC)

Channels are bidirectional — once open, both parties can send and receive, as long as they have balance on their side.


Invoices

In Lightning, the receiver creates an invoice — a payment request that includes:

  • The amount (in satoshis)
  • A payment hash (for verification)
  • An expiry time
  • Routing hints
# Create an invoice for 1000 satoshis
lncli addinvoice --amt=1000 --memo="Coffee payment"

This returns a payment_request string that starts with lnbc... — this is what the sender uses to pay you.


🔀 Routing (HTLCs)

What if you want to pay someone you don't have a direct channel with? That's where routing comes in.

Lightning routes payments through intermediate nodes using a cryptographic trick called HTLC — Hashed Timelock Contract. Here's the simplified version:

  1. Sender generates a random secret and hashes it → payment_hash
  2. Payment hops across nodes: each node locks funds saying "I'll release this if I get the preimage (secret) within X blocks"
  3. The receiver reveals the secret, unlocking funds hop by hop back to the sender

The beauty: no node in the middle can steal funds. They either forward correctly and earn a tiny fee, or the payment fails and everything is refunded. Zero trust required.


🍪 Macaroons (Auth)

LND uses macaroons for API authentication — a token-based system with built-in caveats. Think of them as JWTs with access scoping baked in.

There are three default macaroons:

  1. - admin.macaroon - full access(read + write)
  2. - readonly.macaroon - Read-only
  3. - invoice.macaroon - Create/manage invoices only

You pass these in API headers or via lncli when connecting to a remote node:

lncli --macaroonpath=/path/to/admin.macaroon getinfo

This scoping matters for production ie your public facing app should only ever get the invoice.macaroon, not the admin one.


Talking to LND via REST API

If you're building an app you'll likely call LND's REST API directly. Here's a minimal example in Go:

package main

import (
    "crypto/tls"
    "encoding/hex"
    "encoding/json"
    "fmt"
    "log"
    "net/http"
    "os"
)

type NodeInfo struct {
    Alias             string `json:"alias"`
    NumActiveChannels int    `json:"num_active_channels"`
}

func main() {
    // Read and hex-encode the macaroon
    macBytes, err := os.ReadFile("admin.macaroon")
    if err != nil {
        log.Fatal(err)
    }
    macaroon := hex.EncodeToString(macBytes)

    // Skip TLS verification for local dev (don't do this in prod!)
    client := &http.Client{
        Transport: &http.Transport{
            TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
        },
    }

    req, err := http.NewRequest("GET", "https://localhost:8080/v1/getinfo", nil)
    if err != nil {
        log.Fatal(err)
    }
    req.Header.Set("Grpc-Metadata-macaroon", macaroon)

    resp, err := client.Do(req)
    if err != nil {
        log.Fatal(err)
    }
    defer resp.Body.Close()

    var info NodeInfo
    if err := json.NewDecoder(resp.Body).Decode(&info); err != nil {
        log.Fatal(err)
    }

    fmt.Printf("Node alias: %s\n", info.Alias)
    fmt.Printf("Active channels: %d\n", info.NumActiveChannels)
}

Going Deeper: gRPC with Go

REST is great for quick integrations, but for production apps the gRPC interface is faster and type-safe. Since LND is written in Go, the integration is very clean:

package main

import (
    "context"
    "fmt"
    "log"

    "github.com/lightningnetwork/lnd/lnrpc"
    "google.golang.org/grpc"
    "google.golang.org/grpc/credentials"
)

func main() {
    // Load TLS cert
    creds, err := credentials.NewClientTLSFromFile("tls.cert", "")
    if err != nil {
        log.Fatal(err)
    }

    conn, err := grpc.Dial("localhost:10009", grpc.WithTransportCredentials(creds))
    if err != nil {
        log.Fatal(err)
    }
    defer conn.Close()

    client := lnrpc.NewLightningClient(conn)

    // Don't forget to attach your macaroon in production!
    info, err := client.GetInfo(context.Background(), &lnrpc.GetInfoRequest{})
    if err != nil {
        log.Fatal(err)
    }

    fmt.Printf("Node: %s\nChannels: %d\n", info.Alias, info.NumActiveChannels)
}


Common Gotchas for Developers

🔴 "Channels need confirmations" — Opening a channel requires your funding transaction to be confirmed on-chain (usually 3–6 blocks). On regtest, you mine these manually. On testnet, just wait a few minutes.

🔴 "Insufficient local balance" — You can only send what's on your local side of a channel. If your local balance is 0, you need inbound liquidity from the other side.

🔴 "LND won't start without a synced bitcoind" — LND depends on a running, synced Bitcoin node. Make sure bitcoind is running and accessible before starting LND.

🔴 "TLS errors in Codespaces / remote environments" — LND's TLS cert is generated for localhost. When running remotely (like in GitHub Codespaces), you may need to regenerate the cert with the right --tlsextraip or --tlsextradomain flags, or use the REST API with TLS verification disabled for local dev.


What Can You Build on LND?

Once you have LND running, the possibilities are wide:

💸 Payment processors — Accept Bitcoin Lightning payments in your app
🤖 Bots — Tip bots for Telegram, Twitter, Discord
🏦 Savings & treasury apps — Group wallets, savings pools (think chamas!)
🎮 Micropayment games — Pay-per-action gaming mechanics
📡 Streaming payments — Pay-per-second for APIs, content, bandwidth
🔐 Multiparty wallets — Shared custody with multi-signature channels


Final words...

LND transforms Bitcoin from a slow settlement layer into a real-time programmable payment rail. As a developer, you get a clean API, a mature CLI, and a rich ecosystem of libraries — all built on top of the most secure monetary network on the planet.

The mental model is simple:

  1. Connect to a Bitcoin node
  2. Fund your on-chain wallet
  3. Open payment channels with peers
  4. Send and receive instant off-chain payments
  5. Settle on-chain whenever you're done

Once that clicks, you can start building real apps — savings pools, micropayment APIs, group treasuries — on rails that are already live and working worldwide.

Happy building ladies and gentlemen.


I'd like to know if and how you learned about LND, have you incorporated it in any of your systems? What would you improve about it?