Backup

From lightningwiki.net
Jump to: navigation, search

Recent Lightning implementations have made backups easier. It is important to understand the difference between wallet and channel funds.

You can easily get your wallet balance back by recovering your seed. Getting your channel funds back is harder. If you would have an old version of your channel, you broadcast an old state, the counterparty (peer) detects Fraud and takes your funds.

That is why you need to backup your channel state too.

Backup wallet funds[edit]

Use the wallet seed. You get this at installation. It can not be recovered (Lnd).

Channel information[edit]

The second important thing to backup is channel states.

LND[edit]

Receipt-solid-with-text.svg
Side note:
Static Channel backups are suported since Lnd version 6

Once you start a channel, take a static channel backup. This has to be done only once. Or take a backup of the channels.backup file in the same location that we store all the other files. Users will at any time be able to safely copy and backup this file

After that, if your node dies, you can recover using the seed + the static-channel-backup and retrieve both your onchain and channel balance!

See recovery docs by lnd.

Backup channelbackup using inotify (watch changes)[edit]

Post by Alex Bosworth

Example Static channel backup commands[edit]

>tlncli exportchanbackup --all

{
        "chan_points": [
                "a173ca220bb644b4be03e44285b1541382c85fc3de1f9f1e0f317892c55cfd29:0",
                "30ad897d900d837728e09bdb2f4859354207599522fab72d20582f5a713f983d:0",
                "2f86e0049c4488b2cad1a6cffffc56ffd56ba5e639b79994baed64e87e6849f2:0"
        ],
        "multi_chan_backup": "0f955a78d0df14db44769c946a537a9c81174a097e3***6ecf7f4ab1afaa0e06"
}

>tlncli verifychanbackup --multi_backup 0f955a78d0df14db44769c946a537a9c81174a097e3***6ecf7f4ab1afaa0e06

{
    "singles_valid": true,
    "multi_valid": true
}

>tlncli restorechanbackup --multi_backup 0f955a78d0df14db44769c946a537a9c81174a097e3***6ecf7f4ab1afaa0e06

>tlncli pendingchannels

{
    "total_limbo_balance": "0",
    "pending_open_channels": [
    ],
    "pending_closing_channels": [
    ],
    "pending_force_closing_channels": [
    ],
    "waiting_close_channels": [
        {
            "channel": {
                "remote_node_pub": "031673e26fa50f5e1598caff98b8be466998486bd876751b7824ad8def3aa7e76d",
                "channel_point": "30ad897d900d837728e09bdb2f4859354207599522fab72d20582f5a713f983d:0",
                "capacity": "500000",
                "local_balance": "0",
                "remote_balance": "0"
            },
            "limbo_balance": "0"
        },
        {
            "channel": {
                "remote_node_pub": "03b8e1dfc4bf42adec135350dd51784e5b55055f5647d031771bdf439f5de87b88",
                "channel_point": "2f86e0049c4488b2cad1a6cffffc56ffd56ba5e639b79994baed64e87e6849f2:0",
                "capacity": "700000",
                "local_balance": "0",
                "remote_balance": "0"
            },
            "limbo_balance": "0"
        },
        {
            "channel": {
                "remote_node_pub": "03ecd95e86e780ae82139c3217b527073622d28c4d8a53b76142a7b7b1d1e36975",
                "channel_point": "a173ca220bb644b4be03e44285b1541382c85fc3de1f9f1e0f317892c55cfd29:0",
                "capacity": "600000",
                "local_balance": "0",
                "remote_balance": "0"
            },
            "limbo_balance": "0"
        }
    ]
}
>tlncli walletbalance

{
    "total_balance": "108199538",
    "confirmed_balance": "108199538",
    "unconfirmed_balance": "0"
}
>tlncli pendingchannels

{
    "total_limbo_balance": "0",
    "pending_open_channels": [
    ],
    "pending_closing_channels": [
    ],
    "pending_force_closing_channels": [
    ],
    "waiting_close_channels": [
    ]
}
>tlncli walletbalance

{
    "total_balance": "109818740",
    "confirmed_balance": "109818740",
    "unconfirmed_balance": "0"
}
>tlncli listunspent --min_confs 0

{
        "utxos": [
                {
                        "address_type": 0,
                        "address": "tb1qxx25r275r08z3ygagg4cawxp60gj8ptynkvnwc",
                        "amount_sat": 1619202,
                        "pk_script": "0014319541abd41bce28911d422b8eb8c1d3d1238564",
                        "outpoint": "d7f037b2757e27ab16018c03c811f0f494fdad2dc029fc0810b108e103725da5:0",
                        "confirmations": 13
                },

Commitment revocation private key[edit]

Every commitment transaction has a unique commitment revocation private-key value that allows the other peer to spend all outputs immediately: revealing this key is how old commitment transactions are revoked. To support revocation, each output of the commitment transaction refers to the commitment revocation public key.

Hardware[edit]

If you’re putting a lot of money on your Lightning routing node, please use a reliable hard drives (with mirroring).

Data Loss Protection[edit]

Data loss protection