Research/Bitcoin Dev Archive / lightning-dev list
Offline Lightning-enabled Vending Machines
2 messages, Nov 13 to 28, 2018. Started by ZmnSCPxj.
ZmnSCPxj (2)
Good morning list,
During the summit, it was asked about an actual application problem for vending machines without any secret keys (so that hackers of vending machines cannot steal money from the machine).
It was quite very satisfactorily solved by one of us, and I thought it would best shared and recorded for posterity (as it was not recorded in the wiki).
The problem:
1. There exists a vending machine which must be offline and not contain any secret keys, in order to prevent theft from the machine.
As the machine is not under direct control of the owner of the machine, it is better if the attack surface is reduced.
2. The owner of the vending machine (who is selling the product) has a separate, probably singular, Lightning node to receive payments.
The solution:
1. Each vending machine contains a fixed number of hashes, as well as invoice signatures (signed by the owner Lightning node) corresponding to each hash.
The number of hashes must at least equal the number of product for sale.
The description of the product as well as the invoice price is fixed (after all, Bitcoin must be our unit of account).
(for vending machines supporting multiple product types, simply multiply this table by the number of different product types)
2. Each hash has a 1-bit flag, initially 0.
This flag is set to 1 when the hash has been claimed.
3. When a customer requests to purchase a product, the machine searches for a hash whose flag is 0.
It generates the invoice (concatenating the description and price, and filling in the payment hash and invoice signature) and gives to customer.
4. The customer pays as normal.
The vending machine owner node receives this payment and releases the preimage as proof-of-payment.
5. The customer gives the preimage to the machine, via QR code or via short-range radio technology such as bluetooth or NFC.
6. The machine checks the preimage, computes it hash, and checks if it is in the list of hashes.
If so, and the claim flag is not set, it sets the flag and releases the product.
OPEN PROBLEM: If product release fails due to mechanical failure, there is no way to easily refund the payment.
7. When replenishing the supply of product to the vending machine, the supply of hashes can also be replenished by the owner of the vending machine also.
Regards, ZmnSCPxj
Good morning list,
Since I have not spammed the list enough with pointless ideas, I consider now an extension of this idea, the meta-vending machine.
A vending machine contains products and dispenses them for proof that the owner of the machine has been paid. A meta-vending machine contains vending machines and dispenses them for proof-of-payment.
In actuality, a meta-vending machine contains several machine-lockable boxes. Each box is initially empty. The contents of each box is visible.
Suppose I have a product I wish to sell. I "rent" one of these boxes by paying the meta-vending machine owner (using the same technique already discussed below). Then the box requests for my invoice.
Later, someone passes by the meta-vending machine, and sees my product and decides to purchase it. The meta-vending machine provides the invoice, and in exchange for the preimage to the hash in the invoice, opens the bos and lets the buyer get th product. The box can then be reused by another seller.
Suppose the product is not sold. Since I know the preimage, I can also provide the preimage and get my product back. I could then replace the product, or sell another product, or refresh the invoice.
Such an automated system would be useful for selling small items. Depending on the security of the machine itself, the value of the item may be large. It can also be used as a somewhat-anonymous rendezvous point for transferring small items in exchange for money, such as valuable collectible cards.
In essence, such a meta-vending machine provides an HTLC-like behavior in the real world, and allows us to extend the ZKCP by one hop into real-world items.
Of course, trust is now needed in the meta-vending machine owner. Presumably the meta-vending machine owner can simply unlock any arbitrary box and take the item inside. Thus the practical maximum value of the items sold via such a machine may be limited by the trustworthiness of the meta-vending machine owner.
Regards, ZmnSCPxj