Skip to main content

GetInfo

GetInfo returns general information concerning the lightning node including it's identity pubkey, alias, the chains it is connected to, and information concerning the number of open+pending channels.

Source: lightning.proto

gRPC

rpc GetInfo (GetInfoRequest) returns (GetInfoResponse);

REST

HTTP MethodPath
GET /v1/getinfo

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 = {};
client.getInfo(request, function(err, response) {
console.log(response);
});
// Console output:
// {
// "version": <string>,
// "commit_hash": <string>,
// "identity_pubkey": <string>,
// "alias": <string>,
// "color": <string>,
// "num_pending_channels": <uint32>,
// "num_active_channels": <uint32>,
// "num_inactive_channels": <uint32>,
// "num_peers": <uint32>,
// "block_height": <uint32>,
// "block_hash": <string>,
// "best_header_timestamp": <int64>,
// "synced_to_chain": <bool>,
// "synced_to_graph": <bool>,
// "testnet": <bool>,
// "chains": <Chain>,
// "uris": <string>,
// "features": <FeaturesEntry>,
// "require_htlc_interceptor": <bool>,
// "store_final_htlc_resolutions": <bool>,
// }

Messages

lnrpc.GetInfoRequest

Source: lightning.proto

note

This request has no parameters.

lnrpc.GetInfoResponse

Source: lightning.proto

FieldgRPC TypeREST Type
version
stringstring
commit_hash
stringstring
identity_pubkey
stringstring
alias
stringstring
color
stringstring
num_pending_channels
uint32integer
num_active_channels
uint32integer
num_inactive_channels
uint32integer
num_peers
uint32integer
block_height
uint32integer
block_hash
stringstring
best_header_timestamp
int64string
synced_to_chain
boolboolean
synced_to_graph
boolboolean
testnetdeprecated
boolboolean
chains
Chain[]array
uris
string[]array
features
FeaturesEntry[]object
require_htlc_interceptor
boolboolean
store_final_htlc_resolutions
boolboolean

Nested Messages

lnrpc.Chain

FieldgRPC TypeREST Type
chaindeprecated
stringstring
network
stringstring

lnrpc.Feature

FieldgRPC TypeREST Type
name
stringstring
is_required
boolboolean
is_known
boolboolean

lnrpc.GetInfoResponse.FeaturesEntry

FieldgRPC TypeREST Type
key
uint32unknown
value
Featureunknown