mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 09:54:16 +01:00
976c0c90bc
- Changed ALL `doc/schemas/lightning-*.json` file's `json_example` to `examples` - Change the heading from example to examples - Bring shell command before the json command - Move Example to the end of the page - Remove horizontal line from Example
313 lines
11 KiB
JSON
313 lines
11 KiB
JSON
{
|
|
"$schema": "../rpc-schema-draft.json",
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"rpc": "keysend",
|
|
"title": "Send funds to a node without an invoice",
|
|
"description": [
|
|
"The **keysend** RPC command attempts to find a route to the given destination, and send the specified amount to it. Unlike the `pay` RPC command the `keysend` command does not require an invoice, instead it uses the `destination` node ID, and `amount` to find a route to the specified node.",
|
|
"",
|
|
"In order for the destination to be able to claim the payment, the `payment_key` is randomly generated by the sender and included in the encrypted payload for the destination. As a consequence there is not proof-of-payment, like there is with an invoice where the `payment_key` is generated on the destination, and the only way sender could have it is by sending a payment. Please ensure that this matches your use-case when using `keysend`.",
|
|
"",
|
|
"When using *lightning-cli*, you may skip optional parameters by using *null*. Alternatively, use **-k** option to provide parameters by name."
|
|
],
|
|
"request": {
|
|
"required": [
|
|
"destination",
|
|
"amount_msat"
|
|
],
|
|
"properties": {
|
|
"destination": {
|
|
"type": "pubkey",
|
|
"description": [
|
|
"The 33 byte, hex-encoded, node ID of the node that the payment should go to."
|
|
]
|
|
},
|
|
"amount_msat": {
|
|
"type": "msat",
|
|
"description": [
|
|
"A whole number, or a whole number with suffix `msat` or `sat`, or a three decimal point number with suffix `sat`, or an 1 to 11 decimal point number suffixed by `btc`."
|
|
]
|
|
},
|
|
"label": {
|
|
"type": "string",
|
|
"description": [
|
|
"Used to attach a label to payments, and is returned in lightning-listpays(7) and lightning-listsendpays(7)."
|
|
]
|
|
},
|
|
"maxfeepercent": {
|
|
"type": "number",
|
|
"description": [
|
|
"Limits the money paid in fees as percentage of the total amount that is to be transferred."
|
|
],
|
|
"default": "0.5"
|
|
},
|
|
"retry_for": {
|
|
"type": "u32",
|
|
"description": [
|
|
"Until *retry_for* seconds passes, the command will keep finding routes and retrying the payment. However, a payment may be delayed for up to `maxdelay` blocks by another node; clients should be prepared for this worst case."
|
|
],
|
|
"default": "60 seconds"
|
|
},
|
|
"maxdelay": {
|
|
"type": "u32",
|
|
"description": [
|
|
"Number of blocks the payment may be delayed."
|
|
]
|
|
},
|
|
"exemptfee": {
|
|
"type": "msat",
|
|
"description": [
|
|
"Used for tiny payments which would be dominated by the fee leveraged by forwarding nodes. Setting `exemptfee` allows the `maxfeepercent` check to be skipped on fees that are smaller than *exemptfee*."
|
|
],
|
|
"default": "5000 millisatoshi"
|
|
},
|
|
"routehints": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": [
|
|
"id",
|
|
"scid",
|
|
"feebase",
|
|
"feeprop",
|
|
"expirydelta"
|
|
],
|
|
"properties": {
|
|
"id": {
|
|
"type": "pubkey"
|
|
},
|
|
"scid": {
|
|
"type": "short_channel_id"
|
|
},
|
|
"feebase": {
|
|
"type": "msat"
|
|
},
|
|
"feeprop": {
|
|
"type": "u32"
|
|
},
|
|
"expirydelta": {
|
|
"type": "u16"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"extratlvs": {
|
|
"type": "object",
|
|
"additionalProperties": true,
|
|
"required": [],
|
|
"description": [
|
|
"Dictionary of additional fields to insert into the final tlv. The format is 'fieldnumber': 'hexstring'."
|
|
]
|
|
}
|
|
}
|
|
},
|
|
"response": {
|
|
"required": [
|
|
"payment_preimage",
|
|
"payment_hash",
|
|
"created_at",
|
|
"parts",
|
|
"amount_msat",
|
|
"amount_sent_msat",
|
|
"status"
|
|
],
|
|
"properties": {
|
|
"payment_preimage": {
|
|
"type": "secret",
|
|
"description": [
|
|
"The proof of payment: SHA256 of this **payment_hash**."
|
|
]
|
|
},
|
|
"destination": {
|
|
"type": "pubkey",
|
|
"description": [
|
|
"The final destination of the payment."
|
|
]
|
|
},
|
|
"payment_hash": {
|
|
"type": "hash",
|
|
"description": [
|
|
"The hash of the *payment_preimage* which will prove payment."
|
|
]
|
|
},
|
|
"created_at": {
|
|
"type": "number",
|
|
"description": [
|
|
"The UNIX timestamp showing when this payment was initiated."
|
|
]
|
|
},
|
|
"parts": {
|
|
"type": "u32",
|
|
"description": [
|
|
"How many attempts this took."
|
|
]
|
|
},
|
|
"amount_msat": {
|
|
"type": "msat",
|
|
"description": [
|
|
"Amount the recipient received."
|
|
]
|
|
},
|
|
"amount_sent_msat": {
|
|
"type": "msat",
|
|
"description": [
|
|
"Total amount we sent (including fees)."
|
|
]
|
|
},
|
|
"warning_partial_completion": {
|
|
"type": "string",
|
|
"description": [
|
|
"Not all parts of a multi-part payment have completed."
|
|
]
|
|
},
|
|
"status": {
|
|
"type": "string",
|
|
"enum": [
|
|
"complete"
|
|
],
|
|
"description": [
|
|
"Status of payment."
|
|
]
|
|
}
|
|
},
|
|
"post_return_value_notes": [
|
|
"You can monitor the progress and retries of a payment using the lightning-paystatus(7) command."
|
|
]
|
|
},
|
|
"randomization": [
|
|
"To protect user privacy, the payment algorithm performs some randomization.",
|
|
"",
|
|
"1: Route Randomization",
|
|
"",
|
|
"Route randomization means the payment algorithm does not always use the lowest-fee or shortest route. This prevents some highly-connected node from learning all of the user payments by reducing their fees below the network average.",
|
|
"",
|
|
"2: Shadow Route",
|
|
"",
|
|
"Shadow route means the payment algorithm will virtually extend the route by adding delays and fees along it, making it appear to intermediate nodes that the route is longer than it actually is. This prevents intermediate nodes from reliably guessing their distance from the payee.",
|
|
"",
|
|
"Route randomization will never exceed *maxfeepercent* of the payment. Route randomization and shadow routing will not take routes that would exceed *maxdelay*."
|
|
],
|
|
"errors": [
|
|
"The following error codes may occur:",
|
|
"",
|
|
"- -1: Catchall nonspecific error.",
|
|
"- 203: Permanent failure at destination. The *data* field of the error will be routing failure object.",
|
|
"- 205: Unable to find a route.",
|
|
"- 206: Route too expensive. Either the fee or the needed total locktime for the route exceeds your *maxfeepercent* or *maxdelay* settings, respectively. The *data* field of the error will indicate the actual *fee* as well as the *feepercent* percentage that the fee has of the destination payment amount. It will also indicate the actual *delay* along the route.",
|
|
"- 210: Payment timed out without a payment in progress.",
|
|
"",
|
|
"A routing failure object has the fields below:",
|
|
"",
|
|
"*erring_index*: The index of the node along the route that reported the error. 0 for the local node, 1 for the first hop, and so on.",
|
|
"*erring_node*: The hex string of the pubkey id of the node that reported the error.",
|
|
"*erring_channel*: The short channel ID of the channel that has the error, or *0:0:0* if the destination node raised the error.",
|
|
"*failcode*: The failure code, as per BOLT #4.",
|
|
"*channel_update*: The hex string of the *channel_update* message received from the remote node. Only present if error is from the remote node and the *failcode* has the `UPDATE` bit set, as per BOLT #4."
|
|
],
|
|
"author": [
|
|
"Christian Decker <<decker@blockstream.com>> is mainly responsible."
|
|
],
|
|
"see_also": [
|
|
"lightning-listpays(7)",
|
|
"lightning-decodepay(7)",
|
|
"lightning-listinvoices(7)",
|
|
"lightning-delinvoice(7)",
|
|
"lightning-getroute(7)",
|
|
"lightning-invoice(7)"
|
|
],
|
|
"resources": [
|
|
"Main web site: <https://github.com/ElementsProject/lightning>"
|
|
],
|
|
"examples": [
|
|
{
|
|
"request": {
|
|
"id": "example:keysend#1",
|
|
"method": "keysend",
|
|
"params": {
|
|
"destination": "035d2b1192dfba134e10e540875d366ebc8bc353d5aa766b80c090b39c3a5d885d",
|
|
"amount_msat": 10000
|
|
}
|
|
},
|
|
"response": {
|
|
"destination": "035d2b1192dfba134e10e540875d366ebc8bc353d5aa766b80c090b39c3a5d885d",
|
|
"payment_hash": "b6f88603008a9f7dd84b1b94c7b972c8efbaf0b86c8d3c04512955992da9028e",
|
|
"created_at": 1706315742.6861734,
|
|
"parts": 1,
|
|
"amount_msat": 10000,
|
|
"amount_sent_msat": 10001,
|
|
"payment_preimage": "7178cf708e34dce816fc35aa692a65e1f85b92ae03bbc8ae6543302511823174",
|
|
"status": "complete"
|
|
}
|
|
},
|
|
{
|
|
"request": {
|
|
"id": "example:keysend#2",
|
|
"method": "keysend",
|
|
"params": {
|
|
"destination": "0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518",
|
|
"amount_msat": 10000000,
|
|
"extratlvs": {
|
|
"133773310": "68656c6c6f776f726c64",
|
|
"133773312": "66696c7465726d65"
|
|
}
|
|
}
|
|
},
|
|
"response": {
|
|
"destination": "0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518",
|
|
"payment_hash": "e8474eea8d5673e8407ef5f4924e58479b51a68afd136384683d5d6a97c9520d",
|
|
"created_at": 1708640424.1810749,
|
|
"parts": 1,
|
|
"amount_msat": 10000000,
|
|
"amount_sent_msat": 10000000,
|
|
"payment_preimage": "40e47272ea7da20c57a2381d81a5513ec03bd8ead9d51fbd2a91ec76d3f4bcbf",
|
|
"status": "complete"
|
|
}
|
|
},
|
|
{
|
|
"request": {
|
|
"id": "example:keysend#3",
|
|
"method": "keysend",
|
|
"params": {
|
|
"destination": "035d2b1192dfba134e10e540875d366ebc8bc353d5aa766b80c090b39c3a5d885d",
|
|
"amount_msat": 10000,
|
|
"routehints": [
|
|
[
|
|
{
|
|
"scid": "4615051x2233541x57738",
|
|
"id": "022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59",
|
|
"feebase": 1,
|
|
"feeprop": 10,
|
|
"expirydelta": 9
|
|
}
|
|
],
|
|
[
|
|
{
|
|
"scid": "1x2x3",
|
|
"id": "020202020202020202020202020202020202020202020202020202020202020202",
|
|
"feebase": 1,
|
|
"feeprop": 1,
|
|
"expirydelta": 9
|
|
}
|
|
]
|
|
]
|
|
}
|
|
},
|
|
"response": {
|
|
"destination": "035d2b1192dfba134e10e540875d366ebc8bc353d5aa766b80c090b39c3a5d885d",
|
|
"payment_hash": "56e12e6f45120bef7385c9bf307319eaa6a1b9160cdb3e62a3f492abf5bfa4bc",
|
|
"created_at": 1708640437.2895157,
|
|
"parts": 1,
|
|
"amount_msat": 10000,
|
|
"amount_sent_msat": 10001,
|
|
"payment_preimage": "682870b8f96e2aed1c86694dbb2c3e64cd396b9bba9fafd824d90eb0bd371b85",
|
|
"status": "complete"
|
|
}
|
|
}
|
|
]
|
|
}
|