Watch-Only Node API
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 Channels
- Get Channels With Counterparty
- Get Channel
- Get Payments
- Get Pending Payments
- Get Payments By Hash
- Get Payment
Get Node ID
Get the node ID for a specific network.
Service: WatchOnlyNodeServiceMethod: GetNodeId
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
network | Network | YES | Network to get node ID for |
Response:
| Field | Type | Description |
|---|---|---|
node_id | string | This 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:
| Name | Type | Required | Description |
|---|---|---|---|
network | Network | YES | Network to query channels for |
Response:
| Field | Type | Description |
|---|---|---|
channels | Channel[] | Array of channel objects |
Channel Object:
| Field | Type | Description |
|---|---|---|
id | string | Channel identifier |
counterparty | string | Counterparty node ID |
status | ChannelStatus enum | High-level channel status — CHANNEL_STATUS_INACTIVE (1), ..._ACTIVE (2), ..._UPDATING (3), ..._CLOSED (4), ..._CLOSED_REDEEMABLE (5) |
asset_channels | map<string, AssetChannel> | Asset-specific channel data, keyed by asset_id |
A channel holds several assets at once;
statusis the channel-wide summary, and the real per-asset state lives inasset_channels.AssetChannelStatusis 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? }—disputerisDISPUTER_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
closedonce it is as deep as its value asks (2026-11-17). A cooperative close whose transaction is in a block readscooperatively_closing, andlast_operation_confirmationscounts that transaction's confirmations until it reaches the confirmation tier for the channel's value;closingis no longer emitted. A force close readsforce_closing, and once what pays it out is in a block (the sweep on Lightning, the settlement on Lithium) it readsforce_closingwithout adispute_deadline, andlast_operation_confirmationscounts the payout's confirmations to its tier. Meanwhile the balance holds only what is settling (settling_local, seeOffchainBalance).
closed.force_closedtells you whether the slot is reusable.falseis a cooperative close: on Lithium the channel slot stays reusable for further deposits, while Lightning destroys the channel on any close.trueis 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.
| Field | Type | Description |
|---|---|---|
status | AssetChannelStatus | Detailed status of this asset channel |
balance | OffchainBalance | Off-chain balance breakdown for this asset |
last_onchain_txid | string (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_confirmations | uint64 | Confirmations 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_timestamp | Timestamp | When that last on-chain operation happened |
is_updatable | bool | Whether this asset channel accepts a deposit / withdraw |
is_closable | bool | Whether this asset channel can be closed |
is_force_closable | bool | (2026-09-16) Whether this asset channel can be force-closed (closed unilaterally) |
lease_expiry | Timestamp (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_expiry | Timestamp (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_send | bool | (2026-08-03) An outbound payment can be originated or routed over this asset channel right now |
can_receive | bool | (2026-08-03) An inbound payment can be received right now |
funding_credited | bool | (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_flight | bool | (2026-08-03) A transaction changing this channel's funding is awaiting confirmation |
keep_open_until | Timestamp (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_until | Timestamp (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_ceiling | DecimalString (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_ceiling | DecimalString (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_depth | TierDepth (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_receivefor routing decisions rather than inferring usability fromstatusplus balances — they account for the states a raw status check misses.
keep_open_untilis this node's promise,peer_keep_open_untilthe peer's. A channel the hub opened on demand for your node shows the hub's lifetime aspeer_keep_open_untilon your node, and askeep_open_untilon 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_creditedis notis_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_updatableandis_closablerise 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 itsconfirmation_tiersgive 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, andis_updatableandis_closablerise then. From the block after the node sees it land,last_onchain_txid,last_operation_confirmationsandlast_operation_timestampname 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_closableis not the negation ofis_closable, and the two diverge exactly when it matters. A cooperative close needs the counterparty to sign, sois_closablegoes false the moment the peer is unreachable — which is precisely when a unilateral exit is the only one left.is_force_closabledoes 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 atruecan still be refused, while afalseis only ever set from what the node knows locally and for certain.Follow a lease through the liquidity API. (2026-11-25)
lease_expiryandliquidity_expiryare 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 withGetLeaseExpiries(your node's copy, no round trip) orGetLeases(the service's record, with the amounts), and follow their changes withSubscribeLeaseEvents. 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:
| Name | Type | Required | Description |
|---|---|---|---|
network | Network | YES | Network to query |
counterparty_pubkey | string | YES | Counterparty node public key, hex-encoded |
Response:
| Field | Type | Description |
|---|---|---|
channels | Channel[] | 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:
| Name | Type | Required | Description |
|---|---|---|---|
network | Network | YES | Network the channel is on |
channel_id | string | YES | Channel identifier |
Response:
| Field | Type | Description |
|---|---|---|
channel | Channel | Detailed 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:
| Name | Type | Required | Description |
|---|---|---|---|
network | Network | YES | Network to query payments for |
pagination | PaginationRequest | no | limit (clamped to 1..1000, default 100) + cursor. Omit cursor for the first page |
Response:
| Field | Type | Description |
|---|---|---|
payments | Payment[] | Array of payment objects, newest first |
pagination | PaginationResponse | next_cursor (absent/empty at the end) + has_more |
This call is paginated. Without a
paginationblock you get the newest 100 payments, not the whole history. Page by feedingnext_cursorback as the next request'spagination.cursoruntilhas_moreis false.GetPendingPaymentsis not paginated — in-flight payments are a bounded set.
Payment Object:
| Field | Type | Description |
|---|---|---|
id | string | Unique payment identifier |
hash | string? | Hex-encoded payment hash. Present on hashlock payments |
preimage | string? | Hex-encoded preimage. Present once the payment is claimed |
status | PaymentStatus | A oneof — see below |
timestamp | Timestamp | When the payment was initiated |
spent | map<string, DecimalString> | asset_id → total amount this node spent |
received | map<string, DecimalString> | asset_id → total amount this node received |
operations | PaymentOperation[] | The individual legs that make up the payment — see below |
deadline | PaymentDeadline? | (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_word | LockWord? | (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
directionfield, and noamountfield. Direction is implied by whichoperationsarm is set, and by whether the amount lands inspentorreceived. Older revisions of this page listed aPaymentDirectionenum that has never been on the wire.
PaymentStatus — exactly one arm is set:
| Arm | Payload | Meaning |
|---|---|---|
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:
| Arm | Payload | Meaning |
|---|---|---|
timestamp | Timestamp | The 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:
| Arm | Fields |
|---|---|
send | asset_id, to, recipient_amount, shards[] (SendingPaymentShard: channel_id, counterparty, amount, fee) |
receive | asset_id, from?, recipient_amount, shards[] (ReceivingPaymentShard: channel_id, counterparty, amount) |
route | asset_id, routed_from_channel_id, routed_from_node_id, routed_to_channel_id, routed_to_node_id, amount, earned_fee |
recipient_amountis what the recipient is meant to end up with; theshardsare how it was actually split across channels, eachamountwhat that shard delivers, with the fee it pays beside it infee. A multi-path payment has one operation with several shards, not several operations.A
routeoperation'samountis what arrived for that hop,earned_feeincluded, on both protocols; what the node passed on isamount − 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:
| Name | Type | Required | Description |
|---|---|---|---|
network | Network | YES | Target network |
Response:
| Field | Type | Description |
|---|---|---|
payments | Payment[] | 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:
| Name | Type | Required | Description |
|---|---|---|---|
network | Network | YES | Target network |
payment_hash | string | YES | Hex-encoded payment hash |
Response:
| Field | Type | Description |
|---|---|---|
payments | Payment[] | 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:
| Name | Type | Required | Description |
|---|---|---|---|
network | Network | YES | Target network |
payment_id | string | YES | Unique payment identifier |
Response:
| Field | Type | Description |
|---|---|---|
payment | Payment | Requested 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 Code | Description | Solution |
|---|---|---|
INVALID_ARGUMENT | Invalid network or channel ID | Verify parameters |
NOT_FOUND | Channel or payment not found | Check ID is correct |
UNAVAILABLE | Service temporarily unavailable | Retry with backoff |
Best Practices
- 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.
- Prefer the event stream to polling.
SubscribeNodeEventspushes channel and payment changes; these calls are for the initial snapshot and for reconciliation. - Judge a channel by
can_send/can_receive/is_updatable, not by the high-levelstatus. A channel can be on-chain confirmed and still unusable for the thing you want to do — see theAssetChannelnotes. - Page
GetPayments. The default page is 100 rows, newest first, not the whole history. - Resolve an invoice through
GetPaymentsByHash, not by scanningGetPayments— a hash can have several attempts behind it, and this returns all of them.