Skip to main content

SendMany

SendMany handles a request for a transaction that creates multiple specified outputs in parallel. If neither target_conf, or sat_per_vbyte are set, then the internal wallet will consult its fee model to determine a fee for the default confirmation target.

Source: lightning.proto

gRPC

rpc SendMany (SendManyRequest) returns (SendManyResponse);

REST

HTTP MethodPath
POST /v1/transactions/many

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 = {
AddrToAmount: <AddrToAmountEntry>,
target_conf: <int32>,
sat_per_vbyte: <uint64>,
sat_per_byte: <int64>,
label: <string>,
min_confs: <int32>,
spend_unconfirmed: <bool>,
coin_selection_strategy: <CoinSelectionStrategy>,
};
client.sendMany(request, function(err, response) {
console.log(response);
});
// Console output:
// {
// "txid": <string>,
// }

Messages

lnrpc.SendManyRequest

Source: lightning.proto

FieldgRPC TypeREST TypeREST Placement
AddrToAmount
AddrToAmountEntry[]objectbody
target_conf
int32integerbody
sat_per_vbyte
uint64stringbody
sat_per_bytedeprecated
int64stringbody
label
stringstringbody
min_confs
int32integerbody
spend_unconfirmed
boolbooleanbody
coin_selection_strategy
CoinSelectionStrategystringbody

lnrpc.SendManyResponse

Source: lightning.proto

FieldgRPC TypeREST Type
txid
stringstring

Nested Messages

lnrpc.SendManyRequest.AddrToAmountEntry

FieldgRPC TypeREST Type
key
stringunknown
value
int64unknown

Enums

lnrpc.CoinSelectionStrategy

NameNumber
STRATEGY_USE_GLOBAL_CONFIG
0
STRATEGY_LARGEST
1
STRATEGY_RANDOM
2