Skip to main content

UnlockWallet

UnlockWallet is used at startup of lnd to provide a password to unlock the wallet database.

Source: walletunlocker.proto

gRPC

rpc UnlockWallet (UnlockWalletRequest) returns (UnlockWalletResponse);

REST

HTTP MethodPath
POST /v1/unlockwallet

Code Samples

const fs = require('fs');
const grpc = require('@grpc/grpc-js');
const protoLoader = require('@grpc/proto-loader');

const GRPC_HOST = 'localhost:10009'
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', 'walletunlocker.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);
let client = new lnrpc.WalletUnlocker(GRPC_HOST, sslCreds);
let request = {
wallet_password: <bytes>,
recovery_window: <int32>,
channel_backups: <ChanBackupSnapshot>,
stateless_init: <bool>,
};
client.unlockWallet(request, function(err, response) {
console.log(response);
});
// Console output:
// {
// }

Messages

lnrpc.UnlockWalletRequest

Source: walletunlocker.proto

FieldgRPC TypeREST TypeREST Placement
wallet_password
bytesstringbody
recovery_window
int32integerbody
channel_backups
ChanBackupSnapshotobjectbody
stateless_init
boolbooleanbody

lnrpc.UnlockWalletResponse

Source: walletunlocker.proto

note

This response has no parameters.

Nested Messages

lnrpc.ChanBackupSnapshot

FieldgRPC TypeREST Type
single_chan_backups
ChannelBackupsobject
multi_chan_backup
MultiChanBackupobject

lnrpc.ChannelBackups

FieldgRPC TypeREST Type
chan_backups
ChannelBackup[]array

lnrpc.ChannelBackup

FieldgRPC TypeREST Type
chan_point
ChannelPointobject
chan_backup
bytesstring

lnrpc.ChannelPoint

FieldgRPC TypeREST Type
funding_txid_bytes
bytesstring
funding_txid_str
stringstring
output_index
uint32integer

lnrpc.MultiChanBackup

FieldgRPC TypeREST Type
chan_points
ChannelPoint[]array
multi_chan_backup
bytesstring