In this post we have a brief overview of what Lightning Network is and how it can and is integrated with existing cryptocurrency ATM’s. We check what are potential advantages and disadvantages of using LN payments for both users and operators.
Lightning Network Overview
There is a lot of information on what Lightning Network is. In short, it is a second layer protocol on top of cryptocurrenices like Bitcoin, Litecoin etc. Effectively, two users have a mutual (multi-signature) transaction on the base layer and then exchange signed new transactions, which are not broadcast to the base layer network and hence are not included into blockchain. Only last transaction in a sequence of exchanged signed transactions (commitment transaction) is broadcast to the blockchain, when one party decides to close the financial relationships with counterparty. Such funding transaction and exchange of signed transaction is called a payment channel.
Description above illustrates how a payment channel works. Alice and Bob first create a transaction, which is sent to the blockchain. Then they both pay each other in the form of exchanging new transaction, where the balance on each side changes depending on the payment amount and direction. And finally each side can close such a payment channel by sending last available (commitment) transaction to the network.
In case the same person or company (operating lightning network node) has multiple payment channels open with various participants, payments can be routed through such a node, and all channels among nodes become a joint network. In this cases a payment from one payer can be sent to recipient, even when they don’t have a direct payment channel open with each other (Alice pays to Carol via Bob on the diagram below). Network of such payment channels is what we know as a Lightning network (referred as “LN”).
LN is mostly developed on top of Bitcoin during last several years, but it is actually a layer on top of all cryptocurrencies. With atomic swaps functionality it is possible to send ETH from ETH payment channel to BTC recipient. Conversion happens during routing by a node which has payment channels in both currencies open. On the diagram below Alice pays to Carol who accept Litecoin on Lightning network. However, Alice has only Bitcoin payment channel with Bob. So she sends 0.005 BTC and Carol receives 0.9 LTC. It is called atomic swap because the transaction including conversion of cryptocurrencies happens simultaneously. It is either fully failed, or fully successfully finished and there is no custodial risk, when Bob can control the funds.
There are known cases for atomic swaps on the LN for ETH, LTC with BTC. Generally speaking any cryptocurrency can become part of Lightning network in such a way. Recent hard fork (November 2019) on Bitcoin Cash network solved transaction malleability, which makes implementation of payment channels on top of BCH much easier, but there is no active known development so far for Lightning Network on Bitcoin Cash protocol, which likely will happen in the future.
LN Usage at ATM’s
Currently cryptocurrency ATM’s settle transactions directly on the blockchain (1st layer or also called “onchain”). This has its own limitations. For example, significantly increased miner fees on Bitcoin network in 2017-2018 forced operators to switch to batching of transactions. What practically means that you buy bitcoin at an ATM, but cryptocurrency is not immediately sent to you. Operator has processes implemented that await for other users of the same ATM network to use machines and then transactions are grouped and sent out to a number of users at a time in one bulk transaction. See diagram below.
The advantage of this approach is that is allows operators to save on miner fees and deliver funds in reasonable time. Let’s assume average required miners fee to settle within 1 hour is $5. If operator sends separate three transactions, it will cost $15, but in case of batching all 3 transactions are sent at a cost of $5.
In an attempt to cover costs for increased miners fees, many operators since 2017 started to charge customers fixed flat fee additionally to % commission. Normally, you see pricing policy as 1-2 USD + X%. Some operators move to extreme levels and charge $10-15 as a fixed fee, so it is made an additional revenue stream for operators, instead of a tool to cover a miner fee. Especially hard it hits users with smaller amounts, e.g. you purchase a cryptocurrency for $50 equivalent and if operator takes $15 cut as a flat fee and another $5 as a percentage (%10 commission), user ends up paying $20, which is equivalent of 40% from the amount.
Also it was back in 2017 when many bitcoin ATM’s operators enabled other coins. LTC was used as an instrument to replace BTC for transaction purpose and save on fees, while its network was not congested compared to Bitcoin.
Batching of transactions is good by itself, as it allows to utilize blockchain more efficiently (same economic activity with less transactions), but it produces the same UTXO number, which is one of critical metrics for scaling. Also batching creates asymmetry on the market, as it can be more efficiently used by large operators.
Lets compare two operators one with 200 ATM’s and another with 3 ATM’s. Both have on average 3 users per ATM per day (let’s take 12 hours as normal operational hours). The large operator has 600 transactions per day, and assuming usage is distributed evenly over working hours, they can batch 10 transactions per 1 onchain transaction every 12 minutes. 12 minutes is not immediate, but still is acceptable from UX point of view.
Small operator has only 9 transactions per day. So if he wants to get same savings on miner fees, he can batch only once a day (9 transactions at ATM are grouped into 1 onchain transaction). This is obviously an awful UX, it will produce many complaints from customers about not received coins by users and increase support costs for operator. So effectively large miner fees on the blockchain produce centralization over bitcoin ATM operators. This was potentially one of the reasons that contributed to the trend observed over the last 2 years when large operators increase number of machines rapidly, and acquire small operators’ business due to economies of scale.
What Value Lightning Network Can Bring to ATM operation
Let’s look at 2 main operation types of an ATM and check what the pros and cons LN provides.
User inserts cash and gets cryptocurrency. In order for such a transaction to happen solely on LN, user needs to have similar size inbound capacity available before using an ATM. That means user needs:
- to have an already open channel(-s);
- above is not sufficient, as it has to have inbound capacity in at least the amount of purchase at ATM. It means liquidity to be on the counterparty side of the payment channel.
Let’s call such users “advanced”. For example, someone opened a channel before, and used all funds to make online purchases. For such users ATM can become an instant LN balance replenish machine. Fund transfer doesn’t need to be batched by operator, so transaction is immediate, once cash is inserted, user immediately gets LN payment. In this case a payment still needs to be routed over 1 or several LN nodes (as there is no direct channel with operator), so it is hard to claim fees will be negligible, but it will likely be lower than onchain payment.
Another group of users are “new” users. They don’t have any exposure to LN, in this case the transaction at an ATM will highly likely be a channel opening transaction (funding transaction). So user gets funds on LN, but it needs to be settled on-chain first. The UX won’t be great, as user will need to wait for transaction to be included in a block and get enough confirmations. Also it will be costly as on-chain fees highly likely to be paid by end user. The on-chain fees potentially can be reduced in case operator does batching and open several channels with several clients at a time in one on-chain transaction. This might become possible with channel factories concept.
If user keeps this channel open, and fully uses funds from there, he can easily replenish channel later. As it will be open with operator directly, the payment will be free, unless operator decides to charge LN fees for that. So once the user is introduced to LN, the UX at an ATM will improve. For all practical reasons if LN become popular enough, many operators will support it, and user could use ATM’s of other operator networks to replenish the existing channel (described as “advanced” user above).
There is a limitation now on maximum LN channel cap of 0.16777215 BTC, which is currently roughly $1250. Although, this is higher than average ATM transaction, some users definitely do larger than this amount in one ATM transaction, and this will require opening several channels and probably limiting the user on a max transaction cap at ATM, which will make UX worse than currently is. But this limitation is a temporary measure during network bootstrap.
Another downside here could be that the channel will be opened with operator, potentially the payment pattern will be observed by operator per each user, as all payments will be routed through operator’s node, and they will know that exactly this user pays this particular amount at this time. Also the periodical replenishment for the same previously opened channel will make identification of the same user easier, on top of all existing KYC-features. So even without applying invasive KYC/AML practices operators will be able to connect several usages of ATM’s to the same person (in case done within same ATM network and replenishment of existing payment channel is done). This can be mitigated by having various channels on the user side, e.g. with different operators or providers, and using atomic multi-path payments (AMP), when one payment is split into several parts, and routed separately.
Currently the process of sell transactions is the following: a user needs to send BTC funds to an ATM address, then wait for 1 or several confirmations and come back to withdraw cash. Previously, many operators used 0-confirmation acceptance as network worked more reliably and RBF was not a de facto standard, but in the past, many operators switched to requiring at least one confirmation, some operators were even hit by fraudsters, who initiated withdrawals, but once received cash changed transaction recipient address.
As LN is more reliable with respect to settlement process (settlement here means on LN, not underlying blockchain), then process of selling cryptocurrency using LN can improve the process flow. Once LN transaction is sent by customer, cash can be immediately dispensed to a user. That means much better UX, as user needs to come to an ATM only once, and transaction itself is very quick.
Using some trick the ATM can even operate in offline mode, when user initiates a transaction, an offline machine generates the invoice based on stored keys, and then the user pays over LN. ATM network online server receives the payment, and the user shares a preimage of payment to ATM, and in such a way can prove that LN payment is done, while the preimage corresponds to the invoice issued by ATM. The problem is very topical, as many ATM are located in places where broadband connection is not possible and hence Wi-Fi or mobile internet is used, which results in ATM being offline and non-operational from time to time. The key issue with this approach is to detect the current price by ATM, but in case the offline gap is not large, operator can accept risks of allowing such transactions at last known price.
More interestingly it works both ways, so ATM can go offline and still operate both ways for buy and sell transactions. Stepan Snigirev shows a demo of his Lightning Candy ATM, which operates in fully offline mode, while the payments are received and sent from server:
Another advantage LN may provide is liquidity. With atomic swaps functionality (explained above) it is possible to send a payment in one currency, but then recipient will receive it in another cryptocurrency. As of now, in order to support various currencies operator needs to keep liquidity in various cryptocurrencies, and also technically support it, e.g. upgrade full node software, provide extra support to users in case issues are specific to particular chain. With LN operators potentially might operate in one cryptocurrency, but customers could receive or send any cryptocurrency they want, as long as there is enough network and liquidity support across the nodes in the network.
Implementations and Support of LN ATM by Manufactures and Operators
The first known LN transaction dates back to January 2018. The Coinfinity team (a company based in Austria), who operates bitcoin ATM’s and also a network of Bitcoinbon coupons, where people can buy bitcoins for cash, showed how LN works on Bitcoin mainnet. They implemented the LN support on a Lamassu machine, and were able to show for demo purposes a LN transaction of buying BTC. This was a channel funding transaction as well.
It was the time when BTC network was congested and fees were high. Later on in 2018 and 2019 the fees reduced and emergent need for such a solution disappeared. In 2019 there were several independent parties who implemented LN functionality on bitcoin ATM’s.
Next publicly known integration of LN functionality on bitcoin ATM was by Felix Weiss demonstrated during Lightning Hackday in Hong Kong in March 2019:
The integration was done using General Bytes BATM2 ATM model for demo purposes. In this case Felix had Lightning Network channel previously opened and had inbound capacity already, means he could accept LN payments. So this was fully LN only transaction.
After the initiation of purchase transaction, he deposits 20 HKD and transaction immediately arrives and displayed as received on phone wallet side. Obviously, this was demo purpose transaction and ATM itself showed it as error, which Felix explained was a bug.
Another Lightning Network ATM was demoed at Lightning Hackday in Munich in beginning of June 2019. Stepan Snigirev showed his Lightning ATM, which is not actually an ATM, but rather a candy machine, which dispenses candies when the LN payment is received. As candies were wrapped as Euro notes, let’s make it count for an ATM. The peculiarity of this machine is that it can operate in fully offline mode, as long as there is an online node that can receive and send payments. The following video shows the machine:
The company worked on improving software since then and in November they confirmed that Lightning Network support in their software is production ready. Lightning Network is also supported on POS terminals produced by General Bytes:
Finally, a developer from Portugal, who preferred to remain anonymous, behind 21senough twitter handle announced a dedicated ATM device, which solely operates on Lightning Network. This is a small self-made cardboard box ATM prototype, which allows to exchange fiat currency coins in exchange for LN BTC. The project can be found on Github.
The prototype accepts only coins and no banknotes and has a Raspberry Pi computer inside attached to camera, eInk screen and coin acceptor 616 (list of parts are provided in github repository).
The machine received a lot of positive feedback from community members, and was installed at a recent Baltic Honeybadger 2019 conference. Although the commercial viability of such a unit is questionable, while operators are profit seeking, and it is hard to earn on transactions done in pennies, but this machine is a good demonstration of how LN works, when you can put in a Nickel coin and receive 700 sats in exchange. Lamassu, one of the leading manufacturers, have met with the producer of this Lightning Network ATM:
So potentially LN can be supported with Lamassu software in the future. Other manufacturers are definitely also in play. Bitaccess, the fourth largest bitcoin ATM producer on the market, confirmed that they also will integrate Lightning Network on their machines, when the network capacity is sufficient.
Lightning Network is being integrated on bitcoin ATM’s. At the moment there is no known productive use cryptocurrency ATM with Lihtning Network support, but highly likely they will appear in the future, as the largest crypto ATM producer already has it in production software code. LN ATM has pros and cons compared to on-chain transaction based cryptocurrency ATM and will likely require more support from operators who first decide to add it on their networks. But adding LN support is inevitable way forward, especially in potentially returning high miners fees Bitcoin network state.