How to Send A Lightning Transaction (Even If You May Not Want To)

It’s like the early days of bitcoin all over again.

Comprised of invite-only chat channels, alien terminology and warning signs at every turn, the nascent ecosystem springing up around Lightning Network, the scaling technology that could end up having the greatest impact yet on bitcoin’s capacity, is to date, hopelessly difficult to operate.

“Going to be blunt,” one developer wrote, “if you don’t know how to compile something, you probably will have a lot more struggles and a lot less coins.”

Simply put, Lightning in its current state is dangerous to interact with today. But given the network’s big promises – instant transactions and fees that are next to nothing – risk isn’t diminishing the appeal.

Companies like Blockstream are already launching Lightning-powered stores that send stickers to bitcoin users who successfully pass funds across the network, while so-called “early Lightning adopters” are being celebrated online for their “bravery” on the blockchain.

“Show the world that you were one the first people to use Lightning on mainnet for a legitimate purchase, if it works,” Blockstream’s website reads.

It’s a sentiment that, given the risks, has garnered criticism by some who feel it mistakenly encourages users to risk real money. That said, there are ways to contribute to the early network without putting your own funds at risk.

This includes hanging out in the testing environment (where the majority of Lightning developers are today) or venturing onto the mainnet (where there’s a budding set of best practices, even if pitfalls remain).

Below, we offer our guide for early adopters who want to get their hands on the bleeding-edge tech before it’s recommended.

Testnet trials

Of the available options, connecting to the testnet isn’t exactly intuitive, but it’s easier to access than the alternative, with clients that are built to run on most operating systems.

It also has the added benefit of not requiring the use of real bitcoin. Instead, you’ll be using test bitcoin, which you can find for free at an online faucet and send to your Lightning wallet.

In total, using the testnet takes about five or so steps to navigate:

  1. To start, there’s a number of wallets that you can download, Zap, Lightning Labs for desktop, an Eclair wallet for android, and one option that doesn’t require a download at all. If you chose to download a desktop wallet, remember that it will need to sync the bitcoin testnet, which can take several hours.
  2. Having sent the test bitcoin to a wallet address of your choice, you’ll need to set up a channel, which is where testing gets slightly unfamiliar. Select a testnet store that you’d like to make a purchase on. There’s a variety of these, including a blogging site named yalls, developed by Lightning Lab’s Alex Bosworth, a Starbucks-inspired cafe run by Lightning development team ECLAIR and an ice cream parlor.
  3. Next, navigate to the website of your choice and seek out a payment address. Notice that two addresses are given, a payment address and a “peer address.” (You need to add the store as a peer before you can send it payment.)
  4. Copy the peer address, navigate to your wallet and add the address as a contact. You’ll need to send a small fee in order to open this channel, which on the testnet is something like 0.1 test bitcoin.
  5. Once you’ve successfully opened a channel, you can then paste the payment address in to your wallet along with the desired amount, and send your test bitcoin (instantly).

Using the above process, CoinDesk was able to send a transaction, only running into trouble at times when a majority of test nodes were offline.

Risking it on the mainnet

To restate, this is ill-advised – if you try to send bitcoin, you can lose it.

Not only will this hurt your wallet, but it will upset Lightning’s developers, because the more people active on the mainnet the more complicated it becomes to administer updates.

While a bit more complicated (the process described below can take a few days), the seven steps below approximate a rough guide to getting started:

  1. The easiest way to access the mainnet is using Blockstream’s c-lightning. Blockstream have published a useful guide that breaks down the various command lines necessary to purchase a sticker in their store, and for a more detailed breakdown of the following steps, visit their website. Other development teams, Lightning Labs and ECLAIR, have yet to publish mainnet clients, however, developers have assured that it is still possible with a little tweaking to the code.
  2. C-lightning requires ubuntu operating system and a variety of code toolkits that will need to be downloaded before you can begin. Lightning also requires you to sync the bitcoin blockchain in its entirety, a process which can take several days, and needs about 170 gigabytes in storage.
  3. Once those steps are out of the way, install the necessary tools, as listed on Blockstream’s breakdown.
  4. Next, download bitcoind, a bitcoin full node software that’s perhaps the easiest to download – bitcoin.org offers a list of steps in order to do this securely. Remember that it takes a really long time to sync the bitcoin blockchain, so leave it syncing overnight – though depending on your connection it could a number of days.
  5. Once you’re happily synced up with the chain, you’re then ready to clone the c-lightning code from its GitHub repository. Once that’s successfully installed, you can use the command line to connect to Blockstream’s peer and sync the channel graph. You’ll also need some bitcoin to work with, so use lightning-cli, the internal lightning client, to generate a bitcoin address that you can send some funds to from your normal wallet.
  6. Once you’ve done this (and confirmed that the payment occurred successfully), you can then open a payment channel with Blockstream’s peer. First, use the command line to locate Blockstream’s public key to open the channel. Just like on testnet, this will require a small fee, around 500 satoshis.You’ll then need to confirm the transaction has gone ahead by monitoring the logs. Wait for three in total to occur before you can open a channel.
  7. Once the three confirmations have passed, you can use lightning-cli to list a new payment channel, which you can then you to make payments to the Blockstream store.

Next steps

If the laundry list of actions above shocks you, that’s okay, developers are working on methods to make the network easier to interact with. Remember, Lightning is still in alpha phase, and as development progresses, a wide variety of simplified interfaces are expected to be released.

Easy to use wallets are also likely to be released for mainnet access, so there will be less of a requirement for lightning users to be familiar with the command line. Similarly, other interfaces that make the micropayments easier to integrate by providing a third-party processing service.

Eclair have released an early version of their lightning API. Rather than businesses opening their own channels, Eclair will handle the back-end, process payments and send on-chain bitcoin.

Developers such as Alex Bosworth are also working on ways for users to send Lightning payments without setting up a channel at al, by creating methods for bitcoin and other cryptocurrencies to interact with the Lightning network.

Ultimately, while the network is now difficult and dangerous for the average user, ongoing development work hints that soon, Lightning could be as simple to use as existing payment interfaces.

Disclosure: CoinDesk is a subsidiary of Digital Currency Group, which has an ownership stake in Blockstream and Lightning Labs.

Welding sparks via Shutterstock

The leader in blockchain news, CoinDesk is an independent media outlet that strives for the highest journalistic standards and abides by a strict set of editorial policies. Interested in offering your expertise or insights to our reporting? Contact us at news@coindesk.com.

Source