Skip to main content

FundingStateStep

FundingStateStep is an advanced funding related call that allows the caller to either execute some preparatory steps for a funding workflow, or manually progress a funding workflow. The primary way a funding flow is identified is via its pending channel ID. As an example, this method can be used to specify that we're expecting a funding flow for a particular pending channel ID, for which we need to use specific parameters. Alternatively, this can be used to interactively drive PSBT signing for funding for partially complete funding transactions.

Source: lightning.proto

gRPC

rpc FundingStateStep (FundingTransitionMsg) returns (FundingStateStepResp);

REST

HTTP MethodPath
POST /v1/funding/step

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 = {
shim_register: <FundingShim>,
shim_cancel: <FundingShimCancel>,
psbt_verify: <FundingPsbtVerify>,
psbt_finalize: <FundingPsbtFinalize>,
};
client.fundingStateStep(request, function(err, response) {
console.log(response);
});
// Console output:
// {
// }

Messages

lnrpc.FundingTransitionMsg

Source: lightning.proto

FieldgRPC TypeREST TypeREST Placement
shim_register
FundingShimobjectbody
shim_cancel
FundingShimCancelobjectbody
psbt_verify
FundingPsbtVerifyobjectbody
psbt_finalize
FundingPsbtFinalizeobjectbody

lnrpc.FundingStateStepResp

Source: lightning.proto

note

This response has no parameters.

Nested Messages

lnrpc.ChannelPoint

FieldgRPC TypeREST Type
funding_txid_bytes
bytesstring
funding_txid_str
stringstring
output_index
uint32integer

lnrpc.ChanPointShim

FieldgRPC TypeREST Type
amt
int64string
chan_point
ChannelPointobject
local_key
KeyDescriptorobject
remote_key
bytesstring
pending_chan_id
bytesstring
thaw_height
uint32integer
musig2
boolboolean

lnrpc.FundingPsbtFinalize

FieldgRPC TypeREST Type
signed_psbt
bytesstring
pending_chan_id
bytesstring
final_raw_tx
bytesstring

lnrpc.FundingPsbtVerify

FieldgRPC TypeREST Type
funded_psbt
bytesstring
pending_chan_id
bytesstring
skip_finalize
boolboolean

lnrpc.FundingShim

FieldgRPC TypeREST Type
chan_point_shim
ChanPointShimobject
psbt_shim
PsbtShimobject

lnrpc.FundingShimCancel

FieldgRPC TypeREST Type
pending_chan_id
bytesstring

lnrpc.KeyDescriptor

FieldgRPC TypeREST Type
raw_key_bytes
bytesstring
key_loc
KeyLocatorobject

lnrpc.KeyLocator

FieldgRPC TypeREST Type
key_family
int32integer
key_index
int32integer

lnrpc.PsbtShim

FieldgRPC TypeREST Type
pending_chan_id
bytesstring
base_psbt
bytesstring
no_publish
boolboolean