You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 01_0_Introduction.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ The ways that we make payments for goods and services has been changing dramatic
6
6
7
7
These centralization risks were some of the prime catalysts behind the creation of cryptocurrencies, the first and most successful of which is Bitcoin. Bitcoin offers pseudonymity; it makes it difficult to correlate transactions; and it makes censorship by individual entities all but impossible. These advantages have made it one of the quickest growing currencies in the world. That growth in turn has made Bitcoin into a going concern among entrepreneurs and developers, eager to create new services for the Bitcoin community.
8
8
9
-
If you're one of those entrepreneurs or developers, then this course is for you, because it's all about learning to program Bitcoin. It's an introductory course that explains all the nuances and features of Bitcoin as it goes. It also takes a very specific tack, by offering lessons in how to work _directly_ with Bitcoin Core and with the c-lightning server using their RPC interfaces.
9
+
If you're one of those entrepreneurs or developers, then this course is for you, because it's all about learning to program Bitcoin. It's an introductory course that explains all the nuances and features of Bitcoin as it goes. It also takes a very specific tack, by offering lessons in how to work _directly_ with Bitcoin Core and with the core lightning server using their RPC interfaces.
10
10
11
11
Why not use some of the more fully featured libraries found in various programming languages? Why not create your own from scratch? It's because working with cryptocurrency is dangerous. There are no safety nets. If you accidentally overpay your fees or lose a signing key or create an invalid transaction or make any number of potential mistakes, then your cryptocurrency will be gone forever. Much of that responsibility will, of course, lie with you as a cryptocurrency programmer, but it can be minimized by working with the most robust, secure, and safe cryptocurrency interfaces around, the ones created by the cryptocurrency programming teams themselves: ``bitcoind`` and ``lightningd``.
Copy file name to clipboardExpand all lines: 01_1_Introducing_Bitcoin.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -123,7 +123,7 @@ Lightning is a layer-2 protocol that interacts with Bitcoin to allow users to ex
123
123
124
124
Lightning is also the secondary focus of this tutorial. Though it's mostly about interacting directly with Bitcoin (and the `bitcoind`), it pays some attention to Lightning because it's an upcoming technology that is likely to become a popular alternative to Bitcoin in the near future. This book takes the same approach to Lightning as to Bitcoin: it teaches how to interact directly with a trusted Lightning daemon from the command line.
125
125
126
-
Unlike with Bitcoin, there are actually several variants of Lightning. This tutorial uses the standard-compliant [c-lightning](https://github.com/ElementsProject/lightning) implementation as its trusted Lightning server.
126
+
Unlike with Bitcoin, there are actually several variants of Lightning. This tutorial uses the standard-compliant [core lightning](https://github.com/ElementsProject/lightning) implementation as its trusted Lightning server.
127
127
128
128
**_What is a Layer-2 Protocol?_** A layer-2 Bitcoin protocol works on top of Bitcoin. In this case, Lightning works atop Bitcoin, interacting with it through smart contracts.
Copy file name to clipboardExpand all lines: 19_0_Understanding_Your_Lightning_Setup.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,13 +2,13 @@
2
2
3
3
> :information_source:**NOTE:** This is a draft in progress, so that I can get some feedback from early reviewers. It is not yet ready for learning.
4
4
5
-
The previous chapter concluded our work with Bitcoin proper, through CLI, scripting, and programming languages. However, there are many other utilities within the Bitcoin ecosystem: this chapter and the next cover what may be the biggest and most important: the Lightning Network. Here you'll begin work with the `lightning-cli` command-line interface, understanding a c-lightning setup and its features, including some examples and basic configuration.
5
+
The previous chapter concluded our work with Bitcoin proper, through CLI, scripting, and programming languages. However, there are many other utilities within the Bitcoin ecosystem: this chapter and the next cover what may be the biggest and most important: the Lightning Network. Here you'll begin work with the `lightning-cli` command-line interface, understanding a core lightning setup and its features, including some examples and basic configuration.
6
6
7
7
## Objectives for This Chapter
8
8
9
9
After working through this chapter, a developer will be able to:
10
10
11
-
* Assess that a c-lightning Node is Installed and Up-to-date
11
+
* Assess that a core lightning Node is Installed and Up-to-date
12
12
* Perform Basic Lightning Wallet Commands
13
13
* Create a LIghtning Channel
14
14
@@ -20,7 +20,7 @@ Supporting objectives include the ability to:
20
20
21
21
## Table of Contents
22
22
23
-
*[Section One: Verifying Your c-lightning Setup](19_1_Verifying_Your_Lightning_Setup.md)
24
-
*[Section Two: Knowing Your c-lightning Setup](19_2_Knowing_Your_lightning_Setup.md)
23
+
*[Section One: Verifying Your core lightning Setup](19_1_Verifying_Your_Lightning_Setup.md)
24
+
*[Section Two: Knowing Your core lightning Setup](19_2_Knowing_Your_lightning_Setup.md)
25
25
*[Interlude: Accessing a Second Lightning Node](19_2__Interlude_Accessing_a_Second_Lightning_Node.md)
26
26
*[Section Three: Creating a Lightning Channel](19_3_Setting_Up_a_Channel.md)
Copy file name to clipboardExpand all lines: 19_1_Verifying_Your_Lightning_Setup.md
+13-13Lines changed: 13 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,14 @@
1
-
# 19.1: Creating a c-lightning Setup
1
+
# 19.1: Creating a core lightning Setup
2
2
3
3
> :information_source:**NOTE:** This section has been recently added to the course and is an early draft that may still be awaiting review. Caveat reader.
4
4
5
-
In this section, you'll install and verify c-lightning, your utility for accessing the Lightning Network.
5
+
In this section, you'll install and verify core lightning, your utility for accessing the Lightning Network.
6
6
7
7
> :book:***What is the Lightning Network?*** The Lightning Network is a decentralized network that uses the smart contract functionality of the Bitcoin blockchain to enable instant payments across a network of participants. Lightning is built as a layer-2 protocol that interacts with Bitcoin to allow users to exchange their bitcoins "off-chain".
8
8
9
9
> :book:***What is a layer-2 protocol?*** Layer 2 refers to a secondary protocol built on top of the Bitcoin blockchain system. The main goal of these protocols is to solve the transaction speed and scaling difficulties that are present in Bitcoin: Bitcoin is not able to process thousands of transactions per second (TPS), so layer-2 protocols have been created to solve the blockchain scalability problem. These solutions are also known as "off-chain" scaling solutions.
10
10
11
-
## Install C-Lightning
11
+
## Install core Lightning
12
12
13
13
If you used the [Bitcoin Standup Scripts](https://github.com/BlockchainCommons/Bitcoin-Standup-Scripts), you may have already installed Lightning at the beginning of this course. You can test this by seeing if `lightningd` is running:
If not, you'll need to install it now. Unfortunately, if you're using Debian you'll need to install it by hand, by compiling the source code — but it should still be pretty simple if you follow these instructions. If you happen to be on a standard Ubuntu system, instead try [Installing from Ubuntu ppa](#variant-install-from-ubuntu-ppa), and you can always attempt [Installing Pre-compiled Binaries](#variant-install-pre-compiled-binaries).
29
29
30
-
> :book:***What is c-lightning?*** There are three different implementations of Lightning at present: c-lightning, LND, and Eclair. They should all be functionally compatible, based on the same [BOLT RFCs](https://github.com/lightningnetwork/lightning-rfc/blob/master/00-introduction.md), but their implementation details may be different. We've chosen c-lightning as the basis of our course because it's also part of the same [Elements Project](https://github.com/ElementsProject) that also contains Libwally.
30
+
> :book:***What is core lightning?*** There are three different implementations of Lightning at present: core lightning, LND, and Eclair. They should all be functionally compatible, based on the same [BOLT RFCs](https://github.com/lightningnetwork/lightning-rfc/blob/master/00-introduction.md), but their implementation details may be different. We've chosen core lightning as the basis of our course because it's also part of the same [Elements Project](https://github.com/ElementsProject) that also contains Libwally.
31
31
32
-
### Compile the c-lightning Source Code
32
+
### Compile the core lightning Source Code
33
33
34
34
Installing Lightning from source code should actually be pretty simple if you follow these instructions.
35
35
36
36
You _probably_ want to do this on an unpruned node, as working with pruned nodes on Lightning may cause issues with installation and usage. If you set up your node way back at the start of this course to be pruned, you may wish to replace it with an unpruned node now. (If you're using testnet, you should be able to use the same type of machine as you did for your pruned node.)
37
37
38
-
> :warning:**WARNING:** You actually can run c-lightning on a pruned node. However, as the [Lightning repo](https://github.com/ElementsProject/lightning#pruning) notes, there may be issues. To make it work you have to ensure that your Lightning node is only ever trying to update info on blocks that your Bitcoin node has not pruned. To do so you must make sure (1) that your Bitcoin node is fully up to date before you start your Lightning node for the first time; and (2) that your Lightning node never falls too far behind your Bitcoin node (for a standard 550-block pruning, it can never be turned off for 4 or more days). So, you can do it, but it does introduce some danger, which isn't a good idea if you're running a production service.
38
+
> :warning:**WARNING:** You actually can run core lightning on a pruned node. However, as the [Lightning repo](https://github.com/ElementsProject/lightning#pruning) notes, there may be issues. To make it work you have to ensure that your Lightning node is only ever trying to update info on blocks that your Bitcoin node has not pruned. To do so you must make sure (1) that your Bitcoin node is fully up to date before you start your Lightning node for the first time; and (2) that your Lightning node never falls too far behind your Bitcoin node (for a standard 550-block pruning, it can never be turned off for 4 or more days). So, you can do it, but it does introduce some danger, which isn't a good idea if you're running a production service.
39
39
40
40
With that, you're ready to install Lightning:
41
41
@@ -95,7 +95,7 @@ A bitcoin lightning daemon (default values shown for network: testnet).
95
95
96
96
You'll begin your exploration of the Lightning network with the `lightning-cli` command. However,`lightningd`_must_ be running to use `lightning-cli`, as `lightning-cli` sends JSON-RPC commands to the `lightningd` (all just as with `bitcoin-cli` and `bitcoind`).
97
97
98
-
If you installed `c-lightning` by hand, you'll now need to start it:
98
+
If you installed `core lightning` by hand, you'll now need to start it:
We suggest creating some aliases to make it easier to use c-lightning.
231
+
We suggest creating some aliases to make it easier to use core lightning.
232
232
233
233
You can do so by putting them in your `.bash_profile`.
234
234
```
235
235
cat >> ~/.bash_profile <<EOF
236
-
alias lndir="cd ~/.lightning/" #linux default c-lightning path
236
+
alias lndir="cd ~/.lightning/" #linux default core lightning path
237
237
alias lnc="lightning-cli"
238
238
alias lnd="lightningd"
239
239
alias lninfo='lightning-cli getinfo'
240
240
EOF
241
241
```
242
242
After you enter these aliases you can either `source ~/.bash_profile` to input them or just log out and back in.
243
243
244
-
Note that these aliases include shortcuts for running `lightning-cli`, for running `lightningd`, and for going to the c-lightning directory. These aliases are mainly meant to make your life easier. We suggest you create other aliases to ease your use of frequent commands (and arguments) and to minimize errors. Aliases of this sort can be even more useful if you have a complex setup where you regularly run commands associated with Mainnet, with Testnet, _and_ with Regtest, as explained further below.
244
+
Note that these aliases include shortcuts for running `lightning-cli`, for running `lightningd`, and for going to the core lightning directory. These aliases are mainly meant to make your life easier. We suggest you create other aliases to ease your use of frequent commands (and arguments) and to minimize errors. Aliases of this sort can be even more useful if you have a complex setup where you regularly run commands associated with Mainnet, with Testnet, _and_ with Regtest, as explained further below.
245
245
246
-
With that said, use of these aliases in _this_ document might accidentally obscure the core lessons being taught about c-lightning, so we'll continue to show the full commands; adjust for your own use as appropriate.
246
+
With that said, use of these aliases in _this_ document might accidentally obscure the core lessons being taught about core lightning, so we'll continue to show the full commands; adjust for your own use as appropriate.
247
247
248
248
## Optional: Modify Your Server Types
249
249
@@ -257,7 +257,7 @@ When lightningd starts up, it usually reads a configuration file whose location
257
257
```
258
258
There is also a general configuration file (default: `~/.lightning/config`). If you want to run several different sorts of nodes simultaneously, you must leave the testnet (or regtest) flag out of this configuration file. You should then choose whether you're using the mainnet, the testnet, or your regtest every time you run `lightningd` or `lightning-cli`.
259
259
260
-
Your setup may not actually have any config files: c-lightning will run with a good default setup without them.
260
+
Your setup may not actually have any config files: core lightning will run with a good default setup without them.
261
261
262
262
## Summary: Verifying your Lightning setup
263
263
@@ -269,7 +269,7 @@ Continue "Understanding Your Lightning Setup" with [§19.2: Knowing Your Lightni
269
269
270
270
## Variant: Install from Ubuntu ppa
271
271
272
-
If you are using a Ubuntu version other than Debian, you can install c-lightning using [Ubuntu ppa](https://launchpad.net/~lightningnetwork/+archive/ubuntu/ppa):
272
+
If you are using a Ubuntu version other than Debian, you can install core lightning using [Ubuntu ppa](https://launchpad.net/~lightningnetwork/+archive/ubuntu/ppa):
Copy file name to clipboardExpand all lines: 19_2_Knowing_Your_lightning_Setup.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,12 @@
1
-
# 19.2: Knowing Your c-lightning Setup
1
+
# 19.2: Knowing Your core lightning Setup
2
2
3
3
> :information_source:**NOTE:** This section has been recently added to the course and is an early draft that may still be awaiting review. Caveat reader.
4
4
5
5
Before you begin accessing the Lightning Network, you should come to a better understanding of your setup.
6
6
7
-
## Know Your c-lightning Directory
7
+
## Know Your core lightning Directory
8
8
9
-
When using c-lightning, everything is kept in the `~/.lightning` directory.
9
+
When using core lightning, everything is kept in the `~/.lightning` directory.
10
10
11
11
The main directory just contains directories for whichever networks are configured, in this case testnet:
Copy file name to clipboardExpand all lines: 19_2__Interlude_Accessing_a_Second_Lightning_Node.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ There are four ways to do so (the first three of which are possible for your fir
10
10
11
11
If someone else already has a Lightning node on the network of your choice, just ask them for their ID.
12
12
13
-
If they are are running c-lightning, they just need to use the `getinfo` command:
13
+
If they are are running core lightning, they just need to use the `getinfo` command:
14
14
```
15
15
$ lightning-cli getinfo
16
16
lightning-cli: WARNING: default network changing in 2020: please set network=testnet in config!
@@ -50,9 +50,9 @@ lightning-cli: WARNING: default network changing in 2020: please set network=tes
50
50
```
51
51
They can then tell you their `id` (`03240a4878a9a64aea6c3921a434e573845267b86e89ab19003b0c910a86d17687`). They will also need to tell you their IP address (`74.207.240.32`) and port (`9735`).
52
52
53
-
## Create a New c-lightning Node
53
+
## Create a New core lightning Node
54
54
55
-
However, for testing purposes, you probably want to have a second node under you own control. The easiest way to do so is to create a second c-lightning node on a new machine, using either Bitcoin Standup, per [§2.1](02_1_Setting_Up_a_Bitcoin-Core_VPS_with_StackScript.md) or compiling it by hand, per [§19.1](19_1_Verifying_Your_Lightning_Setup.md).
55
+
However, for testing purposes, you probably want to have a second node under you own control. The easiest way to do so is to create a second core lightning node on a new machine, using either Bitcoin Standup, per [§2.1](02_1_Setting_Up_a_Bitcoin-Core_VPS_with_StackScript.md) or compiling it by hand, per [§19.1](19_1_Verifying_Your_Lightning_Setup.md).
56
56
57
57
Once you have your node running, you can run `getinfo` to retrieve your information, as shown above.
Unlike with c-lightning, you will need to create a default config file for LND.
112
+
Unlike with core lightning, you will need to create a default config file for LND.
113
113
114
114
However first, you need to enable ZMQ on your Bitcoind, if you didn't already in [§16.3](16_3_Receiving_Bitcoind_Notifications_with_C.md).
115
115
@@ -212,7 +212,7 @@ $ sudo systemctl start lnd
212
212
213
213
### Enable Remote Connections
214
214
215
-
Just as with c-lightning, you're going to need to make LND accessible to other nodes. Here's how to do so if you use `ufw`, as per the Bitcoin Standup setups:
215
+
Just as with core lightning, you're going to need to make LND accessible to other nodes. Here's how to do so if you use `ufw`, as per the Bitcoin Standup setups:
216
216
```
217
217
$ sudo ufw allow 9735
218
218
```
@@ -316,10 +316,10 @@ However, that definitely won't be the case for your first interaction with the L
316
316
317
317
## Summary: Accessing a Second Lightning Node
318
318
319
-
You always need two Lightning nodes to form a channel. If you don't have someone else who is testing things out with you, you're going to need to create a second one, either using c-lightning or (as we will in our examples) LND.
319
+
You always need two Lightning nodes to form a channel. If you don't have someone else who is testing things out with you, you're going to need to create a second one, either using core lightning or (as we will in our examples) LND.
320
320
321
321
## What's Next?
322
322
323
-
Though you've possibly created an LND, c-lightning will remain the heart of our examples until we need to start using both of them, in [Chapter 19](19_0_Understanding_Your_Lightning_Setup.md).
323
+
Though you've possibly created an LND, core lightning will remain the heart of our examples until we need to start using both of them, in [Chapter 19](19_0_Understanding_Your_Lightning_Setup.md).
324
324
325
325
Continue "Understanding Your Lightning Setup" with [§19.3: Setting Up_a_Channel](19_3_Setting_Up_a_Channel.md).
0 commit comments