Developer Resources
Connect to Your Node
Node.js
2min
connect to a voltage node using node js firsrt, install the grpc requirements for node js npm install save @grpc/grpc js next, you can use this script to make a getinfo call to your node! const fs = require('fs'); const grpc = require('@grpc/grpc js'); const protoloader = require('@grpc/proto loader'); const loaderoptions = { keepcase true, longs string, enums string, defaults true, oneofs true }; const packagedefinition = protoloader loadsync('lightning proto', loaderoptions); async function main() { process env grpc ssl cipher suites = 'high+ecdsa' let m = fs readfilesync(' / lnd/admin macaroon'); let macaroon = m tostring('hex'); // build meta data credentials let metadata = new grpc metadata() metadata add('macaroon', macaroon) let macarooncreds = grpc credentials createfrommetadatagenerator(( args, callback) => { callback(null, metadata); }); // build ssl credentials without needing to pass in the cert const sslcreds = grpc credentials createssl(); // combine the cert credentials and the macaroon auth credentials // such that every call is properly encrypted and authenticated let credentials = grpc credentials combinechannelcredentials(sslcreds, macarooncreds); // pass the crendentials when creating a channel let lnrpcdescriptor = grpc loadpackagedefinition(packagedefinition); let lnrpc = lnrpcdescriptor lnrpc; let client = new lnrpc lightning('node name m voltageapp io 10009', credentials); client getinfo({}, (err, response) => { if (err) { console log('error ' + err); } console log('getinfo ', response); }); } see more examples below grpc api examples docid\ akzupqd1qvsawryaspwyi rest api examples docid 55r fbwktrm ggxgngazt