Core Lightning: Built From BOLT
CLN , previously c-lightning, has been in production use on the Bitcoin mainnet since early 2018. Written in the C programming language, which offers developers a high degree of control over the behavior of their code even at a low level, CLN has a focus on efficiency as well as on providing developers and users with a modular, plugin-based implementation of Bitcoinโs Layer 2 scaling protocol.
โWe aim to be a high-performance, enterprise-grade, spec-compliant implementation,โ Lightning developer at Blockstream, Rusty Russel, told Bitcoin Magazine . โThat traditionally means weโre more for high-end users, businesses and developers to build on top of.โ
CLN only works on Linux and MacOS, and requires a local or remote bitcoind version 0.16 or above that is fully caught up with the network that the user is running on and relays transactions from. Pruning is partially supported .
As a lightweight implementation, CLN enables a great level of customization as it allows the user to make it their own and add only the features they want or need. Developers can interface with the daemon through custom JSON-RPC methods, allowing them to efficiently customize functionality to their needs through plugins that can access low-level details directly.
CLNโs modularity, efficiency and code robustness come with their accompanying downsides, too. Christian Decker, a researcher at Blockstream focused on scaling solutions for Bitcoin, said during the London Bitcoin Devs meetup last month that, by adhering to the UNIX philosophy of doing one thing very well and not forcing decisions on the user, CLN comes in a โbare bonesโ fashion and requires some dedication from the user to get it working.
Notably, Blockstreamโs implementation focuses heavily on the specification process and generates a lot of its code out of the BOLT specifications directly, according to Russel. While this ensures a fully spec-compliant implementation, the team is left with less time to market its work and identifies this as the reason it sees less community engagement and node share than other implementations.
โWe are built from the Lightning BOLT specifications, literally!โ Russel told Bitcoin Magazine . โThis means we care a great deal (and, as a team, have put a huge amount of effort) into coordinating the architecture of the entire Lightning Network via the BOLT specifications.โ
The team usually proposes a new specification to the broader development community before adding it to CLN in an attempt to ensure long-term compatibility among different implementations while requesting more eyes to review, test and comment on its code before it is eventually turned into a new BOLT and becomes ready to be adopted by all implementations.
โPart of the reason we do the spec-and-review-across-implementations process is that it helps identify better ways of doing things โ find bugs, identify future problems,โ Lisa Neigut, Lightning protocol engineer at Blockstream, told Bitcoin Magazine .
Given its efficiency and lightweight footprint, CLN is likely the best-suited implementation for low-specification devices.
Blockstreamโs team also has developed a set of new features that extend BOLTsโ current functionality, which are often draft specifications or spec proposals, including collaborative channel openings, liquidity ads and BOLT 12. CLN gives the user the optionality to try out these upcoming specifications.
โWe rope off draft parts of the Lightning specification under experimental options,โ Russel told Bitcoin Magazine . โBut if youโre more adventurous, those experimental options give you an
insight into whatโs coming to the Lightning Network next!โ
Collaborative channel opens, previously called โdual funding channels,โ enable participants to collaboratively open a new channel by jointly funding the channel funding transaction . Currently, channels are open with a unilateral funding transaction by one participant. Collaborative channel opens also enable distributed CoinJoins into a Lightning channel open.
โYou can orchestrate your own CoinJoin with a bunch of other Lightning nodes,โ Neigut told Bitcoin Magazine . โYou do it decentralized so the only people that know about whoโs involved in that are the people that are actually part of that transaction, so thereโs no central coordinator that makes it happen.โ
Liquidity ads also leverage collaborative channel opens. According to a Blockstream blog post , โthey are a lightweight way of providing the ability to coordinate liquidity deployment across the network in a decentralized and accessible fashion.โ
The feature attempts to solve a common problem in Lightning: inbound liquidity.
Liquidity ads allow you to โsee all the people that are advertising that they will sell you inbound liquidity if you open a channel to them, which is really exciting stuff,โ Neigut said.
BOLT 12 is another draft specification for Lightning wallets and nodes with experimental support in CLN. The proposed feature, coined โoffers,โ would improve upon BOLT 11 invoices by enabling reusable offers, whereas a BOLT 11 invoice can only be used once. Furthermore, while an invoice is exclusively a payment request, you can use an offer to also send, not only receive, money.
CLN users can now also automate their node management tasks with CLBOSS , a recently-released โartificial intelligenceโ tool that can decide what nodes to open channels to, open channels when fees are low and there are on-chain funds, adjust routing fees to be competitive with other nodes, perform submarine swaps via the boltz.exchange API and automatically rebalance channels.
While different implementations should be encouraged to pursue standalone solutions to their specific use cases while abiding by the current BOLT 11 specifications, putting an accompanying spec proposal forward to help other implementations deploy the same โ or a similar โ feature is generally good practice, as such a move supposedly caters to the long term interests of Lightningโs broad and ever-growing user base. That being said, the spec process is not an easy task to endure.
โAs a process itโs arduous and takes a lot of time. It does require coordination with other people with lots of different perspectives,โ Neigut said.
As a result, different companies dedicate different amounts of time and effort to this process according to their individual priorities, which naturally differ. While, according to Russel, the CLN team has spent most of its โeffort on the specification and low-level implementation details and almost no effort on developer outreach or marketing,โ Lightning Labs, the company behind LND, has often chosen to focus more engineering resources on new features and solving customersโ pain points than on the arduous spec process.
LND: Gaps CLN Can Fill?
LND is a developer-first Lightning implementation that focuses on facilitating the development of applications on top of it, thereby placing strong emphasis on developer interaction, particularly in a standard approach to communication through REST APIs, which enable easier app development, in addition to providing clear documentation and an easy setup experience.
โWe want developers to be able to pick it up easily, integrate it into their product, build apps on top of it and distribute it as a wallet or a self-hosted node,โ LND Developer Oliver Gugger said at the London Bitcoin Devs meetup. โBringing it to the plebs.โ
As a result, LND focuses on โhaving a great developer interface,โ Gugger added, by enabling gRPC and REST.
โLND has a great community, easy setup and great developer documentation,โ Russel said when asked why he thought LND is the most popular Lightning implementation.
LND has seen the largest community involvement among all implementations and currently runs the majority of all network nodes. Some estimates put LNDโs share of total public Lightning nodes anywhere between 70% and 90%.
LND also boasts what is arguably the largest full-time development team. As a result, the team has managed to build a plethora of value-added services around LND, such as Aperture and the liquidity services Lightning Loop and Pool .
Loop uses submarine swaps to bridge on-chain and off-chain bitcoin, making it easy to move bitcoin into and out of the Lightning Network. It performs automated channel balancing, privacy-forward non-custodial swaps, fee-saving opportunistic transaction batching and progress monitoring of in-flight swaps.
Pool is a peer-to-peer marketplace for Lightning channels. It connects users who need access to inbound liquidity to those who have capital to deploy on the Lightning Network by enabling a Lightning Network participant to signal a need for it and incentivizing others to open channels with them using their capital.
With LNDโs focus typically on new features and customer support, the CLN team has found a gap in the marketplace it hopes to fill by paying closer attention to the specification process.
To Spec Or Not To Spec
โThe Labs team has come up with great stuff,โ Neigut said. โThey just, as an organization, havenโt been amazing about writing specs for the things that they add. A good example of that is KeySend.โ
KeySend allows a Lightning node to send someone a Lightning payment having only the receiving nodeโs ID, meaning the tool doesnโt require invoices, which are the current de-facto standard on Lightningโs payment mechanism.
โThey launched it, a lot of people started using it, but they never fully specified it,โ Neigut added. โSo CLN wanted to be able to support it. One of our team members had to go back through and figure out how to make it work just by reading their code and reverse engineering it.โ
A spec eventually got written by Spiralโs Lightning implementation, LDK, Neigut recalled, after its team reverse-engineered Lightning Labsโ code.
โAnd the other teams only really had to follow along because LND has such a large install base,โ she said. โThatโs not like the most collaborative process.โ
โThe team of people working on Lightning Labsโ stuff is pretty solid,โ Neigut added. โI just think theyโre kind of taking advantage of their network dominance to not have to do all this extra work because if they donโt do it, someone else will because the majority of the nodes on the network run their code.โ
Neigut said she is already used to LND being in the spotlight and being the โdefault Lightningโ implementation โ something she confesses that she enjoys as a dev because of the fewer customer support demands she receives.
โBut I think that weโd get a healthier network dynamic if there was no majority implementation,โ she added. โI think that would really kind of change the game in terms of the amount of collaboration everyone has to do to get their stuff shipped on Lightning. And that would be healthy.โ
Careful attention to specifications is arguably central to open-source development in an open network environment. On Lightning, such specs form the foundation of the protocol and ensure the interoperability of the different versions participating in the network.
However, while some argue major changes and new additions to one Lightning implementation should have an accompanying specification, others might see the BOLT specs as a bare minimum on top of which each implementation can build their own exciting new features โ which would not necessarily need to be ported back to the spec suite.
โItโs hard creating an open-source infrastructure company, so itโs not surprising that I donโt agree with all [Lightning Labsโ] priorities,โ Russel said. โI genuinely believe they will find a way of both creating a sustainable income stream and being a reliable partner in the technical development of the Lightning Network; I donโt think anyone wants to see the network split into pieces.โ
Disregarding the spec process completely could lead to the emergence of widely different sub-ecosystems, which could hurt the development and adoption of the Lightning Network as a whole if they were to become non-interoperable. But as Russel highlighted, there is no indication that any implementation is doing that today. Maintaining a cohesive, interoperable interaction between nodes is key if we want to keep implementation details abstracted away from the user and thereby enable a good user experience.
โIf [Lightning Labs] were the lead and they were also leading the way in specs, I think that there would be a little less friction around adding new features, because it wouldnโt be as difficult to follow what theyโre doing,โ Neigut said. โMaybe theyโll be more involved in the spec process going forward. I think theyโve definitely been getting feedback from us and the rest of the community that the spec process is important.โ
Part of the controversy and tensions in the BOLT spec process stem from an email shared on Twitter in late February, in which the head of Lightning liquidity at Lightning Labs, Alex Bosworth, commented on BOLT 12 and the BOLT spec process.
Bosworth wrote that the BOLT process is an arbitrary standardization process that doesnโt require peopleโs consent and therefore represents โmore of an opinionated set of documents controlled by an arbitrary process than it is a treaty between independent implementations.โ
Lightning Labs later clarified that Bosworthโs comments reflect only his opinion and not necessarily those of the company.
Bosworth arguably hinted at dismissing compliance with the spec process whenever it conflicts with what he calls โcurrent problemsโ in Lightning, as such standards might not be used by the majority of the network and therefore shouldnโt warrant much development effort, whereas those problems could represent pain points of the majority of users and should therefore be prioritized. Image source .
Decker shared his thoughts on Bosworthโs comments and on the BOLT spec process during the London Bitcoin Devs meetup.
โI think those are very strong statements from someone who has never participated in a single spec meeting,โ he said. โThere is a bit of contention in the spec process but that is by design. If one implementation were able to dictate what the entire network looks like, we would end up with a very myopic view of what the network could be and we wouldnโt be able to serve all of the different use cases that we are serving.โ
โAnd so yes, sometimes the spec process is frustrating, I totally agree with that,โ he added. โWe certainly have different views on what the network should look like. But by this thesis, antithesis and synthesis process we come up with a system that is much more able to serve our users than if one implementation were to do it alone.โ
โI personally donโt work on the spec so I donโt feel qualified to give an answer,โ Gugger said at the meetup, commenting on Bosworthโs email. โI just wanted to add that I donโt necessarily agree with all the points that Alex mentioned. I definitely would have said it in a different way as well. I think lack of resources to work on the spec sometimes is interpreted as us blocking stuff which is not the intention and not our goal of course. We want to put in more work on the spec so I hope we will improve there. It is an interesting thing to observe, how that frustration sometimes comes to the surface. Thank you [Decker and ACINQ Developer Bastien Teinturier] for all the work you do on the spec. I need to pick up as well so Iโll do my best.โ
Russel also commented on Bosworthโs email in a Twitter thread where he pledged to spend more time on polishing and marketing CLN, as he said that LND didnโt implement Lightning first and didnโt implement it best โ though its community is great, he added.
โTurns out theyโve decided they can leverage network dominance into protocol control, and the spec process isnโt โreal,โโ he wrote in the thread. โLightning Labs has claimed ownership of the Lightning network in many ways: Iโve been reluctant to call them out in public. But the lightning network and community deserves better.โ
Russel did not respond to questions from Bitcoin Magazine referring to this thread. Lightning Labs declined to comment.
โBack in 2016 we came from three different directions and decided to join all of the things that we learned during this initial experimentation phase into a single specification so that we could collaborate and interoperate,โ Decker said at the meetup. โThis experimental phase must always be followed up by a proposal that is introspectable by everybody else and can be implemented by everybody else. Sometimes that formal proposal is missing and that prevents the other implementations giving their own review on that feature. This review is very important to make sure it works for everybody and that it is the best we can make it.โ
โLike the name Lightning Network suggests, it very much profits from the network effects we get by being compatible, by being able to interoperate and enabling all implementations to play on a level playing field,โ he later added.
Implementations Complement Each Other, They Donโt Compete
Besides that very specific controversy regarding the specification process, Lightning implementations mostly work separately and then together to bring the best and most demanded features to the network, ensuring an overall better user experience.
As a result, Blockstreamโs move to push CLN as a spec-compliant, modular and lightweight offering comes as an alternative for those interested in running a node implementation that strives to be completely interoperable with the rest of the network and provides a unique set of benefits to those who do.
As different implementations strive to become their best version and cater to a specific use case by exploring their own value proposition, the user is ultimately the one to benefit as greater and better options emerge.