Skip to main content

GetChanInfo

GetChanInfo returns the latest authenticated network announcement for the given channel identified by its channel ID: an 8-byte integer which uniquely identifies the location of transaction's funding output within the blockchain.

Source: lightning.proto

gRPC

rpc GetChanInfo (ChanInfoRequest) returns (ChannelEdge);

REST

HTTP MethodPath
GET /v1/graph/edge/{chan_id}

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 = {
chan_id: <uint64>,
};
client.getChanInfo(request, function(err, response) {
console.log(response);
});
// Console output:
// {
// "channel_id": <uint64>,
// "chan_point": <string>,
// "last_update": <uint32>,
// "node1_pub": <string>,
// "node2_pub": <string>,
// "capacity": <int64>,
// "node1_policy": <RoutingPolicy>,
// "node2_policy": <RoutingPolicy>,
// "custom_records": <CustomRecordsEntry>,
// }

Messages

lnrpc.ChanInfoRequest

Source: lightning.proto

FieldgRPC TypeREST TypeREST Placement
chan_id
uint64stringpath

lnrpc.ChannelEdge

Source: lightning.proto

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

Nested Messages

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

lnrpc.RoutingPolicy.CustomRecordsEntry

FieldgRPC TypeREST Type
key
uint64unknown
value
bytesunknown

lnrpc.ChannelEdge.CustomRecordsEntry

FieldgRPC TypeREST Type
key
uint64unknown
value
bytesunknown