Lightning Network Channels

Open ChannelAPI-v2lightning::channels::open_channel

The lightning::channels::open_channel method opens a new channel with a remote node.

Request Parameters

ParameterTypeDescription
coinstringThe ticker of the coin you would like to open a channel for.
node_addressstringLightning node addresses always have a format of node_pubkey@ip_address:port.
amountobjectA standard LightningChannelAmount object.
push_msatintegerOptional. The amount in millisatoshi to push to the counterparty while openning, to create inbound liquidity for the channel. Using the push_msat parameter avoids having to send funds in a separate request later. Please note that the funds given using push_msat is given unconditionally, meaning that there is no proof of payment in a preimage as with paying an invoice.
channel_optionsobjectOptional. A standard LightningChannelOptions object.
channel_configsobjectOptional. A standard LightningChannelConfig object.

📌 Example using an exact amount

POST open_channel
{
  "userpass": "RPC_UserP@SSW0RD",
  "mmrpc": "2.0",
  "method": "lightning::channels::open_channel",
  "params": {
    "coin": "tBTC-lightning",
    "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@203.132.94.196:9735",
    "amount": {
      "type": "Exact",
      "value": 0.004
    }
  },
  "id": 22
}
Show Response

Response

{
	"mmrpc": "2.0",
	"result": {
		"uuid": "434681f8-95e5-484f-af49-fa80d8ae857b",
		"node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@233.112.95.142:9735"
	},
	"id": 22
}

📌 Example using max available with channel options and configs

POST open_channel
{
  "userpass": "RPC_UserP@SSW0RD",
  "mmrpc": "2.0",
  "method": "lightning::channels::open_channel",
  "params": {
    "coin": "tBTC-lightning",
    "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@203.132.94.196:9735",
    "amount": {
      "type": "Max"
    },
    "push_msat": 0,
    "channel_options": {
      "proportional_fee_in_millionths_sats": 0,
      "base_fee_msat": 1000,
      "cltv_expiry_delta": 72,
      "max_dust_htlc_exposure_msat": 5000000,
      "force_close_avoidance_max_fee_satoshis": 1000
    },
    "channel_configs": {
      "counterparty_locktime": 144,
      "our_htlc_minimum_msat": 1,
      "negotiate_scid_privacy": false,
      "max_inbound_in_flight_htlc_percent": 10,
      "commit_upfront_shutdown_pubkey": true,
      "inbound_channels_confirmations": 3,
      "their_channel_reserve_sats": 10000
    }
  },
  "id": null
}
Show Response

Response

{
	"mmrpc": "2.0",
	"result": {
		"uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92",
		"node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@203.132.94.196:9735"
	},
	"id": null
}

Close ChannelAPI-v2lightning::channels::close_channel

The lightning::channels::close_channel method closes a channel with a remote node.

Request Parameters

ParameterTypeDescription
coinstringThe ticker of the coin you would like to close a channel for.
uuidstringUnique channel identifier.
force_closebooleanOptional, defaults to false. If true, will force closure of the channel.

📌 Example to force closing a channel

POST close_channel
{
  "userpass": "RPC_UserP@SSW0RD",
  "mmrpc": "2.0",
  "method": "lightning::channels::close_channel",
  "params": {
    "coin": "tBTC-lightning",
    "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92",
    "force_close": true
  },
  "id": 8
}
Show Response

Response

{
	"mmrpc": "2.0",
	"result": "Initiated closing of channel with uuid: 2b50e274-c173-4fa1-95f3-97f9f82ace92",
	"id": 8
}
Show Error Responses

InvalidRequest Error

{
	"mmrpc": "2.0",
	"error": "Error parsing request: missing field `uuid`",
	"error_path": "dispatcher",
	"error_trace": "dispatcher:109]",
	"error_type": "InvalidRequest",
	"error_data": "missing field `uuid`",
	"id": 8
}

NoSuchChannel Error

{
	"mmrpc": "2.0",
	"error": "No such channel with uuid 2b50e274-c173-4fa1-95f3-97f9f82ace92",
	"error_path": "close_channel",
	"error_trace": "close_channel:55]",
	"error_type": "NoSuchChannel",
	"error_data": "2b50e274-c173-4fa1-95f3-97f9f82ace92",
	"id": 8
}

Update ChannelAPI-v2lightning::channels::update_channel

The lightning::channels::update_channel method updates channel options.

Request Parameters

ParameterTypeDescription
coinstringThe ticker of the coin you would like to update channel configuration options for.
uuidstringUnique channel identifier.
channel_optionsobjectA standard LightningChannelOptions object.

📌 Example to update all available channel options

POST update_channel
{
  "userpass": "RPC_UserP@SSW0RD",
  "mmrpc": "2.0",
  "method": "lightning::channels::update_channel",
  "params": {
    "coin": "tBTC-lightning",
    "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b",
    "channel_options": {
      "proportional_fee_in_millionths_sats": 1,
      "base_fee_msat": 1100,
      "cltv_expiry_delta": 72,
      "max_dust_htlc_exposure_msat": 5000000,
      "force_close_avoidance_max_fee_satoshis": 1000
    }
  },
  "id": 2
}
Show Response

Response

{
	"mmrpc": "2.0",
	"result": {
		"channel_options": {
			"proportional_fee_in_millionths_sats": 1,
			"base_fee_msat": 1100,
			"cltv_expiry_delta": 72,
			"max_dust_htlc_exposure_msat": 5000000,
			"force_close_avoidance_max_fee_sats": null
		}
	},
	"id": 2
}
Show Error Responses

NoSuchChannel Error

Channel with the given uuid is not foun on the lightning network.

{
	"mmrpc": "2.0",
	"error": "No such channel with uuid dc33b998-8589-44fd-a246-256a582e8942",
	"error_path": "update_channel",
	"error_trace": "update_channel:61]",
	"error_type": "NoSuchChannel",
	"error_data": "dc33b998-8589-44fd-a246-256a582e8942",
	"id": 2
}

Get Channel DetailsAPI-v2lightning::channels::get_channel_details

The lightning::channels::get_channel_details method returns details about a channel.

Request Parameters

ParameterTypeDescription
coinstringThe ticker of the coin you would like to view channel details for.
uuidstringUnique channel identifier.

📌 Example to update all available channel options

POST get_channel_details
{
  "userpass": "RPC_UserP@SSW0RD",
  "mmrpc": "2.0",
  "method": "lightning::channels::get_channel_details",
  "params": {
    "coin": "tBTC-lightning",
    "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92"
  },
  "id": 54
}
Show Response

Response (opened channel)

{
	"mmrpc": "2.0",
	"result": {
		"status": "Open",
		"details": {
			"uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92",
			"channel_id": "4a869115dfd260d0925a1266f544a6ab36666448d4bbc0e2a028d8426b2b6d4e",
			"counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9",
			"funding_tx": "4e6d2b6b42d828a0e2c0bbd448646636aba644f566125a92d060d2df1591864a",
			"funding_tx_output_index": 0,
			"funding_tx_value_sats": 959722,
			"is_outbound": true,
			"balance_msat": 959722000,
			"outbound_capacity_msat": 950125000,
			"inbound_capacity_msat": 0,
			"current_confirmations": 0,
			"required_confirmations": 3,
			"is_ready": false,
			"is_usable": false,
			"is_public": false
		}
	},
	"id": 54
}

Response (closed channel)

{
	"mmrpc": "2.0",
	"result": {
		"status": "Open",
		"details": {
			"uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92",
			"channel_id": "4a869115dfd260d0925a1266f544a6ab36666448d4bbc0e2a028d8426b2b6d4e",
			"counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9",
			"funding_tx": "4e6d2b6b42d828a0e2c0bbd448646636aba644f566125a92d060d2df1591864a",
			"funding_value": "98982",
			"closing_tx": "f1591864ad0e2c0bad060425a94b8288646e6d24f56b6d2db42d4636aba64612",
			"closure_reason": "null",
			"claiming_tx": "null",
			"claimed_balance": "null",
			"funding_generated_in_block": "null",
			"is_outbound": false,
			"is_public": true,
			"is_closed": true,
			"created_at": 167273496966,
			"closed_at": 171069595935
		}
	},
	"id": 54
}
Show Error Responses

InvalidRequest Error

{
	"mmrpc": "2.0",
	"error": "Error parsing request: missing field `coin`",
	"error_path": "dispatcher",
	"error_trace": "dispatcher:109]",
	"error_type": "InvalidRequest",
	"error_data": "missing field `coin`",
	"id": 54
}

Get Claimable BalancesAPI-v2lightning::channels::get_claimable_balances

The lightning::channels::get_claimable_balances method returns a list of claimable balances for a coin.

Request Parameters

ParameterTypeDescription
coinstringThe ticker of the coin you would like to view claimable balances for.
include_open_channels_balancesintegerOptional, defaults to false. If true, includes balances from open channels.

📌 Example to update all available channel options

POST get_claimable_balances
{
  "userpass": "RPC_UserP@SSW0RD",
  "mmrpc": "2.0",
  "method": "lightning::channels::get_claimable_balances",
  "params": {
    "coin": "tBTC-lightning",
    "include_open_channels_balances": true
  },
  "id": 762
}
Show Response

Response

{
	"mmrpc": "2.0",
	"result": [{
		"ClaimableOnChannelClose": {
			"claimable_amount_satoshis": 0
		}
	}, {
		"ClaimableOnChannelClose": {
			"claimable_amount_satoshis": 38815
		}
	}, {
		"ClaimableOnChannelClose": {
			"claimable_amount_satoshis": 959539
		}
	}],
	"id": 762
}

List Open Channels by FilterAPI-v2lightning::channels::list_open_channels_by_filter

The lightning::channels::list_open_channels_by_filter method returns a list of open channels filtered by the provided filter object.

Request Parameters

ParameterTypeDescription
coinstringThe ticker of the coin you would like to view open channels for.
filterobjectA standard LightningOpenChannelsFilter object.
paging_optionsobjectOptional. A standard Pagination object.
limitintegerOptional, defaults to 10. Maximum number of results to return.

📌 Example without using filter parameter

Command

POST list_open_channels_by_filter
{
  "userpass": "RPC_UserP@SSW0RD",
  "mmrpc": "2.0",
  "method": "lightning::channels::list_open_channels_by_filter",
  "params": {
    "coin": "tBTC-lightning"
  },
  "id": 55
}
Show Response

Response

{
	"mmrpc": "2.0",
	"result": {
		"open_channels": [{
			"uuid": "434681f8-95e5-484f-af49-fa80d8ae857b",
			"channel_id": "ebfbf19193ee26f25c6e236e863786e59818c11e136ce9c50dba63ec44b0c89a",
			"counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9",
			"funding_tx": null,
			"funding_tx_output_index": null,
			"funding_tx_value_sats": 4000,
			"is_outbound": true,
			"balance_msat": 4000000,
			"outbound_capacity_msat": 4000000,
			"inbound_capacity_msat": 0,
			"current_confirmations": 0,
			"required_confirmations": null,
			"is_ready": false,
			"is_usable": false,
			"is_public": false
		}],
		"limit": 10,
		"skipped": 0,
		"total": 1,
		"total_pages": 1,
		"paging_options": {
			"PageNumber": 1
		}
	},
	"id": 55
}

📌 Example with filter for inbound channels only

Command

POST list_open_channels_by_filter
{
  "userpass": "RPC_UserP@SSW0RD",
  "mmrpc": "2.0",
  "method": "lightning::channels::list_open_channels_by_filter",
  "params": {
    "coin": "tBTC-lightning",
    "filter": {
      "is_outbound": false
    }
  },
  "id": 55
}
Show Response

Response

{
	"mmrpc": "2.0",
	"result": {
		"open_channels": [{
			"uuid": "f86dbfae-898a-4f49-8149-58d9dfa095a5",
			"channel_id": "143cd1fa265c4bed860ce81f369d5c4ee8ef80c5c91872176f524348c2c1fff4",
			"counterparty_node_id": "03cf982b1c16f7d3561d8bb17f7cf30057389d228756bce517c0f3cc111b38ecd0",
			"funding_tx": "f4ffc1c24843526f177218c9c580efe84e5c9d361fe80c86ed4b5c26fad13c14",
			"funding_tx_output_index": 0,
			"funding_tx_value_sats": 40000,
			"is_outbound": false,
			"balance_msat": 5211,
			"outbound_capacity_msat": 0,
			"inbound_capacity_msat": 38994789,
			"current_confirmations": 215,
			"required_confirmations": 3,
			"is_ready": true,
			"is_usable": false,
			"is_public": false
		}],
		"limit": 10,
		"skipped": 0,
		"total": 1,
		"total_pages": 1,
		"paging_options": {
			"PageNumber": 1
		}
	},
	"id": 55
}

📌 Example with filter for a specific node_id

Command

POST list_open_channels_by_filter
{
  "userpass": "RPC_UserP@SSW0RD",
  "mmrpc": "2.0",
  "method": "lightning::channels::list_open_channels_by_filter",
  "params": {
    "coin": "tBTC-lightning",
    "filter": {
      "counterparty_node_id": "02eb0b178576857b6990ba57d56aa08f651a05a8098496004f42df5e7440b0a9c1"
    }
  },
  "id": 55
}
Show Response

Response

{
	"mmrpc": "2.0",
	"result": {
		"open_channels": [{
			"uuid": "adde8899-ba11-435a-9433-d180e2f5af6b",
			"channel_id": "4cde288dd1ec1691b51cac8890a867a58fcfc98670e32ed7a112402b819a01f1",
			"counterparty_node_id": "02312627fdf07fbdd7e5ddb136611bdde9b00d26821d14d94891395452f67af248",
			"funding_tx": "f1019a812b4012a1d72ee37086c9cf8fa567a89088ac1cb59116ecd18d28de4c",
			"funding_tx_output_index": 0,
			"funding_tx_value_sats": 40000,
			"is_outbound": true,
			"balance_msat": 38998197,
			"outbound_capacity_msat": 38598197,
			"inbound_capacity_msat": 1803,
			"current_confirmations": 215,
			"required_confirmations": 3,
			"is_ready": true,
			"is_usable": true,
			"is_public": false
		}],
		"limit": 10,
		"skipped": 0,
		"total": 1,
		"total_pages": 1,
		"paging_options": {
			"PageNumber": 1
		}
	},
	"id": 55
}

📌 Example with filter for a node with between 100000 and 500000 satoshi funding value

Command

POST list_open_channels_by_filter
{
  "userpass": "RPC_UserP@SSW0RD",
  "mmrpc": "2.0",
  "method": "lightning::channels::list_open_channels_by_filter",
  "params": {
    "coin": "tBTC-lightning",
    "filter": {
      "from_funding_value_sats": 1000,
      "to_funding_value_sats": 500000
    }
  },
  "id": 55
}
Show Response

Response

{
	"mmrpc": "2.0",
	"result": {
		"open_channels": [{
			"uuid": "adde8899-ba11-435a-9433-d180e2f5af6b",
			"channel_id": "4cde288dd1ec1691b51cac8890a867a58fcfc98670e32ed7a112402b819a01f1",
			"counterparty_node_id": "02312627fdf07fbdd7e5ddb136611bdde9b00d26821d14d94891395452f67af248",
			"funding_tx": "f1019a812b4012a1d72ee37086c9cf8fa567a89088ac1cb59116ecd18d28de4c",
			"funding_tx_output_index": 0,
			"funding_tx_value_sats": 40000,
			"is_outbound": true,
			"balance_msat": 38998197,
			"outbound_capacity_msat": 38598197,
			"inbound_capacity_msat": 1803,
			"current_confirmations": 218,
			"required_confirmations": 3,
			"is_ready": true,
			"is_usable": true,
			"is_public": false
		}, {
			"uuid": "f86dbfae-898a-4f49-8149-58d9dfa095a5",
			"channel_id": "143cd1fa265c4bed860ce81f369d5c4ee8ef80c5c91872176f524348c2c1fff4",
			"counterparty_node_id": "03cf982b1c16f7d3561d8bb17f7cf30057389d228756bce517c0f3cc111b38ecd0",
			"funding_tx": "f4ffc1c24843526f177218c9c580efe84e5c9d361fe80c86ed4b5c26fad13c14",
			"funding_tx_output_index": 0,
			"funding_tx_value_sats": 40000,
			"is_outbound": false,
			"balance_msat": 5211,
			"outbound_capacity_msat": 0,
			"inbound_capacity_msat": 38994789,
			"current_confirmations": 218,
			"required_confirmations": 3,
			"is_ready": true,
			"is_usable": false,
			"is_public": false
		}],
		"limit": 10,
		"skipped": 0,
		"total": 2,
		"total_pages": 1,
		"paging_options": {
			"PageNumber": 1
		}
	},
	"id": 55
}

List Closed Channels by FilterAPI-v2lightning::channels::list_closed_channels_by_filter

The lightning::channels::list_closed_channels_by_filter method returns a list of closed channels filtered by the provided filter object.

Request Parameters

ParameterTypeDescription
coinstringThe ticker of the coin you would like to view closed channels for.
filterobjectA standard LightningClosedChannelsFilter object.
paging_optionsobjectOptional. A standard Pagination object.
limitintegerOptional, defaults to 10. Maximum number of results to return.

📌 Example without using filter parameter

Command

POST list_closed_channels_by_filter
{
  "userpass": "RPC_UserP@SSW0RD",
  "mmrpc": "2.0",
  "method": "lightning::channels::list_closed_channels_by_filter",
  "params": {
    "coin": "tBTC-lightning"
  },
  "id": 55
}
Show Response

Response

{"mmrpc": "2.0",
	"result": {
		"closed_channels": [{
			"uuid": "434681f8-95e5-484f-af49-fa80d8ae857b",
			"channel_id": "ebfbf19193ee26f25c6e236e863786e59818c11e136ce9c50dba63ec44b0c89a",
			"counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9",
			"closure_reason": "Channel closed because counterparty force-closed with message chan size of 0.00004 BTC is below min chan size of 0.0002 BTC",
			"is_outbound": true,
			"is_public": false,
			"is_closed": true,
			"created_at": 1683864431,
			"closed_at": 1683864432
		},
        {
            "uuid": "de006b65-bd30-41e1-9b44-5e04518a3d98",
            "channel_id": "928a041767f23c461fe3b41a387bd3f91a10b284cd7f90fb04544eda4f38f967",
            "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9",
            "closure_reason": "Channel closed because of an exception: We consider the minimum depth to be unreasonably large. Expected minimum: (1). Actual: (3)",
            "is_outbound": true,
            "is_public": false,
            "is_closed": true,
            "created_at": 1683866505,
            "closed_at": 1683866505
        }],
		"limit": 10,
		"skipped": 0,
		"total": 1,
		"total_pages": 1,
		"paging_options": {
			"PageNumber": 1
		}
	}, "id": 55
}

📌 Example with filter for inbound channels only

Command

POST list_closed_channels_by_filter
{
  "userpass": "RPC_UserP@SSW0RD",
  "mmrpc": "2.0",
  "method": "lightning::channels::list_closed_channels_by_filter",
  "params": {
    "coin": "tBTC-lightning",
    "filter": {
      "channel_type": "Inbound"
    }
  },
  "id": 55
}
Show Response

Response


{"mmrpc": "2.0",
	"result": {
		"closed_channels": [{
            "uuid": "de006b65-bd30-41e1-9b44-5e04518a3d98",
            "channel_id": "928a041767f23c461fe3b41a387bd3f91a10b284cd7f90fb04544eda4f38f967",
            "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9",
            "closure_reason": "Channel closed because of an exception: We consider the minimum depth to be unreasonably large. Expected minimum: (1). Actual: (3)",
            "is_outbound": false,
            "is_public": false,
            "is_closed": true,
            "created_at": 1683866505,
            "closed_at": 1683866505
        }],
		"limit": 10,
		"skipped": 0,
		"total": 1,
		"total_pages": 1,
		"paging_options": {
			"PageNumber": 1
		}
	}, "id": 55
}

📌 Example with filter for a specific node_id

Command

POST list_closed_channels_by_filter
{
  "userpass": "RPC_UserP@SSW0RD",
  "mmrpc": "2.0",
  "method": "lightning::channels::list_closed_channels_by_filter",
  "params": {
    "coin": "tBTC-lightning",
    "filter": {
      "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9"
    }
  },
  "id": 55
}
Show Response

Response


{"mmrpc": "2.0",
	"result": {
		"closed_channels": [{
			"uuid": "434681f8-95e5-484f-af49-fa80d8ae857b",
			"channel_id": "ebfbf19193ee26f25c6e236e863786e59818c11e136ce9c50dba63ec44b0c89a",
			"counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9",
			"closure_reason": "Channel closed because counterparty force-closed with message chan size of 0.00004 BTC is below min chan size of 0.0002 BTC",
			"is_outbound": true,
			"is_public": false,
			"is_closed": true,
			"created_at": 1683864431,
			"closed_at": 1683864432
		}],
		"limit": 10,
		"skipped": 0,
		"total": 1,
		"total_pages": 1,
		"paging_options": {
			"PageNumber": 1
		}
	}, "id": 55
}

📌 Example with filter for a node with between 100000 and 500000 satoshi funding value

Command

POST list_closed_channels_by_filter
{
  "userpass": "RPC_UserP@SSW0RD",
  "mmrpc": "2.0",
  "method": "lightning::channels::list_closed_channels_by_filter",
  "params": {
    "coin": "tBTC-lightning",
    "filter": {
      "from_funding_value_sats": 100000,
      "to_funding_value_sats": 500000
    }
  },
  "id": 55
}
Show Response

Response

{
	"mmrpc": "2.0",
	"result": {
		"closed_channels": [{
			"uuid": "f901b604-54f7-4094-80f7-86aa9e362343",
			"channel_id": "20aae008973fad5a59559ac0650143ec5b53aba1c6584d3d92177491a8284d00",
			"counterparty_node_id": "02312627fdf07fbdd7e5ddb136611bdde9b00d26821d14d94891395452f67af248",
			"funding_tx": "3807d9353557d15ad46e90a68dab8e4cd3a68a4af6b61bc7414bf81e29bc0517",
			"funding_value": 40000,
			"closing_tx": "61575237132b78aa5d1b4d62137da316bc67d09804b0bee53ab50f5d7cd0337c",
			"closure_reason": "Channel closed because the channel was cooperatively closed",
			"funding_generated_in_block": 2433122,
			"is_outbound": true,
			"is_public": false,
			"is_closed": true,
			"created_at": 1684083341,
			"closed_at": 1684146940
		}],
		"limit": 10,
		"skipped": 0,
		"total": 1,
		"total_pages": 1,
		"paging_options": {
			"PageNumber": 1
		}
	},
	"id": 762
}