Skip to main content

ImportGraph

ImportGraph imports a ChannelGraph into the graph database. Should only be used for development.

Source: devrpc/dev.proto

gRPC

rpc ImportGraph (ChannelGraph) returns (ImportGraphResponse);

REST

HTTP MethodPath
POST /v2/dev/importgraph

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', 'devrpc/dev.proto'], loaderOptions);
const devrpc = grpc.loadPackageDefinition(packageDefinition).devrpc;
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 devrpc.Dev(GRPC_HOST, creds);
let request = {
nodes: <LightningNode>,
edges: <ChannelEdge>,
};
client.importGraph(request, function(err, response) {
console.log(response);
});
// Console output:
// {
// }

Messages

lnrpc.ChannelGraph

Source: lightning.proto

FieldgRPC TypeREST TypeREST Placement
nodes
LightningNode[]arraybody
edges
ChannelEdge[]arraybody

devrpc.ImportGraphResponse

Source: devrpc/dev.proto

note

This response has no parameters.

Nested Messages

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.NodeAddress

FieldgRPC TypeREST Type
network
stringstring
addr
stringstring

lnrpc.LightningNode.FeaturesEntry

FieldgRPC TypeREST Type
key
uint32unknown
value
Featureunknown

lnrpc.Feature

FieldgRPC TypeREST Type
name
stringstring
is_required
boolboolean
is_known
boolboolean

lnrpc.LightningNode.CustomRecordsEntry

FieldgRPC TypeREST Type
key
uint64unknown
value
bytesunknown

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.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