Api

Watch-Only Node API

Read-only access to Lightning node data

The Watch-Only Node API exposes Hydra App's WatchOnlyNodeService — read-only queries over node identity, channels and payment history on every protocol the node runs, not just Lightning. Nothing here signs or moves funds, so it is the surface to point monitoring and display at.

JSON-RPC namespace: watchOnlyNode

Endpoints


Get Node ID

Get the node ID for a specific network.

Service: WatchOnlyNodeServiceMethod: GetNodeId

Parameters:

NameTypeRequiredDescription
networkNetworkYESNetwork to get node ID for

Response:

FieldTypeDescription
node_idstringThis node's public key on that network, hex-encoded. It is the identity half of the <node_id>@<host>:<port> peer string

Example Request:

TypeScript
const nodeId = await hydraGrpcClient.getNodeId({
  network: { protocol: 1, id: '0a03cf40' }   // Bitcoin Signet
})
Rust
let request = tonic::Request::new(GetNodeIdRequest {
    network: Some(Network {
        protocol: Protocol::Bitcoin as i32,
        id: "0a03cf40".to_string(),
    }),
});

let response = client.get_node_id(request).await?;
let node_id = response.into_inner().node_id;

Get Channels

Get all channels for a network.

Service: WatchOnlyNodeServiceMethod: GetChannels

Parameters:

NameTypeRequiredDescription
networkNetworkYESNetwork to query channels for

Response:

FieldTypeDescription
channelsChannel[]Array of channel objects

Channel Object:

FieldTypeDescription
idstringChannel identifier
counterpartystringCounterparty node ID
statusChannelStatus enumHigh-level channel status — CHANNEL_STATUS_INACTIVE (1), ..._ACTIVE (2), ..._UPDATING (3), ..._CLOSED (4), ..._CLOSED_REDEEMABLE (5)
asset_channelsmap<string, AssetChannel>Asset-specific channel data, keyed by asset_id

A channel holds several assets at once; status is the channel-wide summary, and the real per-asset state lives in asset_channels. AssetChannelStatus is a oneof with fourteen arms — cooperatively_opening, opening, cooperatively_updating, updating, cooperatively_closing, closing ({ closed_at_block }), force_closing ({ force_closed_at_block?, disputer, dispute_deadline? } — disputer is DISPUTER_LOCAL (1) when this node started the dispute, DISPUTER_REMOTE (2) when the counterparty did), closed_redeemable, closed ({ force_closed }), inactive, active_sending, active_receiving, active, recovering — so match on it rather than comparing to a single "active" value.

A close reads closed once it is as deep as its value asks (2026-11-17). A cooperative close whose transaction is in a block reads cooperatively_closing, and last_operation_confirmations counts that transaction's confirmations until it reaches the confirmation tier for the channel's value; closing is no longer emitted. A force close reads force_closing, and once what pays it out is in a block (the sweep on Lightning, the settlement on Lithium) it reads force_closing without a dispute_deadline, and last_operation_confirmations counts the payout's confirmations to its tier. Meanwhile the balance holds only what is settling (settling_local, see OffchainBalance).

closed.force_closed tells you whether the slot is reusable. false is a cooperative close: on Lithium the channel slot stays reusable for further deposits, while Lightning destroys the channel on any close. true is a unilateral / disputed close, and the slot is permanently dead under every protocol — the only way forward is a new channel.

AssetChannel Object:

One entry per asset held in the channel. This is where per-asset balance, usability, and lease state live.

FieldTypeDescription
statusAssetChannelStatusDetailed status of this asset channel
balanceOffchainBalanceOff-chain balance breakdown for this asset
last_onchain_txidstring (optional)Transaction ID of the last on-chain operation (open, deposit, close, …). (2026-11-17) After this node force-closes a Lightning channel, the commitment it published once known, then the one that confirmed: the peer's, when both sides published theirs and the chain kept the peer's
last_operation_confirmationsuint64Confirmations for that last on-chain operation. (2026-11-17) While a close waits for its confirmation tier (cooperatively_closing, or force_closing once its payout is in a block), the confirmations of the transaction that pays the close out. (2026-11-17) While an open, a deposit, a withdrawal or a splice is in flight (the asset channel is opening or updating), the confirmations of its transaction: 0 until that transaction is in a block, then one more with every block. Once the operation completes the count carries on from the same block.
last_operation_timestampTimestampWhen that last on-chain operation happened
is_updatableboolWhether this asset channel accepts a deposit / withdraw
is_closableboolWhether this asset channel can be closed
is_force_closablebool(2026-09-16) Whether this asset channel can be force-closed (closed unilaterally)
lease_expiryTimestamp (optional)(deprecated 2026-11-25) Read the liquidity service's record: GetLeaseExpiries or GetLeases. (2026-07-12) The liquidity service's record of when the lease on this asset channel ends, as this node last read it. Absent when the asset channel carries no lease. Still filled
liquidity_expiryTimestamp (optional)(deprecated 2026-11-25) Read the liquidity service's record: GetLeaseExpiries or GetLeases. The liquidity service's record of until when its liquidity stays in this asset channel, as this node last read it. Absent while the service has no plan to take it back. Still filled
can_sendbool(2026-08-03) An outbound payment can be originated or routed over this asset channel right now
can_receivebool(2026-08-03) An inbound payment can be received right now
funding_creditedbool(2026-08-03) The funds committed by the most recent on-chain operation are reflected in the balance both peers co-sign
onchain_operation_in_flightbool(2026-08-03) A transaction changing this channel's funding is awaiting confirmation
keep_open_untilTimestamp (optional)(2026-10-14) Until when this node has agreed with the peer to keep this asset channel open: the lifetime a channel it funded on demand was sold with. Before then it closes the channel of its own accord neither cooperatively nor unilaterally; (2026-10-29) a close or a withdrawal it is asked for goes ahead. Reported a margin after the lifetime's last block is expected. Absent when no such agreement binds it, or it has run out — always, on a node that sells no channels on demand
peer_keep_open_untilTimestamp (optional)(2026-10-14) Until when the peer has agreed with this node to keep this asset channel open: the lifetime a channel the peer funded on demand was bought with. It binds the peer alone: this node may close the channel whenever it chooses. Reported a margin before the lifetime's last block is expected, moved earlier while blocks come faster. Absent when no such agreement binds the peer, or no more of it is left than that margin
send_ceilingDecimalString (optional)(2026-11-17) The most a single payment this node sends over this asset channel can carry, set by the channel's protocol whatever the balance. On Lightning it is the peer's limit on payments in flight: below the channel's total it is fixed, and a deposit does not raise it; at the total it grows with the channel. Planning data, not a live limit: what one payment can carry now is OffchainBalance.max_sendable. Absent when the protocol sets none, or the node does not know it yet
receive_ceilingDecimalString (optional)(2026-11-17) The receiving counterpart of send_ceiling: the most a single payment to this node over this asset channel can carry, on Lightning this node's own limit, read the same way. What one payment can bring now is OffchainBalance.max_receivable. Absent when the protocol sets none, or the node does not know it yet
last_operation_depthTierDepth (optional)(2026-11-17) The depth the last on-chain operation waits for before this node counts it as settled, as the node chose it: blocks, a count of confirmations to read last_operation_confirmations against, or final, until the network has made its block final (see GetNetworkInfo). Read it while onchain_operation_in_flight is set. It is this node's own depth: the peer may wait longer before the operation completes. Absent when the node has not chosen a depth yet or does not know it, and for an operation it waits no confirmation for.

Use can_send / can_receive for routing decisions rather than inferring usability from status plus balances — they account for the states a raw status check misses.

keep_open_until is this node's promise, peer_keep_open_until the peer's. A channel the hub opened on demand for your node shows the hub's lifetime as peer_keep_open_until on your node, and as keep_open_until on the hub's. Each side estimates the lifetime's end on its own safe side, so the hub's time is the later; see Rental.

funding_credited is not is_updatable. A zero-conf open has its funding credited (so it can carry payments) while still admitting no further on-chain update.

On a Lithium channel, is_updatable and is_closable rise once both sides have declared themselves ready for the last on-chain update (2026-10-14). Each side declares at its own depth: none for a peer it trusts before confirmations, else the one its confirmation_tiers give the update's value, and otherwise (2026-10-29) once the network has made the update final. The update is promoted then, and the next one can follow at once. (2026-11-17) An open, and an update that leaves the asset channel empty, are promoted at both sides' depth, as any update is, and is_updatable and is_closable rise then. From the block after the node sees it land, last_onchain_txid, last_operation_confirmations and last_operation_timestamp name it — its transaction, its confirmations counted from the block it landed in, that block's time — and until then the operation before it.

is_force_closable is not the negation of is_closable, and the two diverge exactly when it matters. A cooperative close needs the counterparty to sign, so is_closable goes false the moment the peer is unreachable — which is precisely when a unilateral exit is the only one left. is_force_closable does not answer to the peer. It reports that the node holds something a unilateral close could submit, that no close is already recorded, and (2026-11-17) on Lithium, that the node is not itself sending a cooperative close that empties the asset channel — not that the chain will accept it; estimating the force-close is what answers that. So a true can still be refused, while a false is only ever set from what the node knows locally and for certain.

Follow a lease through the liquidity API. (2026-11-25) lease_expiry and liquidity_expiry are copies of the liquidity service's record, taken when the channel is read, and a change of the lease alone does not send the channel again. Read the lease end, until when the provider's liquidity stays and what it has planned to take back with GetLeaseExpiries (your node's copy, no round trip) or GetLeases (the service's record, with the amounts), and follow their changes with SubscribeLeaseEvents. The lease end moves only when a lease is paid for; your fee credit keeps the provider's liquidity in place past it while it covers you, so while you trade the liquidity expiry moves forward on its own.

Example Request:

TypeScript
const channels = await hydraGrpcClient.getChannels({
  protocol: Protocol.BITCOIN,
  id: '0a03cf40'
})

channels.forEach(ch => {
  console.log(`Channel ${ch.id} with ${ch.counterparty}`)
})
Rust
let request = tonic::Request::new(GetChannelsRequest {
    network: Some(Network {
        protocol: Protocol::Bitcoin as i32,
        id: "0a03cf40".to_string(),
    }),
});

let response = client.get_channels(request).await?;
let channels = response.into_inner().channels;

for channel in channels {
    println!("Channel {} with {}", channel.id, channel.counterparty);
}

Get Channels With Counterparty

Get all channels with a specific counterparty node.

Service: WatchOnlyNodeServiceMethod: GetChannelsWithCounterparty

Parameters:

NameTypeRequiredDescription
networkNetworkYESNetwork to query
counterparty_pubkeystringYESCounterparty node public key, hex-encoded

Response:

FieldTypeDescription
channelsChannel[]Channels with this counterparty

Example Request:

TypeScript
const channels = await hydraGrpcClient.getChannelsWithCounterparty({
  network: { protocol: 1, id: '0a03cf40' },
  counterpartyPubkey: '02abc123...'
})
Rust
let request = tonic::Request::new(GetChannelsWithCounterpartyRequest {
    network: Some(Network {
        protocol: Protocol::Bitcoin as i32,
        id: "0a03cf40".to_string(),
    }),
    counterparty_pubkey: "02abc123...".to_string(),
});

let response = client.get_channels_with_counterparty(request).await?;
let channels = response.into_inner().channels;

Get Channel

Get detailed information about a specific channel.

Service: WatchOnlyNodeServiceMethod: GetChannel

Parameters:

NameTypeRequiredDescription
networkNetworkYESNetwork the channel is on
channel_idstringYESChannel identifier

Response:

FieldTypeDescription
channelChannelDetailed channel information

Example Request:

TypeScript
const channel = await hydraGrpcClient.getChannel({
  network: {
    protocol: Protocol.BITCOIN,
    id: '0a03cf40'
  },
  channelId: 'ch_abc123'
})

console.log(`Channel status: ${channel.status}`)
console.log(`Counterparty: ${channel.counterparty}`)
Rust
let request = tonic::Request::new(GetChannelRequest {
    network: Some(Network {
        protocol: Protocol::Bitcoin as i32,
        id: "0a03cf40".to_string(),
    }),
    channel_id: "ch_abc123".to_string(),
});

let response = client.get_channel(request).await?;
let channel = response.into_inner().channel;

Get Payments

Get payment history for a network.

Service: WatchOnlyNodeServiceMethod: GetPayments

Parameters:

NameTypeRequiredDescription
networkNetworkYESNetwork to query payments for
paginationPaginationRequestnolimit (clamped to 1..1000, default 100) + cursor. Omit cursor for the first page

Response:

FieldTypeDescription
paymentsPayment[]Array of payment objects, newest first
paginationPaginationResponsenext_cursor (absent/empty at the end) + has_more

This call is paginated. Without a pagination block you get the newest 100 payments, not the whole history. Page by feeding next_cursor back as the next request's pagination.cursor until has_more is false. GetPendingPayments is not paginated — in-flight payments are a bounded set.

Payment Object:

FieldTypeDescription
idstringUnique payment identifier
hashstring?Hex-encoded payment hash. Present on hashlock payments
preimagestring?Hex-encoded preimage. Present once the payment is claimed
statusPaymentStatusA oneof — see below
timestampTimestampWhen the payment was initiated
spentmap<string, DecimalString>asset_id → total amount this node spent
receivedmap<string, DecimalString>asset_id → total amount this node received
operationsPaymentOperation[]The individual legs that make up the payment — see below
deadlinePaymentDeadline?(2026-11-25) The latest the payment ends by: by then it has completed, or it has ended without completing and what it locked is given back. It ends sooner whenever its counterparties settle it. For a payment you send it is the latest end of the attempts made so far, and another attempt can move it later. Absent when no such deadline is known — see below
lock_wordLockWord?(2026-11-25) What the payment is locked under: a hash today (lock_word.hash equals hash), a point under a point lock. A trade's LegRecord.payment names its payments by it. Absent exactly when hash is

There is no direction field, and no amount field. Direction is implied by which operations arm is set, and by whether the amount lands in spent or received. Older revisions of this page listed a PaymentDirection enum that has never been on the wire.

PaymentStatus — exactly one arm is set:

ArmPayloadMeaning
pending(empty)Being routed or processed
pending_preimage{ resolution_deadline: Deadline? }A hashlock payment awaiting its preimage. The deadline is when it stops being resolvable — see ResolveHashlockPayment
completed(empty)Settled successfully
expired(empty)Ran out of time before completing
failed(empty)Failed on a routing or protocol error
rejected(empty)Explicitly rejected by the recipient — see RejectPayment

PaymentDeadline (2026-11-25) — exactly one arm is set, in the unit the payment's locks count in:

ArmPayloadMeaning
timestampTimestampThe locks count in time, as Lithium's do: the instant by which the payment ends
block_height{ height: uint64, expected_at: Timestamp }The locks count in blocks, as Lightning's do: the block by which the payment ends. height is authoritative; expected_at, when the chain is expected to reach it at the network's average block interval, is an estimate

PaymentOperation — also a oneof, one entry per leg:

ArmFields
sendasset_id, to, recipient_amount, shards[] (SendingPaymentShard: channel_id, counterparty, amount, fee)
receiveasset_id, from?, recipient_amount, shards[] (ReceivingPaymentShard: channel_id, counterparty, amount)
routeasset_id, routed_from_channel_id, routed_from_node_id, routed_to_channel_id, routed_to_node_id, amount, earned_fee

recipient_amount is what the recipient is meant to end up with; the shards are how it was actually split across channels, each amount what that shard delivers, with the fee it pays beside it in fee. A multi-path payment has one operation with several shards, not several operations.

A route operation's amount is what arrived for that hop, earned_fee included, on both protocols; what the node passed on is amount − earned_fee.

Example Request:

TypeScript
const { payments, pagination } = await hydraGrpcClient.getPayments({
  network: { protocol: 1, id: '0a03cf40' },
  pagination: { limit: 100 }
})

for (const payment of payments) {
  const [kind] = Object.keys(payment.status)      // pending | completed | failed | …
  console.log(`${payment.id}: ${kind}`)
}
// pagination.hasMore ⇒ call again with pagination.cursor = pagination.nextCursor
Rust
let request = tonic::Request::new(GetPaymentsRequest {
    network: Some(Network {
        protocol: Protocol::Bitcoin as i32,
        id: "0a03cf40".to_string(),
    }),
    pagination: Some(PaginationRequest { limit: 100, cursor: None }),
});

let response = client.get_payments(request).await?.into_inner();

for payment in response.payments {
    println!("{}: {:?}", payment.id, payment.status);
}
// response.pagination.has_more ⇒ call again with the returned next_cursor

Get Pending Payments

Returns all pending (in-flight) off-chain payments on the specified network.

Method: GetPendingPayments

Parameters:

NameTypeRequiredDescription
networkNetworkYESTarget network

Response:

FieldTypeDescription
paymentsPayment[]Currently in-flight payments

Example Request:

import { GetPendingPaymentsRequest } from './proto/watch_only_node_pb'

const request = new GetPendingPaymentsRequest()
request.setNetwork({ protocol: 1, id: '0a03cf40' })

const response = await client.getPendingPayments(request, {})
const pending = response.getPaymentsList()
console.log(`${pending.length} pending payments`)

Get Payments By Hash

Returns all payments matching a specific payment hash. Useful for resolving the state of a known invoice or hashlock. (2026-11-25) A trade's leg settled over a hash lock names its hash as payment.lock_word.hash in its leg records: these are that leg's payments, every attempt included.

Method: GetPaymentsByHash

Parameters:

NameTypeRequiredDescription
networkNetworkYESTarget network
payment_hashstringYESHex-encoded payment hash

Response:

FieldTypeDescription
paymentsPayment[]Payments matching the hash

Example Request:

import { GetPaymentsByHashRequest } from './proto/watch_only_node_pb'

const request = new GetPaymentsByHashRequest()
request.setNetwork({ protocol: 1, id: '0a03cf40' })
request.setPaymentHash('a1b2c3d4...')

const response = await client.getPaymentsByHash(request, {})
console.log(`Found ${response.getPaymentsList().length} payments`)

Get Payment

Returns the details of a specific payment by its unique ID.

Method: GetPayment

Parameters:

NameTypeRequiredDescription
networkNetworkYESTarget network
payment_idstringYESUnique payment identifier

Response:

FieldTypeDescription
paymentPaymentRequested payment

Example Request:

import { GetPaymentRequest } from './proto/watch_only_node_pb'

const request = new GetPaymentRequest()
request.setNetwork({ protocol: 1, id: '0a03cf40' })
request.setPaymentId('pmt_abc123')

const response = await client.getPayment(request, {})
console.log('Payment:', response.getPayment()?.toObject())

Common Patterns

Monitor channel status

Rust
async fn get_active_channels(
    client: &mut WatchOnlyNodeServiceClient<Channel>,
    network: Network,
) -> Result<Vec<Channel>, Box<dyn std::error::Error>> {
    let channels = client
        .get_channels(GetChannelsRequest {
            network: Some(network),
        })
        .await?
        .into_inner()
        .channels;

    Ok(channels
        .into_iter()
        .filter(|ch| ch.status == ChannelStatus::Active as i32)
        .collect())
}

Find channel with peer

Rust
async fn find_channel_with_peer(
    client: &mut WatchOnlyNodeServiceClient<Channel>,
    network: Network,
    peer_id: String,
) -> Result<Option<Channel>, Box<dyn std::error::Error>> {
    let channels = client
        .get_channels_with_counterparty(GetChannelsWithCounterpartyRequest {
            network: Some(network),
            counterparty_node_id: peer_id,
        })
        .await?
        .into_inner()
        .channels;

    Ok(channels.into_iter().next())
}

Error Handling

Error CodeDescriptionSolution
INVALID_ARGUMENTInvalid network or channel IDVerify parameters
NOT_FOUNDChannel or payment not foundCheck ID is correct
UNAVAILABLEService temporarily unavailableRetry with backoff

Best Practices

  1. Use this surface for monitoring. Nothing here can move funds, so it is safe to expose to a dashboard that the trading path is not.
  2. Prefer the event stream to polling. SubscribeNodeEvents pushes channel and payment changes; these calls are for the initial snapshot and for reconciliation.
  3. Judge a channel by can_send / can_receive / is_updatable, not by the high-level status. A channel can be on-chain confirmed and still unusable for the thing you want to do — see the AssetChannel notes.
  4. Page GetPayments. The default page is 100 rows, newest first, not the whole history.
  5. Resolve an invoice through GetPaymentsByHash, not by scanning GetPayments — a hash can have several attempts behind it, and this returns all of them.

← Back to API Reference | Next: Events & Subscriptions →


Copyright © 2025