A generic API to leverage the full potential of your connected node. Use any API node provides.

➡ī¸ This API is part of the upcoming WebBTC spec.

The available APIs heavily depend on the connector (LND, CLN, etc) that is used. You can use webln.getInfo to check for supported methods. (methods)


async function request(method: string, params: Object): RequestResponse;


See the API docs of the connector that is currently in use. (e.g. the LND API or the CLN API)

Code Example (using LND)

await webln.enable();

// check if the connected node supports the required methods
const info = await webln.getInfo();
if (!info.methods.includes("listpeers")) {
  alert('Invalid node connection. Please use LND');
// list all connected peers
await webln.request("listpeers");
// response: 
{ peers: [
  address: "",
  bytes_recv: "23275891"
  bytes_sent: "519238"
  ... see LND API: https://api.lightning.community/#lnrpc-peer

// connect to a new peer
const pubkey = "02af02be7c7e5cf...";
const host = "";
await webln.request('connectpeer', { addr: {host, pubkey }, perm: true})


Supported connectors

Connector🐝 Alby



Last updated