The createonion RPC command allows the caller to create a custom onion
with custom payloads at each hop in the route. A custom onion can be used to
implement protocol extensions that are not supported by Core Lightning directly.
The hops parameter is a JSON list of dicts, each specifying a node and the
payload destined for that node. The following is an example of a 3 hop onion:
The hops parameter is very similar to the result from getroute however it
needs to be modified slightly. The following is the getroute response from
which the above hops parameter was generated:
Notice that the payload in the hops parameter is the hex-encoded version
of the parameters in the getroute response.
Except for the pubkey, the values are shifted left by one, i.e., the 1st
payload in createonion corresponds to the 2nd set of values from getroute.
The final payload is a copy of the last payload sans channel
These rules are directly derived from the onion construction. Please refer
BOLT 04 for details and rationale.
The assocdata parameter specifies the associated data that the onion should
commit to. If the onion is to be used to send a payment later it MUST match
the payment_hash of the payment in order to be valid.
The optional session_key parameter can be used to specify a secret that is
used to generate the shared secrets used to encrypt the onion for each hop. It
should only be used for testing or if a specific shared secret is
important. If not specified it will be securely generated internally, and the
shared secrets will be returned.
The optional onion_size parameter specifies a size different from the default
payment onion (1300 bytes). May be used for custom protocols like trampoline
routing.
The createonion RPC command allows the caller to create a custom onion with custom payloads at each hop in the route. A custom onion can be used to implement protocol extensions that are not supported by Core Lightning directly.
The hops parameter is a JSON list of dicts, each specifying a node and the payload destined for that node. The following is an example of a 3 hop onion:
The hops parameter is very similar to the result from
getroute
however it needs to be modified slightly. The following is thegetroute
response from which the above hops parameter was generated:getroute
response.createonion
corresponds to the 2nd set of values fromgetroute
.channel
These rules are directly derived from the onion construction. Please refer BOLT 04 for details and rationale.
The assocdata parameter specifies the associated data that the onion should commit to. If the onion is to be used to send a payment later it MUST match the
payment_hash
of the payment in order to be valid.The optional session_key parameter can be used to specify a secret that is used to generate the shared secrets used to encrypt the onion for each hop. It should only be used for testing or if a specific shared secret is important. If not specified it will be securely generated internally, and the shared secrets will be returned.
The optional onion_size parameter specifies a size different from the default payment onion (1300 bytes). May be used for custom protocols like trampoline routing.