Lightning (Layer 2)
Lightning (Layer 2)
- Lightning was a 2016 proposal by Poon and Dryja,poon2016bitcoin and is a method for networks of channels of Bitcoin between parties, whichcan transfer value. The main public network is a community drivenliquidity pool which enables scaling and speed improvements for theBitcoin network. It makes Bitcoin more likemoney.divakaruni2022lightning As with Bitcoin base chain there aremultiple standards and approaches, but within Lightning these are notnecessarily cross compatible with one another, resulting in severalLightning networks. This is to our advantage as innovation is possiblewithin these smaller networks. It is mainly ‘powered’ by thousands ofvolunteers who invest in hardwareand lock up their Bitcoin in their nodes, to facilitate peer-to-peertransactions. Zebka et al. found that although the network is “fairlydecentralised” it is more recently skewing to larger more establishednodes.zabka2022short Though this is a grassroots technology thenature of the design means it can likely be trusted for small scalecommercial applications.
- The following text is from JohnCantrell, an engineerwho works on Lightning.
- “The Lightning Network is a p2p network of payment channels. A paymentchannel is a contract between two people where they commit funds using asingle onchain tx. Once the funds are committed they can make anunlimited amount of instant & free payments over the channel. You canthink of it as a tab where each person tracks how much money they areowed. Each time a payment is made over the channel both parties updatetheir record of how much money each person has. These updates all happenoff-chain and only the parties involved know about them. When it‘s timeto settle up the two parties can take the final balances of the channeland create a channel closing transaction that will be broadcast onchain. This closing transaction sends each party the final amounts theyare owed. This means for the cost of two on-chain transactions (theopening and closing of the channel) two parties can transact anunlimited number of times and the overall cost of each transactionapproaches zero with every additional transaction they make over thechannel. Payment channels are a great solution for two parties totransact quickly and cheaply but what if we want to be able to sendmoney to anyone in the world quickly and cheaply? This is where theLightning Network comes into play, it‘s a p2p network of these paymentchannels. This means if Alice has a payment channel with Bob and Bob hasa channel with Charlie that Alice can send a payment to Charlie withBob‘s help. This idea can be extended such that you can route a paymentover an arbitrary number of channels until you can reach the entireworld. Routing a payment over multiple channels uses a specific contractcalled a Hash Time Locked Contract (HTLC). It introduces the ability forBob and any other nodes you route through to charge a small fee. Thesefees are typically orders of magnitude smaller than onchain fees. Thisall sounds great but what if someone tries to cheat? I thought the wholepoint of Bitcoin was that we no longer had to trust anyone and it suresounds like there must be some trust in our channel partners to use theLightning Network? The contracts used in Lightning are built to preventfraud while requiring no trust. There is a built-in penalty mechanismwhere if someone tries to cheat and is caught then they lose all oftheir money. This does mean you need to be monitoring the chain forfraud attempts.’’
- Lightning is a key scaling innovation in the bitcoin network at thistime. It is seeing rapid development and adoption (Figure3.14).The popular payment app “Cash App” integrates the technology allowinglightning interactions for their 40M users, and ‘Lightning Strike’services the USA, El Salvador, large parts ofAfrica,and Argentina with zero exchange and transmission fees.

Arcane research lightning adoption overview.
- It allows for unbound scaling of transactions (millions of transationsper second compared for instance to around 45,000 TPS in the VISAsettlement network). Transaction costs are incredibly low, and thetransaction speed virtually instantaneous.
- The most popular lightning software isLND from LightningLabs or C-Lightning fromBlockstream. The software can be run on top of any Bitcoin full node, ina browser extension with a limited node, in a mobile app as a client ora server, or a hybrid such as the Greenlight server used by Breezwallet.Different trust implications flow from these choices.
Lightning service providers
- The model of the ‘LSP’ has been refined since it’s first introduction byBreez in2019.At their core they provide the following services, at some expense tothe concept of decentalisation of the network.
-
- Payment Channel Management: LSPs may offer users the ability to open and close payment channels on the Lightning Network, as well as manage the routing of payments through these channels.
-
- Liquidity Provision: LSPs may provide liquidity to users on the Lightning Network, allowing them to make and receive payments even when they do not have sufficient funds in their own payment channels.
-
- Node Hosting: LSPs may host Lightning Network nodes on behalf of users, providing them with access to the network without requiring them to maintain their own node.
-
- Payment Processing: LSPs may offer payment processing services, allowing merchants to accept Lightning Network payments from customers.
-
- Wallet Integration: LSPs may integrate Lightning Network functionality into Bitcoin wallets, making it easier for users to access the network and make payments.
- There are multiple companies experimenting this space now, and it’sunclear how useful the ideas are for our use cases at this time. It’snotable that pubky (mentioned later as a potential for digitalassets) are themselves an LSP, and that breez have now introduced aprofit sharingmodelto assist the adoption.
Micropayments
- Possibly the most important affordance of the Lightning network is theconcept of micropayments, and streaming micropayments. It is very simpleto transfer even one satoshi on Lightning,which is one hundred millionth of a bitcoin, and a small fraction of apenny. This can be a single payment, for a very small goods or service,or a recurring payment on any cadence. This enables streaming paymentsfor any service, or for remittance, or remuneration. These use caseslikely have enormous consequences which are just beginning to beexplored. Nostr users are seemingly have an enormous amount of funsending one another tiny amounts of money for free, in response to goodposts on the new social media and blog platforms designed around theprotocol. This can be seen in Figure3.15and nostr will be described in more detail later. Integration of thiscapability into metaverse applications will be explored later.
- ![]./assets/nostrzaps.png
- Within weeks of launch thousands of people are pinging micropayments to one another
BOLT12 and recurring payments
- BOLT12 is a new and developing ’standard’ whichsimplifies and extends the capability of the network for recurringpayments, but can negotiate single payments too. The example keyring QRcode seen in Figure3.16can be scanned to send single or recurring payments securely andanonymously to the holder. ![]./assets/bolt12keyring.jpg A key fob with a Bolt12 QR code
Cashu and Fedimint
Cashu
- Cashu , an implementation of the e-cash mechanism, is an electronic cashsystem that allows users to hold and transfer digital representations ofmoney on their devices. In this system, e-cash is a piece of electronicdata that represents a certain amount of money, such as satoshis in thecase of Bitcoin. Users can send e-cash to others through variousencrypted channels like Telegram or email.
- The concept of e-cash relies on blind signatures, which ensure thattransactions cannot be correlated to specific users, providing a highlevel of privacy. When a user wants to send e-cash, they send the datarepresenting the money to another user. The receiving user then sendsthe e-cash to a server (or mint) to be recycled. This process ensuresthat the e-cash cannot be double-spent. However, the server cannotcorrelate the incoming e-cash to any specific user or transaction.
- Cashu, as a protocol, enables the implementation of this e-cashmechanism and facilitates interoperability among different Cashuwallets. The system is designed to be private, with no user accounts orwallets associated with any central authority. The e-cash is stored inthe user’s browser data, and can be backed up using a seed phrase,similar to traditional cryptocurrency wallets.
- In its current state, Cashu is in its early stages of development and isprimarily intended for experimentation. However, it has the potential toenable a wide range of applications, such as streaming services, whereusers could pay for content on a per-use basis without the need for anaccount, and without the service provider being able to track theirusage. This would allow for greater privacy and flexibility in howpeople interact with online services.
Fedimint
- From the blogposton the Fedi App website; Fedimint is:
-
- a form of community Bitcoin custody,
-
- utilising federations (a byzantine fault tolerant multi-sig wallet technology similar to Blockstream’s Liquid network),
-
- run collectively by groups of trusted community members we call “guardians”,
-
- for and on behalf of their communities,
-
- with privacy through Chaumian e-cash,
-
- and with close integration with the Lightning Network
-
- Obi Nwosu sees Fedimint as the third vital pillar of the Bitcoinecosystem. If Bitcoin is secure decentralised money, and Lightning isdecentralised payments, then he says Fedimint is decentralisedcustodyof the Bitcoin asset. The excitement in the community is such that thisprotocol is included in our metaverse stack later. With Fediment a cladeof users within the metaverse would have near perfect transactionalprivacy within their group inside the metaverse.chaum1985securityThis could be a potentially huge group of users, and could include AIactors in the scene. Transactions with the outside world could bethrough lightning as already planned.
LNBits
- LNBits is an open source, extensible, Lightning ‘source’ managementsuite. It is self hosted, and can connect to a variety of Lightningwallets, further abstracting the liquidity to provide additionalfunctionality to network users. Remember that all of these tools runwithout a third party, on a £200 setup, hosted at home or within abusiness. The best way to explore this is to describe itsome of theplugins.
-
- “Accounts System; Create multiple accounts/wallets. Run for yourself, friends/family, or the whole world!”
-
- Events plugin allows QR code tickets to be created for an event, and for payments to be taken for the tickets.
-
- Jukebox creates a Spotify based jukebox which can be deployed online or in physical locations.
-
- Livestream provides an interface for online live DJ sets to receive real-time Lightning tips, which can be split automatically in real-time with the music producer.
-
- TPoS, LNURLPoS & OfflineShop support online and offline point of sale (Figure 3.17).
-
- Paywall creates web access control for content.
-
- LightningTipBot is a custodial Lightning wallet and tip handling bot within the popular on Telegram instant messenger service.
-
Two of the many prebuilt andkit options for Lightning ‘pointof sale’
- Together these plugins are incredibly useful primitives which are likelyto be translatable to a multi party collaborative mixed realityapplication. A proposal for building a more specific plugin along theselines is detailed later.
- bfLnBits is capable of backing every object in a metaverse scene as aneconomic actor, with a key which is compatible with Nostr. This makes itthe best choice and it will likely form the core of the proposedmetaverse stack.
Daric
- Lightning isn’t the only solution to layer 2, as evidenced byDaric.mirzaei2022daric This is a complex and technical proposal whichclaims to improve upon Lightning.
Ark
- Ark is a privacy-focused off-chain protocol for bitcoin transactions.Here’s how it compares to existing systems:
- Ark vs. Chaumian eCash: Both ensure transaction anonymity, but unlikeeCash, Ark’s transactions are backed by real bitcoins, making themimmune to theft or inflation by the service providers.
- Ark vs. Lightning: Similar to the Lightning network, Ark is a liquiditynetwork but without liquidity constraints or direct link between senderand receiver. It uses significantly less on-chain footprint as it lacksconcepts of opening and closing channels.
- Ark vs. On-chain: Ark is similar to on-chain wallets in terms of UX,receiving payments asynchronously without introducing liquidityconstraints. However, users must “refresh” their coins regularly toavoid service providers sweeping the funds.
- Ark vs. Validity Rollups: Ark doesn’t require on-chain data pertransaction, providing higher throughput. Both need a soft-fork on thebase layer, but Ark doesn’t need a soft-fork for the interactiveversion.
- Ark service providers can, in theory, double-spend their transactions inmempool. However, it’s counterproductive as recipients can use incomingzero-conf vtxos to pay lightning invoices. If a double-spend occurs, afuture Ark extension can allow users to claim their previously redeemedvtxos. This provides an inbound liquidity-like tradeoff without protocolcompromise.
Liquid federation (layer 2)
- Liquid is an implementation on BlockstreamElements, and is itself part of the opensource development contribution of Blockstream, the company started byAdam Back (of hashcash fame) and nearly a dozen other early cypherpunksand luminaries.
- The Liquid side chain network, and it’s own attendant Lightning layer 2,is a fork of Bitcoin with different network parameters. In liquid theuser of the network ‘pegs’ into the Bitcoin network, swapping tokens outfrom BTC to L-BTC (this can of course mean very small subunits of 1Bitcoin). Once tokens have been ‘locked’ and swapped to Liquid thedifferent network parameters used in the fork allow a differenttrust/performance trade-off. Liquid is fast on the L1 chain, cheaper touse at this time, and more private. The consensus achieved on this sidechain network is faster because it is a far smaller group of nodeoperators. The next block to be written to the side chain is chosen by anode operated by a member of a federation of dozens of majorcontributors to the Bitcoin technology space. These ‘trusted’ nodes allcheck one another’s security and network operations, meaning that thenetwork is as secure as the aggregate of the trust placed in half of themembership at any one time. There are stilldozensof major companies, development teams, and individual actors, withsignificant reputational investment.
- “Federation members contribute to the Liquid Network’s security, gainvoting rights in the board election and membership process, and providevaluable input on the development of new features. Members also benefitfrom the ability to perform a peg-out without a third party, allowingtheir users to convert between L-BTC and BTC seamlessly within theirplatform.”
- Crucially for our purposes here Liquid allows tokenised asset transfer.Anyone canissuean asset on Liquid. Such transfers of assets may be orders of magnitudecheaper than on chain Bitcoin transactions, but still potentially ordersof magnitude more expensive than a simple Lightning transaction of valueon the Bitcoin network.
- Blockstream plan to add arbitrary (user generated) token support totheir ‘Core Lightning’ implementation at some point. This would be avery strong choice for specific use cases within an economically enabledmetaverse application. When participants wish to ‘cash out’ of theLiquid network they must do this through one of the federation memberswho activate the other side of the ‘two-way peg’, dispensing theequivalent amount of Bitcoin. This is transparently handled throughBlockstream’s “green wallet”.
- All of this has the advantage of a far lower energy footprint comparedto the main chain, but it’s not quite ready with a full suite ofaffordances.
- The Liquid network is being used as the underlying asset for a novel newglobal financial product. El Salvador are working with Blockstream toissue a nation state backed bond.
- Soft-Fork/Covenant Dependent Layer 2 Review (petertodd.org)