Skip to content

Commit

Permalink
GITBOOK-405: change request with no subject merged in GitBook
Browse files Browse the repository at this point in the history
  • Loading branch information
Leo Weese authored and gitbook-bot committed Jan 18, 2024
1 parent 7eddea8 commit 66cf028
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 288 deletions.
1 change: 0 additions & 1 deletion SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
* [Pathfinding](lightning-network-tools/lnd/pathfinding.md)
* [Key Import](docs/lnd/key\_import.md)
* [Secure Your Lightning Network Node](lightning-network-tools/lnd/secure-your-lightning-network-node.md)
* [Operational Safety](lightning-network-tools/lnd/safety.md)
* [Configuration of a Routing Node](lightning-network-tools/lnd/optimal-configuration-of-a-routing-node.md)
* [Quick Tor Setup](lightning-network-tools/lnd/quick-tor-setup.md)
* [Configuring Tor](lightning-network-tools/lnd/configuring\_tor.md)
Expand Down
4 changes: 2 additions & 2 deletions lightning-network-tools/lnd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ LND's API documentation
[secure-your-lightning-network-node.md](secure-your-lightning-network-node.md)
{% endcontent-ref %}

{% content-ref url="safety.md" %}
[safety.md](safety.md)
{% content-ref url="broken-reference" %}
[Broken link](broken-reference)
{% endcontent-ref %}

{% content-ref url="quick-tor-setup.md" %}
Expand Down
2 changes: 1 addition & 1 deletion lightning-network-tools/lnd/disaster-recovery.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Once invoked, your node will ask your peers to send you their latest commitment

* The most recent channel database

The `channel.db` file can be found in `.lnd/data/graph/mainnet` and contains all information about your channels, including your latest commitment transaction. Invoking this file as part of your recovery process can be risky if the channel.db is not up to date. Only use this file if you were able to recover it directly from your [crashed node](safety.md).
The `channel.db` file can be found in `.lnd/data/graph/mainnet` and contains all information about your channels, including your latest commitment transaction. Invoking this file as part of your recovery process can be risky if the channel.db is not up to date. Only use this file if you were able to recover it directly from your crashed node.

* Information about your channels from third parties

Expand Down
2 changes: 1 addition & 1 deletion lightning-network-tools/lnd/macaroons.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ Examples:
## Actions and RPC permissions
Macaroons in LND may refer to one of seven actions: `onchain`, `address`, `message`, `peers`, `offchain`, `info`, `invoices` and `macaroon`. These actions encompass the following RPC services:
Macaroons in LND may refer to one of seven actions: `onchain`, `address`, `message`, `peers`, `offchain`, `info`, `invoices` and `macaroon`. These [actions encompass](https://github.com/lightningnetwork/lnd/blob/master/rpcserver.go#L263) the following RPC services:
### Onchain
Expand Down
4 changes: 2 additions & 2 deletions lightning-network-tools/lnd/recovery-planning-for-failure.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
description: '"That''s planning for failure, Morty. Even dumber than regular planning."'
---

# Recovery: Planning for failure
# Recovery: Planning for Failure

In order to achieve near-instant and cheap Bitcoin payments, the Lightning Network makes some tradeoffs in comparison to the Bitcoin base layer. One of those tradeoffs is that its security model is more complex. 

Expand All @@ -24,7 +24,7 @@ If you decide to deploy your Lightning node in the cloud, choose a reputable pro

**If your Lightning node is going to run on a device you physically control, invest in a high-quality SSD and consider setting up RAID.**

\[[Also read: Operational safety](safety.md)]
[Also read: Secure Your Lightning Network Node](secure-your-lightning-network-node.md)

## aezeed

Expand Down
273 changes: 0 additions & 273 deletions lightning-network-tools/lnd/safety.md

This file was deleted.

21 changes: 13 additions & 8 deletions lightning-network-tools/lnd/secure-your-lightning-network-node.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,27 @@ How you update your LND will depend on how you installed it. You may for example

## Your wallet <a href="#docs-internal-guid-4d50a2e2-7fff-6a56-4160-813804306ee7" id="docs-internal-guid-4d50a2e2-7fff-6a56-4160-813804306ee7"></a>

When creating your wallet with `lncli create`, you are given a 24 word long seed phrase. This seed phrase can be used to recover your on-chain Bitcoin, meaning that if it falls into the wrong hands your bitcoin are at risk of being taken. Similarly, if you are not in possession of this seed phrase yourself, you may not be able to regain control over your funds in the event of an error.
When creating your wallet with `lncli create`, you are given a 24 word long "aezeed" seed phrase. Similar to a BIP39 seed phrase, it can be used to recover your on-chain Bitcoin, meaning that if it falls into the wrong hands your bitcoin are at risk of being taken. Similarly, if you are not in possession of this seed phrase yourself, you may not be able to regain control over your funds in the event of an error.

You may write your seed phrase, in its correct order, on a piece of paper and store it somewhere securely. Alternatively, you may store it in encrypted storage elsewhere, such as your password manager.

Never run two separate LND nodes with the same seed!

Your private key is contained in your node's `wallet.db`. This wallet database and the macaroon database are encrypted with the password chosen when initializing the wallet using `lncli create`. If you lose your wallet password, you may recreate the wallet and macaroon database using the seed.

## Your macaroons

Your node uses macaroons to authenticate API calls, including from `lncli`. Make sure your macaroons can only be accessed by authorized applications. To invalidate a macaroon, it is not enough to delete it. Instead, the `macaroons.db` has to be deleted in its entirety. A specific macaroon can be invalidated using `lncli deletemacaroonid` and its macaroon ID.

## Your channels <a href="#docs-internal-guid-8725c728-7fff-9b34-f746-fcdc7a49c5e5" id="docs-internal-guid-8725c728-7fff-9b34-f746-fcdc7a49c5e5"></a>

In the event that your hard drive becomes corrupted or the entire device destroyed or deleted, you may recover your on-chain funds using the seed phrase above. Your channels however can’t be backed up directly, though a mechanism exists to recover them separately from your on-chain funds.

You can find your channel backups in the file `<lnddir>/data/chain/bitcoin/mainnet/channel.backup`
You can typically find your channel backups in the file `~/.lnd/data/chain/bitcoin/mainnet/channel.backup`

This file is changed every time a channel is opened or closed. You may set up a script that [backs up this file whenever it is changed](https://gist.github.com/alexbosworth/2c5e185aedbdac45a03655b709e255a3), or copy it manually. It is necessary to back up this file whenever a new channel has been opened.\
For backup purposes the channel.db file is not suitable for such backups. Keeping an up-to-date backup of this file is close to impossible, and you may lose your funds when recovering from an outdated `channel.db` file. This file can only be used when migrating your node, not when restoring.
This file is changed every time a channel is opened or closed. You may set up a script that [backs up this file whenever it is changed](https://gist.github.com/alexbosworth/2c5e185aedbdac45a03655b709e255a3), or copy it manually. It is necessary to back up this file whenever a new channel has been opened. Invoking the `channel.backup` initiates a force close by your remote peers.

The `channel.db` file is not suitable for backups. Keeping an up-to-date backup of this file is close to impossible, and you may lose your funds when recovering from an outdated `channel.db` file. This file can only be used when migrating your node, not when restoring.

## Operational safety <a href="#docs-internal-guid-f7878f4c-7fff-d8de-f925-4704b4d0790e" id="docs-internal-guid-f7878f4c-7fff-d8de-f925-4704b4d0790e"></a>

Expand All @@ -62,14 +71,10 @@ When operating your node, it is important to note that you not interrupt lncli c

To safely shut down your Lightning Node, use the command `lncli stop`

It is not recommended to prune your Bitcoin node, especially not for transactions occurring after the activation of Segwit, August 2017.&#x20;

## Your external applications <a href="#docs-internal-guid-fb6b5911-7fff-e340-f874-86a51944a08c" id="docs-internal-guid-fb6b5911-7fff-e340-f874-86a51944a08c"></a>

LND uses macaroons to authenticate external applications. These may be applications running on the same machine as LND or externally.

By default you will see the `admin.macaroon`, `invoice.macaroon`, `readonly.macaroon` and `router.macaroon` files in your `<lnddir>/data/chain/bitcoin/mainnet/` directory. They each have their own permissions, and you may create your own macaroons with specific purposes. Only share these macaroons with applications on devices you trust.

To recreate macaroons you may delete all of the macaroon files and restart LND. However, this will NOT invalidate old macaroons. To invalidate old macaroons, you will have to delete the `macaroon.db` file as well before restarting LND.

[See also our guide on Operational Safety.](safety.md)

0 comments on commit 66cf028

Please sign in to comment.