Skip to main content

GetNodeInfo

GetNodeInfo returns the latest advertised, aggregated, and authenticated channel information for the specified node identified by its public key.

Source: lightning.proto

gRPC

rpc GetNodeInfo (NodeInfoRequest) returns (NodeInfo);

REST

HTTP MethodPath
GET /v1/graph/node/{pub_key}

Code Samples

const fs = require('fs');
const grpc = require('@grpc/grpc-js');
const protoLoader = require('@grpc/proto-loader');

const GRPC_HOST = 'localhost:10009'
const MACAROON_PATH = 'LND_DIR/data/chain/bitcoin/regtest/admin.macaroon'
const TLS_PATH = 'LND_DIR/tls.cert'

const loaderOptions = {
keepCase: true,
longs: String,
enums: String,
defaults: true,
oneofs: true,
};
const packageDefinition = protoLoader.loadSync('lightning.proto', loaderOptions);
const lnrpc = grpc.loadPackageDefinition(packageDefinition).lnrpc;
process.env.GRPC_SSL_CIPHER_SUITES = 'HIGH+ECDSA';
const tlsCert = fs.readFileSync(TLS_PATH);
const sslCreds = grpc.credentials.createSsl(tlsCert);
const macaroon = fs.readFileSync(MACAROON_PATH).toString('hex');
const macaroonCreds = grpc.credentials.createFromMetadataGenerator(function(args, callback) {
let metadata = new grpc.Metadata();
metadata.add('macaroon', macaroon);
callback(null, metadata);
});
let creds = grpc.credentials.combineChannelCredentials(sslCreds, macaroonCreds);
let client = new lnrpc.Lightning(GRPC_HOST, creds);
let request = {
pub_key: <string>,
include_channels: <bool>,
};
client.getNodeInfo(request, function(err, response) {
console.log(response);
});
// Console output:
// {
// "node": <LightningNode>,
// "num_channels": <uint32>,
// "total_capacity": <int64>,
// "channels": <ChannelEdge>,
// }

Messages

lnrpc.NodeInfoRequest

Source: lightning.proto

FieldgRPC TypeREST TypeREST Placement
pub_key
stringstringpath
include_channels
boolbooleanquery

lnrpc.NodeInfo

Source: lightning.proto

FieldgRPC TypeREST Type
node
LightningNodeobject
num_channels
uint32integer
total_capacity
int64string
channels
ChannelEdge[]array

Nested Messages

lnrpc.ChannelEdge

FieldgRPC TypeREST Type
channel_id
uint64string
chan_point
stringstring
last_update
uint32integer
node1_pub
stringstring
node2_pub
stringstring
capacity
int64string
node1_policy
RoutingPolicyobject
node2_policy
RoutingPolicyobject
custom_records
CustomRecordsEntry[]object

lnrpc.ChannelEdge.CustomRecordsEntry

FieldgRPC TypeREST Type
key
uint64unknown
value
bytesunknown

lnrpc.Feature

FieldgRPC TypeREST Type
name
stringstring
is_required
boolboolean
is_known
boolboolean

lnrpc.LightningNode

FieldgRPC TypeREST Type
last_update
uint32integer
pub_key
stringstring
alias
stringstring
addresses
NodeAddress[]array
color
stringstring
features
FeaturesEntry[]object
custom_records
CustomRecordsEntry[]object

lnrpc.LightningNode.CustomRecordsEntry

FieldgRPC TypeREST Type
key
uint64unknown
value
bytesunknown

lnrpc.LightningNode.FeaturesEntry

FieldgRPC TypeREST Type
key
uint32unknown
value
Featureunknown

lnrpc.NodeAddress

FieldgRPC TypeREST Type
network
stringstring
addr
stringstring

lnrpc.RoutingPolicy

FieldgRPC TypeREST Type
time_lock_delta
uint32integer
min_htlc
int64string
fee_base_msat
int64string
fee_rate_milli_msat
int64string
disabled
boolboolean
max_htlc_msat
uint64string
last_update
uint32integer
custom_records
CustomRecordsEntry[]object
inbound_fee_base_msat
int32integer
inbound_fee_rate_milli_msat
int32integer

lnrpc.RoutingPolicy.CustomRecordsEntry

FieldgRPC TypeREST Type
key
uint64unknown
value
bytesunknown