From ZmnSCPxj at protonmail.com Mon Jun 10 06:04:08 2019 From: ZmnSCPxj at protonmail.com (ZmnSCPxj) Date: Mon, 10 Jun 2019 06:04:08 +0000 Subject: [Lightning-dev] ECDH for spontaneous payments and offline vending machines In-Reply-To: References: Message-ID: Good morning Stepan, These are very good developments and I applaud them. > Vending machine generates an ephemeral key `k` and corresponding ephemeral node id `K`. It generates an invoice signed with this key. It also includes a routing information that the payment should go through our online node `N`. As a preimage we use `hmac-sha256(x, amount)` where `x` is a secret key from ECDH(K, N) - (x-coordinate of `k * N`). We also put the amount into the 8-byte short channel id in the routing information to ensure that the node can calculate the preimage even if the user is willing to pay a tip and increases the amount of the htlc. Just to be clear: each time the vending node needs a new invoice, it generates a new ephemeral key `k`? Regards, ZmnSCPxj