Skip to main content

DescribeGraph

DescribeGraph returns a description of the latest graph state from the point of view of the node. The graph information is partitioned into two components: all the nodes/vertexes, and all the edges that connect the vertexes themselves. As this is a directed graph, the edges also contain the node directional specific routing policy which includes: the time lock delta, fee information, etc.

Source: lightning.proto

gRPC

rpc DescribeGraph (ChannelGraphRequest) returns (ChannelGraph);

REST

HTTP MethodPath
GET /v1/graph

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 = {
include_unannounced: <bool>,
};
client.describeGraph(request, function(err, response) {
console.log(response);
});
// Console output:
// {
// "nodes": <LightningNode>,
// "edges": <ChannelEdge>,
// }

Messages

lnrpc.ChannelGraphRequest

Source: lightning.proto

FieldgRPC TypeREST TypeREST Placement
include_unannounced
boolbooleanquery

lnrpc.ChannelGraph

Source: lightning.proto

FieldgRPC TypeREST Type
nodes
LightningNode[]array
edges
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