Introducing a new way to review your PRs.

Read the announcement

jamaljsr / polar

One-click Bitcoin Lightning networks for local app development & testing

View on GitHub

19 documents · Updated Oct 19, 2026

docs / network-designer-experience

Network designer experience

The network designer is the main visual workspace for building and operating a local Bitcoin, Lightning, and Tap network. It turns nodes and their relationships into an interactive topology so an engineer can add nodes, connect services, inspect live state, and start common wallet, channel, payment, and asset actions from the same view.

Designer workspace

The workspace joins a topology canvas with a context-sensitive sidebar. The canvas shows the network, while the sidebar changes from setup controls to node or link details when the user selects an item.

Canvas

The canvas presents each node as a labeled box with a status indicator and implementation icon. Engineers can move nodes and the canvas, draw links from ports, and change the zoom level; node movement follows the visible grid so related services remain easy to arrange. The designer saves chart changes after a short delay instead of saving on every drag event. src/…/NetworkDesigner.tsx• L54-108 src/…/designer.ts• L412-441

The canvas uses different visual signals for channel state. Open channels show a color split based on the two balances. Pending channels use a faded dashed line. Private channels have lower opacity when they do not carry Tap asset data. This lets the topology show both relationship and useful channel state without opening the details panel. src/…/Link.tsx• L49-107

References: src/…/NetworkDesigner.tsx• L54-108 src/…/designer.ts• L412-441 src/…/Link.tsx• L49-107

The sidebar is the control surface for the selected graph item. With no selection it offers node versions and node types to add. A selected Bitcoin, Lightning, or Tap node opens information, connection, and action views. A selected link opens a relationship-specific view for a backend, channel, peer, or Tap backend. src/…/Sidebar.tsx• L16-38 src/…/BitcoinDetails.tsx• L15-73 src/…/LightningDetails.tsx• L20-90

The information shown for a running node comes from the node service. The panel can show status, implementation, balances, chain or channel state, connection data, and Tap balances when the node supports them. If the service is starting or cannot provide data, the panel shows a wait or error state rather than presenting stale details as current. src/…/LightningDetails.tsx• L23-41 src/…/TapDetails.tsx• L18-76

References: src/…/Sidebar.tsx• L16-38 src/…/BitcoinDetails.tsx• L15-73 src/…/LightningDetails.tsx• L20-90 src/…/TapDetails.tsx• L18-76

Topology model

The topology is a map of services and the relationships that make the local network work. It distinguishes links that carry traffic or value from links that describe a service dependency.

Nodes

The designer supports three node roles: Bitcoin nodes provide the chain backend, Lightning nodes provide payment channels, and Tap nodes provide Taproot Asset operations. A litd node combines Lightning and Tap capabilities, so its Lightning view also exposes asset actions. src/…/types.ts• L9-21 src/…/types.ts• L23-28 src/…/types.ts• L85-89 src/…/ActionsTab.tsx• L27-50

Each node has a lifecycle status. The status controls which actions are available: live queries and value-moving actions require a started node, while start, stop, unlock, rename, option, log, terminal, and remove actions support node management around that state. The node menu therefore acts as both an operations menu and a quick entry point to payments or asset work. src/…/NodeContextMenu.tsx• L41-124

References: src/…/types.ts• L9-21 src/…/types.ts• L23-28 src/…/types.ts• L85-89 src/…/ActionsTab.tsx• L27-50 src/…/NodeContextMenu.tsx• L41-124

A link is a relationship between two node ports. The designer uses four meaningful relationship types:

  • A backend link joins a Lightning node to its Bitcoin node.
  • A peer link joins two Bitcoin nodes that exchange chain data.
  • A channel link joins two Lightning nodes for a payment channel. It can be pending or open and can also carry Tap assets.
  • A Tap backend link joins a Tapd node to the LND node that it uses for Bitcoin and Lightning support.

The link details panel uses the relationship type to show the right facts and action. For example, a channel view shows capacity, balances, privacy, identifier, and asset balances. A backend view shows both service nodes and permits a backend change. src/…/chart.ts• L8-17 src/…/LinkDetails.tsx• L19-59 src/…/Channel.tsx• L29-121

References: src/…/chart.ts• L8-17 src/…/LinkDetails.tsx• L19-59 src/…/Channel.tsx• L29-121

Live topology state

The chart starts from the network definition and gains live channel and node data after running services are queried. A periodic sync refreshes Lightning and Tap information, adds or updates channel ports and links, restores service relationships, and removes links for channels that no longer exist. The chart is therefore a useful view of the current network, but it is not the source of truth for service state. src/…/designer.ts• L128-161 src/…/chart.ts• L273-402

The sync also keeps the visual model stable when a node or channel changes. Channel ports are placed on the side that matches the node positions, and the node grows when it needs more channel ports. This keeps a busy topology readable while the underlying relationships change. src/…/chart.ts• L218-271

The main state flow is:

flowchart LR
    Network[Network definition] --> Chart[Topology chart]
    Running[Running node services] --> Sync[Live sync]
    Sync --> Chart
    Chart --> Canvas[Canvas and sidebar]
    Canvas --> Action[Node or link action]
    Action --> Running
    Chart --> Save[Saved layout]

References: src/…/designer.ts• L128-161 src/…/chart.ts• L171-203 src/…/chart.ts• L218-271 src/…/chart.ts• L273-402

Network construction

The designer supports construction through direct manipulation, but each visual action maps to a real network operation. The canvas supplies the intent, and a modal or service action validates and completes it.

Node addition

The default network tab lists available managed versions and configured custom images. An engineer drags a node entry onto the canvas to request a new node. The network must be stopped or started before the drop can complete; after the node is added, a running network starts it so the new box and the running service stay aligned. src/…/NetworkDesignerTab.tsx• L66-149 src/…/designer.ts• L367-409

The initial placement is only a starting layout. Bitcoin and Lightning nodes receive their service relationships when they are created, and Tapd nodes are placed near the LND node they use. Later sync adds live channels and peer relationships to that base layout. src/…/chart.ts• L51-168 src/…/chart.ts• L171-203

References: src/…/NetworkDesignerTab.tsx• L66-149 src/…/designer.ts• L367-409 src/…/chart.ts• L51-168 src/…/chart.ts• L171-203

Link drawing is a guided way to ask for a network relationship. The designer checks the two node roles, the selected ports, and the node state before it opens the matching operation. Unsupported or invalid links are removed and reported, so a temporary line on the canvas does not imply that a service relationship exists. src/…/designer.ts• L290-364

The supported link intents are:

Source and destinationResult
Lightning to LightningOpens the channel workflow when the network and both nodes are started.
Lightning to BitcoinOpens the backend selection workflow when both backend ports are used.
Tap to LNDOpens the Tap backend workflow when the Lightning node uses LND and the Tap node can still change its backend.
Bitcoin to BitcoinRejected as a new canvas link; peer relationships come from the network state.
Tap to TapRejected because Tap nodes do not connect directly in this view.

The relationship flow is:

flowchart TD
    Draw[Draw between ports] --> Check[Check node roles and state]
    Check -->|Lightning pair| Channel[Channel workflow]
    Check -->|Lightning and Bitcoin| Backend[Backend workflow]
    Check -->|Tap and LND| TapBackend[Tap backend workflow]
    Check -->|Unsupported pair| Remove[Remove line and show error]

References: src/…/designer.ts• L290-364 src/…/LinkContextMenu.tsx• L15-65

Selecting or opening the context menu keeps common operations close to the topology. Node actions cover service control and access to node-specific workflows. Link actions cover changing a backend or Tap backend and closing an open Lightning channel. A pending channel has details but does not offer the open-channel close action until it is open. src/…/NodeContextMenu.tsx• L51-124 src/…/LinkContextMenu.tsx• L24-55

Renaming a node updates the node identity used by its backend, peer, and Tap backend links. Removing a node also removes its chart links. These rules prevent the visual map from keeping references to a node that no longer has that name or no longer exists. src/…/designer.ts• L221-288

References: src/…/NodeContextMenu.tsx• L51-124 src/…/LinkContextMenu.tsx• L24-55 src/…/designer.ts• L221-288

Service and asset workflows

The designer turns selected nodes and links into focused workflows instead of making engineers leave the topology. Lightning connection and payment work is described in Lightning connections and payments. Tap asset inspection and transfer work is described in Tap asset interactions.

Node service views

Each selected service has three broad views: information for current state, connection data for external access, and actions for operations. Connection views expose useful hosts and credentials for started nodes. A locked LND node also exposes connection data after the designer checks whether its wallet is locked or not yet initialized. src/…/ConnectTab.tsx• L91-227 src/…/ConnectTab.tsx• L230-325 src/…/ConnectTab.tsx• L46-130

Bitcoin nodes expose chain and wallet information. Lightning nodes expose chain sync, identity, channel counts, wallet balance, and connection details. Tap nodes expose asset counts and balances when their service has returned data. For a started Lightning node, selecting the details view refreshes its identity, wallet, and channels; a litd node also refreshes Tap assets, Tap balances, and Lightning Node Connect sessions. The views share the same status model, so an engineer can tell whether missing data means a node is stopped, still starting, or failed to answer. src/…/InfoTab.tsx• L16-75 src/…/InfoTab.tsx• L19-113 src/…/InfoTab.tsx• L16-59 src/…/LightningDetails.tsx• L20-89

References: src/…/ConnectTab.tsx• L91-227 src/…/ConnectTab.tsx• L230-325 src/…/ConnectTab.tsx• L46-130 src/…/InfoTab.tsx• L16-75 src/…/InfoTab.tsx• L19-113 src/…/InfoTab.tsx• L16-59 src/…/LightningDetails.tsx• L20-89

Lightning workflows

Lightning nodes expose channel creation, invoice creation, invoice payment, and wallet funding actions. A channel can use Bitcoin satoshis or a Tap asset when both selected Lightning nodes support the asset path. Invoice creation and payment use the selected node and can likewise use satoshis or an asset available through its channels. src/…/ActionsTab.tsx• L28-52 src/…/OpenChannelModal.tsx• L60-98 src/…/CreateInvoiceModal.tsx• L89-124 src/…/PayInvoiceModal.tsx• L109-137

The designer refreshes balances and channel data before these workflows make a choice. It can offer an automatic Bitcoin deposit when the selected node lacks the funds needed for a channel or Tap asset action. Payment is disabled when the selected node has no outbound satoshi liquidity. src/…/OpenChannelModal.tsx• L47-58 src/…/PayInvoiceModal.tsx• L60-107

References: src/…/ActionsTab.tsx• L28-52 src/…/OpenChannelModal.tsx• L47-98 src/…/CreateInvoiceModal.tsx• L75-124 src/…/PayInvoiceModal.tsx• L60-137

Tap asset workflows

Tap assets are digital assets issued and moved through Tap services. The designer lets an engineer inspect balances and asset details, create a receive address, mint an asset, and send an asset from a selected Tap or litd node. The send flow decodes the destination first, which gives the user a chance to confirm the asset and amount before submission. src/…/AssetsList.tsx• L24-62 src/…/NewAddressModal.tsx• L95-130 src/…/SendAssetModal.tsx• L45-83

Minting supports normal and collectible assets. The workflow can finalize the asset and can fund the related LND wallet when the Bitcoin balance is too low. New address creation can sync asset definitions from another Tap-capable node before it creates an address. src/…/MintAssetModal.tsx• L44-95 src/…/NewAddressModal.tsx• L80-120

Tap asset actions depend on the Tap backend relationship. A Tapd node uses an LND node for its backend, while a litd node exposes the Tap capability as part of the Lightning node. The link workflow allows a Tapd-to-LND assignment only for an LND implementation and blocks a backend change after the Tap node has already been initialized. src/…/chart.ts• L88-128 src/…/designer.ts• L330-354

References: src/…/AssetsList.tsx• L24-62 src/…/NewAddressModal.tsx• L80-130 src/…/MintAssetModal.tsx• L44-95 src/…/SendAssetModal.tsx• L45-83 src/…/ActionsTab.tsx• L31-41 src/…/designer.ts• L330-354

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep the link type rules aligned across chart creation, drag-link validation, link detail selection, and link context actions.
  • When a node role or backend field changes, check the generated topology links and the rename path that updates their node IDs.
  • When channel or asset fields change, update both the link visual state and the sidebar values that explain balances, capacity, privacy, and asset amounts.
  • When a new node action requires live service state, keep its availability rule aligned with the node status and the pre-action refresh.
  • When Tap backend requirements change, review litd mapping and the LND-only guard used by Tapd connections.
  • When Lightning connection states change, keep the wallet-state check aligned with the endpoint, credential, warning, and retry behavior for locked and not-yet-initialized LND nodes.

Important failure modes

TriggerConsequenceGuard
A user draws a link while the network or required nodes are not startedThe temporary link is removed and the operation does not openValidate lifecycle state before showing the channel workflow
A Lightning node is linked to a Bitcoin node through a non-backend portThe intended backend relationship is rejectedRequire the backend port on both ends
A Tap node is linked to a non-LND Lightning implementationTap backend setup cannot use the selected serviceCheck the Lightning implementation before opening the Tap backend workflow
A Tapd node has already been initialized when a backend change is requestedThe backend change is rejected to protect the existing Tap stateCheck for the node's initialized credentials before allowing the change
A selected node has no outbound satoshi liquidityInvoice payment cannot proceedRefresh all relevant channel data and disable payment when liquidity is zero
A Tap address decodes to an unknown assetThe send could target an asset the node does not haveDecode the address and show the asset identity before enabling send
A locked LND wallet state cannot be readThe designer cannot safely choose between locked and not-yet-initialized connection flowsShow the error and allow a retry instead of guessing the auth state
A node or channel is removed from the network but remains in the chartThe sidebar can point to stale topology dataRebuild service links and remove links and ports not present in the latest sync

Key files

FileWhy to read it
src/…/NetworkDesigner.tsxMain workspace that joins the canvas, sidebar, zoom controls, persistence, and action modals.
src/…/designer.tsDesigner state and the rules for node drops, link creation, selection, sync, rename, and removal.
src/…/chart.tsTopology model for node roles, service links, channel ports, and live chart refresh.
src/…/Sidebar.tsxSelection routing from the chart to node and link views.
src/…/NodeContextMenu.tsxNode-level entry points for service control, Lightning actions, and Tap actions.
src/…/LinkContextMenu.tsxLink-level entry points for backend changes and channel close.
src/…/LinkDetails.tsxRelationship routing for backend, channel, peer, and Tap backend details.
src/…/LightningDetails.tsxLightning node status, live data refresh, and the information, connection, and action views.
src/…/ConnectTab.tsxLightning endpoints, credentials, wallet-state handling, and connection choices.
src/…/ActionsTab.tsxLightning channel, payment, wallet, and litd Tap asset entry points.
src/…/OpenChannelModal.tsxChannel creation and satoshi or Tap asset funding choices.
src/…/CreateInvoiceModal.tsxInvoice creation for Bitcoin and supported Tap assets.
src/…/PayInvoiceModal.tsxInvoice payment and outbound liquidity checks.
src/…/MintAssetModal.tsxTap asset issuance and funding choices.
src/…/NewAddressModal.tsxTap receive address creation and asset synchronization.
src/…/SendAssetModal.tsxTap address validation and asset transfer.