# Harnessing Lightning For Instant Bitcoin Transacting — A Tutorial

Source URL: https://blog.blockstream.com/en-lightning-instant-bitcoin-transacting-tutorial
Updated: 2026-11-16T19:30:36.000Z
Author: Grubles
Published: Feb 2, 2018
Category: Lightning Network

---

This is a guest post by fellow Lightning enthusiast, [@notgrubles](https://twitter.com/notgrubles), and was originally posted on [his blog](https://medium.com/@notgrubles/harnessing-lightning-for-instant-bitcoin-transacting-a-tutorial-3b9dcdc00552).

**Update: I received some much appreciated feedback from the community to highlight this important message more prominently in the post:**

**_Before you begin, be mindful that this software is experimental and could contain bugs that result in lost funds. Only use small amounts of bitcoin that you can afford to lose._**

## A Quick Text and Video Tutorial

Bitcoin is a decentralized peer-to-peer payment network used all around the planet to transact trustlessly. The system enables trustless transactions by requiring miners to include transactions in blocks, which are linked to each other cryptographically. However, this means that transaction confirmations take time, and not everyone has the luxury of time. The answer to this inconvenience is payment channels, which Satoshi Nakamoto described as a way to enable “high-frequency transactions” between channel partners, as opposed to waiting roughly 10 minutes for a confirmation. Lightning takes this idea and [deploys it on a large scale](https://blog.blockstream.com/en-lightning-on-litecoin). Instead of only being able to pay your channel partner, you can [instantly pay](https://blog.blockstream.com/en-lightning-spec-electrifies-bitcoin-with-release-candidate) anyone on the Lightning Network, which is a network of payment channels.

Recently, Blockstream released an [e-commerce shopping page](https://blog.blockstream.com/en-lightning-charge) called Blockstream Store, which uses their newly released Wordpress e-commerce plugin built using Lightning Charge. The most exciting part is that you can only purchase things on the [Blockstream Store](https://store.blockstream.com/) with a Lightning Network payment on Bitcoin’s mainnet. This is a tutorial on how to setup your own Lightning node to purchase items or to receive Lightning payments using `c-lightning`, Blockstream’s Lightning implementation.

### Requisites

- Linux (Ubuntu 17.10 is used for this guide)
- Ample storage for Bitcoin’s blockchain
- Basic to intermediate command line knowledge
- A fully synced Bitcoin node with SegWit
- Some bitcoin

## Step 0: Installing Build Tools And Dependencies

Our first step is to install, via `apt`, the tools we need:

`sudo apt-get install -y autoconf automake build-essential git libtool libgmp-dev libsqlite3-dev python python3 net-tools tmux`

## Step 1: Installing bitcoind From The Bitcoin PPA

Either build `bitcoind` from source, download and verify the binary from [bitcoin.org](https://bitcoin.org/) (preferred method), or install from the Bitcoin PPA:

`sudo apt-get install software-properties-common sudo add-apt-repository ppa:bitcoin/bitcoin sudo apt-get update sudo apt-get install -y bitcoind`

## Step 2: Cloning The lightningd Repository And Building

Now grab the c-lightning code and then build it:

`mkdir builds && cd builds git clone https://github.com/ElementsProject/lightning.git cd lightning make`

_Use `make -jn` to speed up compilation. `n` being the number of threads dedicated to building. Example: `make -j10` for a processor with 10 or more threads (like a Xeon)._

## Step 3: Running bitcoind, lightningd, And lightning-cli To Confirm Correct Installation

Start `bitcoind`, then `lightningd`, then `lightning-cli` to confirm everything is installed correctly:

_Make this process cleaner by using tmux to keep everything neat and tidy in one terminal:_

`tmux`

Start `bitcoind`, and watch its startup from the log, then test it with `bitcoin-cli`:

`bitcoind tail -f ~/.bitcoin/debug.log bitcoin-cli getinfo`

Similarly, start `lightningd` and test it with `lightning-cli`:

`./lightningd/lightningd --network bitcoin --log-level debug ./cli/lightning-cli help`

## Step 4: Connecting To A Remote Lightning Peer

After `lightningd` and `lightning-cli` successfully build, connect to a peer and sync the channel graph. The peer used is Blockstream’s:

`/cli/lightning-cli connect 02f6725f9c1c40333b67faea92fd211c183050f28df32cac3f9d69685fe9665432 104.198.32.198 9735`

The graph syncs automatically (`lightningd` log output) :

## Step 5: Creating An Address To Fund In Order To Open A Channel

Opening a Lightning payment channel requires a funded UTXO. Generate a Bitcoin address with `lightning-cli` to send some bitcoin to.

`./cli/lightning-cli newaddr`

Send some bitcoin to that address, _but be mindful that this is experimental software_.

## Step 6: Confirming We Have Received The BTC

Use `lightning-cli` to check if our address is funded:

`./cli/lightning-cli listfunds`

## Step 7: Opening A Channel With The Peer We Connected To Earlier

To open a payment channel, find the node’s pubkey or id (in this case, Blockstream’s) and then use `lightning-cli` to initiate opening the channel:

_To print the peer’s node id:_

`./cli/lightning-cli listpeers`

_Copy that id and fund the channel with some number of satoshis:_

`./cli/lightning-cli fundchannel 02f6725f9c1c40333b67faea92fd211c183050f28df32cac3f9d69685fe9665432 amount_in_satoshis`

## Step 8: Monitoring lightningd Logs For Funding Transaction Confirmations

Optionally, switch back to the `lightningd` window with `tmux` to watch for your funding transaction to be confirmed:

## Step 9: Confirming We Have Opened A Channel

Three confirmations are required for opening a channel. Once the funding transaction has three confirms, use `lightning-cli` to list our new payment channel.

`./cli/lightning-cli listchannels | grep your_nodes_pubkey`

## Congrats! You’ve Opened Up Your First Lightning Network Payment Channel!

You can now invoice others to receive instant payments, or you can pay an invoice that someone has sent you!

`./cli/lightning-cli invoice amount_in_millisatoshis label description`

or

`./cli/lightning-cli pay bolt11_string`

c-lightning’s install documentation can be found [here](https://github.com/ElementsProject/lightning) and [here](https://github.com/ElementsProject/lightning/blob/master/doc/INSTALL.md).

Thanks for reading!

– grubles

## Blog Categories

- [All Posts](https://blog.blockstream.com/)
- [Blockstream Finance](https://blog.blockstream.com/blockstream-finance)
- [Company](https://blog.blockstream.com/company)
- [Lightning Network](https://blog.blockstream.com/lightning-network)
- [Blockstream Explorer](https://blog.blockstream.com/blockstream-explorer)
- [Blockstream Satellite](https://blog.blockstream.com/blockstream-satellite)
- [Liquid Network](https://blog.blockstream.com/liquid-network)
- [Blockstream Jade](https://blog.blockstream.com/blockstream-jade)
- [Blockstream AMP](https://blog.blockstream.com/blockstream-amp)
- [Blockstream App](https://blog.blockstream.com/blockstream-app)
- [Blockstream Research](https://blog.blockstream.com/blockstream-research)
- [Cryptocurrency Data Feed](https://blog.blockstream.com/cryptocurrency-data-feed)
- [Elements](https://blog.blockstream.com/elements)
- [Layer-2 Report](https://blog.blockstream.com/layer-2-report)
- [Simplicity Language](https://blog.blockstream.com/simplicity-language)
- [Quarterly Update](https://blog.blockstream.com/quarterly-update)
- [Quantum](https://blog.blockstream.com/quantum)
- [Enterprise](https://blog.blockstream.com/enterprise)
- [Insights](https://blog.blockstream.com/insights)
- [Developer](https://blog.blockstream.com/developer)
- [Security](https://blog.blockstream.com/security)
- [Core Lightning](https://blog.blockstream.com/core-lightning)
