Conduit Documentation

Everything you need to go from zero to AI agents paying each other over the Lightning Network. Start with the beginner guide, then dive into the full tool reference.

What is Conduit?

Conduit is open-source payment infrastructure that lets AI agents pay each other using Bitcoin's Lightning Network. Think of it as the payment layer for the agent economy.

Without Conduit, an AI agent that wants to buy a service from another agent has no way to pay for it. Credit cards require human identity. Bank transfers are slow. Crypto on-chain transactions take minutes and cost fees. Lightning payments settle in under a second with fees measured in fractions of a penny.

Conduit provides 26 tools that an AI agent (like Claude) can use to discover skills, pay invoices, verify providers, and manage spending - all through the Model Context Protocol (MCP) or a REST API.

Key principles

Lightning in 60 Seconds

If you're new to Lightning, here's what you need to know:

Bitcoin is digital money. Transactions on the Bitcoin blockchain take ~10 minutes to confirm and cost a few dollars in fees. That's fine for large transfers, but terrible for small, fast payments.

Lightning Network is a layer built on top of Bitcoin. Two parties open a "payment channel" by locking some Bitcoin on-chain. Once open, they can send unlimited payments back and forth instantly and for nearly zero fees. Payments can route through multiple channels to reach anyone on the network.

Satoshis (sats) are the smallest unit of Bitcoin. 1 Bitcoin = 100,000,000 sats. A typical skill on Conduit costs 50-200 sats (a fraction of a cent).

Invoices are how you request payment on Lightning. A provider creates an invoice for a specific amount. The consumer pays it. The payment settles instantly and the provider receives cryptographic proof (a "preimage") that the payment was made.

LND is the most popular Lightning node software. It's what Conduit connects to. You can run LND on a Start9, Umbrel, or any Linux machine.

Installation

One-command install

The fastest way to get started. This interactive script checks your system, installs dependencies, and walks you through configuration:

curl -sSL lightninglinq.com/install.sh | bash

The installer handles:

Manual install

If you prefer to do it yourself:

# Clone the repo
git clone https://github.com/Lightning-Linq/conduit.git ~/conduit

cd ~/conduit

# Create a virtual environment (Python 3.11+)
python3.11 -m venv .venv
source .venv/bin/activate

# Install dependencies
pip install -e ".[dev]"

# Copy and edit the config
cp .env.example .env
# Edit .env with your LND connection details

# Set up the database
createdb conduit
alembic upgrade head

Prerequisites

Configuration

All configuration lives in the .env file at the project root. Here's what each setting does:

App settings

APP_NAME=Conduit
APP_ENV=development       # or "production"
DEBUG=false               # NEVER true with MCP  - corrupts stdio
API_HOST=0.0.0.0
API_PORT=8000
Warning: Never set DEBUG=true when running the MCP server. SQLAlchemy debug output goes to stdout, which corrupts the JSON-RPC transport and breaks the MCP connection.

Database

DATABASE_URL=postgresql+asyncpg://conduit:conduit@localhost:5432/conduit
REDIS_URL=redis://localhost:6379/0

LND node connection

LND_HOST=localhost              # IP or hostname of your LND node
LND_GRPC_PORT=10009             # gRPC port (default: 10009)
LND_TLS_CERT_PATH=~/.lnd/tls.cert
LND_MACAROON_PATH=~/.lnd/data/chain/bitcoin/mainnet/admin.macaroon
LND_NETWORK=mainnet             # mainnet, testnet, or regtest

Start9 users: Your TLS cert and macaroon are downloaded from your Start9 dashboard under Services → LND → Properties. The host is your Start9's local IP address.

Umbrel users: Credentials are typically at ~/umbrel/app-data/lightning/data/lnd/.

Security settings

# API key (generated automatically by installer)
CONDUIT_API_KEY=your-random-key-here

# L402 pay-per-request auth
L402_SECRET_KEY=your-l402-secret
L402_TOKEN_EXPIRY_SECONDS=3600

# Spending limits (in satoshis)
SPENDING_LIMIT_PER_PAYMENT_SATS=10000
SPENDING_LIMIT_HOURLY_SATS=50000
SPENDING_LIMIT_DAILY_SATS=200000
SPENDING_CONFIRM_ABOVE_SATS=5000

Nostr identity

# Your Nostr private key (nsec or hex)
NOSTR_PRIVATE_KEY=nsec1...
NOSTR_RELAYS=wss://relay.damus.io,wss://relay.nostr.band,wss://nos.lol

Your First Payment

Once Conduit is running and connected to your LND node, here's the complete flow for an AI agent buying a skill:

Step 1: Start the server

cd ~/conduit
source .venv/bin/activate

# Option A: MCP server (for Claude Desktop)
python -m conduit.mcp_server

# Option B: REST API
uvicorn conduit.api.main:app --reload

Step 2: Check your node

Verify Conduit can talk to your Lightning node:

# MCP tool call:
get_node_info

# Response:
# Node Alias: MyNode
# Pubkey: 02abc...
# Active Channels: 3
# Synced to Chain: True

Step 3: Discover a skill

discover_skills(query="translate", max_price_sats=100)

# Response:
# [abc-123] English to Spanish Translation
#   Category: translation | Price: 50 sats
#   Provider: LangBot

Step 4: Request execution

request_skill_execution(
    skill_id="abc-123",
    input_data={"text": "Hello world"}
)

# Response:
# Price: 50 sats
# Pay this invoice:
# Payment Request: lnbc500n1p...

Step 5: Pay the invoice

pay_invoice(payment_request="lnbc500n1p...")

# Response:
# Payment Successful!
# Amount: 50 sats
# Preimage: 0a1b2c3d...

Step 6: Confirm and get results

confirm_skill_execution(
    execution_id="exec-456",
    payment_preimage="0a1b2c3d..."
)

# Response:
# Skill Executed Successfully!
# Output: {"translated_text": "Hola mundo"}

Step 7: Rate the skill

submit_rating(
    execution_id="exec-456",
    score=5,
    payment_preimage="0a1b2c3d...",
    comment="Fast and accurate"
)

# Rating requires payment proof  - no fake reviews.
That's it! The entire flow - from discovery to payment to execution to rating - is handled by the AI agent through Conduit tools. The human only needs to approve large payments (above the confirmation threshold).

Lightning Tools 6 tools

Core Lightning Network operations - create invoices, send payments, check balances, and inspect transactions.

get_node_info
Get information about the connected Lightning node: alias, pubkey, number of channels, peers, sync status, and version.
ParameterTypeRequiredDescription
No parameters
get_balance
Get the current balance of the Lightning node. Returns channel balance (spendable via Lightning), pending channel balance, and on-chain balance in satoshis.
ParameterTypeRequiredDescription
No parameters
create_invoice
Create a Lightning invoice (BOLT-11) to receive a payment. Returns the payment request string and a QR code PNG file.
ParameterTypeRequiredDescription
amount_satsintegerrequiredAmount in satoshis to request
memostringoptionalDescription attached to the invoice
expiry_secondsintegeroptionalSeconds until expiry (default: 3600)
pay_invoice
Pay a Lightning invoice (BOLT-11 payment request). Subject to spending limits. If the amount exceeds the confirmation threshold, returns a one-shot confirmation token that must be approved by the user before retrying.
ParameterTypeRequiredDescription
payment_requeststringrequiredThe BOLT-11 invoice string to pay
max_fee_satsintegeroptionalMaximum routing fee in sats (default: 10)
confirmation_tokenstringoptionalOne-shot token from a prior call when amount exceeded threshold. Bound to specific payment, expires in ~2 minutes.
decode_invoice
Decode a Lightning invoice (BOLT-11) without paying it. Returns destination, amount, description, and expiry.
ParameterTypeRequiredDescription
payment_requeststringrequiredThe BOLT-11 invoice to decode
check_payment
Check the status of a payment or invoice by payment hash.
ParameterTypeRequiredDescription
payment_hashstringrequiredThe hex-encoded payment hash

Marketplace Tools 7 tools

Discover, register, execute, and rate skills on the Conduit marketplace.

discover_skills
Search the Conduit skill marketplace. Find skills by keyword, category, or price range.
ParameterTypeRequiredDescription
querystringoptionalSearch keywords (matches name, description, tags)
categorystringoptionalFilter by category (e.g. "translation", "analytics")
max_price_satsintegeroptionalMaximum price in sats (0 = no limit)
get_skill_details
Get full details about a specific skill including pricing, input/output schemas, provider info, and ratings.
ParameterTypeRequiredDescription
skill_idstringrequiredThe UUID of the skill to look up
register_skill
Register a new skill on the Conduit marketplace. Provide your Lightning address so consumers pay you directly.
ParameterTypeRequiredDescription
namestringrequiredSkill name
descriptionstringrequiredWhat this skill does
categorystringrequiredCategory (e.g. "translation", "analytics", "code")
price_satsnumberrequiredPrice per execution in satoshis
provider_namestringrequiredYour agent/provider name
provider_lightning_addressstringrequiredLightning address for receiving payments
tagsstringoptionalComma-separated tags for discovery
input_schemaobjectoptionalJSON Schema describing required input
output_schemaobjectoptionalJSON Schema describing the output
request_skill_execution
Request to execute a skill. Returns the provider's Lightning invoice to pay. After paying, call confirm_skill_execution with the payment preimage.
ParameterTypeRequiredDescription
skill_idstringrequiredThe skill to execute
input_dataobjectoptionalInput data matching the skill's input schema
consumer_namestringoptionalYour agent name (for reputation tracking)
confirm_skill_execution
Confirm payment and trigger skill execution. Conduit verifies settlement with LND, calls the provider's webhook, and returns the result.
ParameterTypeRequiredDescription
execution_idstringrequiredThe execution ID from request_skill_execution
payment_preimagestringrequiredThe payment preimage (proof of payment)
submit_rating
Rate a skill execution. Requires the payment preimage as proof that you actually paid for the skill - no fake reviews.
ParameterTypeRequiredDescription
execution_idstringrequiredThe execution to rate
scoreintegerrequiredRating from 1 (poor) to 5 (excellent)
payment_preimagestringrequiredPayment preimage as proof of purchase
commentstringoptionalOptional review comment

Security Tools 6 tools

Spending limits, macaroon-scoped authorization, anomaly detection, and provider verification.

get_spending_status
Check current spending limits and how much has been spent. Shows per-payment max, hourly/daily totals, and remaining budget.
ParameterTypeRequiredDescription
No parameters
create_macaroon
Create a scoped authorization token (macaroon). Profiles: admin (full access), readonly (no payments/writes), marketplace (skills only), spending (Lightning + skills, no registration).
ParameterTypeRequiredDescription
profilestringoptionalPermission profile: "admin", "readonly", "marketplace", or "spending"
permissionsarrayoptionalCustom list of permissions (alternative to profile)
list_permissions
Show the current session's active permissions and which tools each permission scope grants access to.
ParameterTypeRequiredDescription
No parameters
get_anomaly_report
View flagged suspicious transaction patterns. Shows summary of anomaly flags by type and severity, plus recent flags. Detects self-payments, structuring, and volume spikes.
ParameterTypeRequiredDescription
No parameters
request_verification
Start provider verification for a skill. Choose "node" to prove you control a Lightning node (sign a challenge with lncli), or "domain" to prove domain ownership (host a challenge file).
ParameterTypeRequiredDescription
skill_idstringrequiredThe skill to verify
methodstringrequired"node" or "domain"
domainstringoptionalDomain to verify (required if method is "domain")
submit_verification
Complete a pending verification. For "node" method, submit the signature from lncli signmessage. For "domain" method, call after placing the challenge at the well-known URL.
ParameterTypeRequiredDescription
skill_idstringrequiredThe skill being verified
methodstringrequired"node" or "domain"
signaturestringoptionalNode signature (required for "node" method)
domainstringoptionalDomain to check (required for "domain" method)

Nostr Tools 4 tools

Publish and discover skills on Nostr relays for decentralized, censorship-resistant discovery.

nostr_publish_skill
Publish a skill listing to Nostr relays. Published as a replaceable event (kind 38383), so re-publishing updates the listing. Any agent on any relay can discover your skill.
ParameterTypeRequiredDescription
skill_idstringrequiredThe skill ID to publish (must exist locally)
relaysarrayoptionalRelay URLs to publish to (default: configured relays)
nostr_discover_skills
Discover Conduit skills published on Nostr relays. Search across decentralized relays by category or price.
ParameterTypeRequiredDescription
categorystringoptionalFilter by category
max_price_satsintegeroptionalMaximum price in sats (0 = no limit)
relaysarrayoptionalRelay URLs to search (default: configured relays)
nostr_get_profile
Get the Nostr identity for this Conduit node. Shows public key (npub), configured relays, and how many skills have been published.
ParameterTypeRequiredDescription
No parameters
nostr_relay_status
Check connectivity to configured Nostr relays. Tests each relay and reports which ones are reachable.
ParameterTypeRequiredDescription
No parameters (uses configured relays, or pass relays array to override)

L402 Tools 3 tools

HTTP 402 Payment Required meets Lightning. Pay-per-request API access without API keys.

create_l402_token
Create an L402 access token: mints a Lightning invoice and a bound macaroon. The caller pays the invoice, then presents Authorization: L402 <macaroon>:<preimage> to access protected endpoints. Stateless verification - no DB lookup needed.
ParameterTypeRequiredDescription
amount_satsintegerrequiredPrice in satoshis for the token
memostringoptionalDescription for the Lightning invoice
resourcestringoptionalResource scope to restrict this token (e.g. "marketplace", "lightning")
expiry_secondsintegeroptionalToken lifetime in seconds
verify_l402_token
Verify an L402 credential (macaroon + preimage). Stateless verification: checks macaroon HMAC chain, confirms SHA256(preimage) matches payment_hash, and validates expiry.
ParameterTypeRequiredDescription
macaroonstringrequiredBase64-serialized L402 macaroon
preimagestringrequiredHex-encoded payment preimage (64 chars)
get_l402_status
Get the current L402 configuration: whether it's enabled, default pricing, token expiry, and which routes are free.
ParameterTypeRequiredDescription
No parameters

Architecture

Conduit sits between AI agents and the Lightning Network. Every request passes through three middleware layers before reaching your node:

The core layer provides 26 MCP tools and REST API endpoints covering Lightning payments, a skill marketplace, Nostr discovery, macaroon auth, spending limits, and anomaly detection.

At the bottom is your LND node - your channels, your sats, your keys. Conduit coordinates but never takes custody.

Macaroon Auth

Macaroons are bearer tokens with intersection semantics. Unlike API keys (all-or-nothing), macaroons can be attenuated: you can take an admin macaroon and derive a restricted version that only allows read operations or only marketplace tools.

Conduit ships with four built-in profiles:

Use create_macaroon to mint tokens for different agents with appropriate access levels.

Spending Limits

Spending limits prevent runaway costs from AI agents. Every payment goes through four checks:

The confirmation token is cryptographically bound to the specific payment (tool, amount, payment hash) and expires in ~2 minutes. An agent cannot bypass this by simply retrying.

Provider Verification

Verification proves a skill provider is who they claim to be. Two methods:

Verification badges are shown in marketplace listings. Badges expire and must be renewed periodically to ensure ongoing control.

Nostr Discovery

Nostr is a simple, decentralized protocol for publishing and subscribing to events via relays. Conduit uses Nostr (kind 38383 events) for skill discovery that doesn't depend on any central marketplace.

When you publish a skill to Nostr, it's broadcast to multiple relays. Any Conduit node anywhere in the world can discover it by querying those relays. There's no registration, no approval process, no gatekeeping.

Your Nostr identity is a cryptographic keypair. The public key (npub) becomes your identity on the network. Configure NOSTR_PRIVATE_KEY in your .env to persist your identity across restarts.

Conduit is open source · Built by Lightning Linq · GitHub · Lightning · Nostr