Depositing funds onto your node
OK! We are ready to start digging into our node.
You should now have five (5) windows open on your Ubuntu desktop:
- The TOR container running, showing logs.
- The Bitcoind container running, showing logs.
- The LND container running, showing logs.
- The pworker container running, showing logs.
- A window where you run
lncli
commands.
If you're not already at the command prompt within the LND container in window #5, run this now.
./exec-lncli.sh
Then, let's get some info on our node by running this command:
Get your node info
lncli getinfo
This should output a bunch of JSON like this:
$ lncli getinfo
{
"version": "0.17.4-beta commit=v0.17.4-beta",
"commit_hash": "8bba79222f439127e46ec3ff7ec7c650e0d88d56",
"identity_pubkey": "03477d11175faca273e27dabc03e74aca4d646cb375e4d723f38602b0b4239f37b",
"alias": "change-this-alias",
"color": "#3399ff",
"num_pending_channels": 0,
"num_active_channels": 0,
"num_inactive_channels": 0,
"num_peers": 4,
"block_height": 836794,
"block_hash": "00000000000000000003243cd0c4e7b6612db556f990091af228540f1a707709",
"best_header_timestamp": "1711714365",
"synced_to_chain": true,
"synced_to_graph": true,
"testnet": false,
"chains": [
{
"chain": "bitcoin",
"network": "mainnet"
}
],
"uris": [
"03477d11175faca273e27dabc03e74aca4d646cb375e4d723f38602b0b4239f37b@5p5a5lziz7efiuhcgvm6t4rui5x6w4idztvgp5wpv5oxcjfyafr2fuqd.onion:9735"
]
.... truncated
}
Understand the node info
Let's talk about some of these values.
The identity_pubkey
is a string like 03477d11175faca273e27dabc03e74aca4d646cb375e4d723f38602b0b4239f37b
, and it uniquely identifies your node on the Lightning network.
The alias
you can change at any time, and the are no guarantees that two nodes won't have the same alias
.
There IS a guarantee that two nodes won't have the same identity_pubkey
, and this pubkey
is derived from your wallet seed, so it will never change.
Understand your URIs
Next, let's look at the uris
field. In my case, it looks like...
"uris": [
"03477d11175faca273e27dabc03e74aca4d646cb375e4d723f38602b0b4239f37b@5p5a5lziz7efiuhcgvm6t4rui5x6w4idztvgp5wpv5oxcjfyafr2fuqd.onion:9735"
]
It's important that you understand this. You can see that uris
are plural, like, you can have more than one.
If you are planning on setting up a node with the "routing" purpose (see What is the purpose?), then in The Gentleman's Guide To Routing Nodes, you will be adding another "clearnet" URI so your node can be found with an IP address.
So far, we've only set up TOR for networking, so we just have one URI. Let's break the URI into parts.
The first part of the URI is your public key
03477d11175faca273e27dabc03e74aca4d646cb375e4d723f38602b0b4239f37b
Next, there is an @
symbol, followed by this address:
5p5a5lziz7efiuhcgvm6t4rui5x6w4idztvgp5wpv5oxcjfyafr2fuqd.onion:9735
This is an "onion" address and allows the outside world to securely connect to your node via TOR, but without revealing your IP address.
In any case, now is a great time to make a note of the full URI, as it won't change, and you'll be needing it in the future.
Understand peer vs. channel partner
Another thing you should know about is this value:
"num_peers": 4,
You should understand the difference between a peer
and a channel partner
.
A peer
is just another lightning node that your node is "talking to", or exchanging Network "gossip data" with.
In order to open a channel to a node, you first need to add them as a peer, but you won't have channels with all your peers.
Once you open a channel with a peer, we can call that peer a channel partner
.
Deposit BTC onto your node
To open Lightning channels, you need to use Bitcoin.
So this means we need to deposit BTC onto this node.
So this means we need to generate a new, unique wallet address, so we can make the deposit.
Let's see what our options are.
Run lncli newaddress --help
.
[NAME:
lncli newaddress - Generates a new address.
USAGE:
lncli newaddress [command options] address-type
CATEGORY:
Wallet
DESCRIPTION:
Generate a wallet new address. Address-types has to be one of:
- p2wkh: Pay to witness key hash
- np2wkh: Pay to nested witness key hash
- p2tr: Pay to taproot pubkey
So you can see that the lncli newaddress
command has some options.
We can generate a p2wkh
or a np2wkh
or a p2tr
address.
If you're interested, you can do some research to understand the difference between these kinds of addresses, but I can also just tell you what you really need to know.
Which address kind to use
This is what you need to know.
- The "cheapest" kind of address, which takes the least amount of space in the blockchain, and therefore will result in the lowest fees, is the
p2tr
address. This "Pay to taproot pubkey" is the most modern, the most private, and the overall-best kind of address to use. - The only problem with
p2tr
is that it is not yet supported by some centralized exchanges, including Coinbase. Coinbase is too busy running an Altcoin "casino" and their Bitcoin technology is fully three years behind everyone else's. Also, their user interfaces with Bitcoin are notoriously bad: If you try to pay using ap2tr
address from a Coinbase account, you won't even get a useful error! - If you have to deposit BTC from Coinbase or another exchange with outdated technology, you might need to generate a
np2wkh
address.
Generate the address
So with the above in mind, either run:
lncli newaddress p2tr
or
lncli newadddress np2wkh
Assuming the first choice, you will see something like:
$ lncli newaddress p2tr
{
"address": "bc1pj4xdmug28eawp72j7ev02z0pnddm6m9np06ew6ar93ctlpzws56s9fn2ls"
}
When dealing with BTC addresses, you need to be careful. If, for example, you mistakenly copied the above address, instead of generating your own, and sent to this copied address, your funds would be permanently lost. Careful!
Deposit BTC from an external wallet.
You'll need to decide how much to deposit. Assuming that you are planning to open a channel to an external node, this means, you should deposit at least enough to open a decent-sized channel.
We'll discuss channel sizing later, but for now, I think you should deposit 0.06 BTC, which will allow you to open a channel of 0.05 in size, which is big enough to be useful in the long-term.
How you send BTC from your external wallet is dependent on that external wallet, so you'll need to figure this out for yourself.
Viewing your deposited BTC
Great! You've deposited BTC onto your node. Let's take a look at your Node's wallet, with this command:
lncli walletbalance
When I run that, I see:
$ lncli walletbalance
{
"total_balance": "6000000",
"confirmed_balance": "0",
"unconfirmed_balance": "6000000",
"locked_balance": "0",
"reserved_balance_anchor_chan": "0",
"account_balance": {
"default": {
"confirmed_balance": "0",
"unconfirmed_balance": "6000000"
}
}
}
Good! This shows that I have 6,000,000 satoshis in unconfirmed balance.
This can be confusing at first, but you should know that with LND, you never use BTC amounts, like 0.06 BTC
. Instead, you always use satoshis. There are 100,000,000 (one hundred million) satoshis in one BTC.
You'll soon get used to this, and after a while, you'll start thinking in satoshis instead of BTC!
By the way: This is good preparation for the future. When one BTC is worth over a million U.S. dollars, most people will start thinking in satoshis, instead of BTC, just like you.
Practice looking up the transaction on a blockchain explorer
If you've done some learning on how Bitcoin works, you'll know that transactions are not instantly confirmed -- this actually is the whole reason Lightning was invented!
So as a node runner, when depositing or withdrawing BTC from your node, or opening or closing channels, you will often be in a situation where a transaction is unconfirmed, and you want to check its status.
Let's practice that now.
Run this command:
lncli listchaintxns
Just look at the first few lines of the output:
lncli listchaintxns
{
"transactions": [
{
"tx_hash": "4eb055ffa0b2f965142492ee162c923ba7a32d12805fe435f536425189982c79",
"amount": "6000000",
"num_confirmations": 2,
"block_hash": "00000000000000000002be265d728e8337b7b261a955c9b43b826cf3600a065f",
"block_height": 836799,
Here is the deposit we just made! You can see the amount of 6,000,000
satoshis. This transaction was already confirmed in 2
blocks. But the most important value here is:
"tx_hash": "4eb055ffa0b2f965142492ee162c923ba7a32d12805fe435f536425189982c79",
You can copy this tx_hash
into any block explorer, to get a nice-looking overview on this transaction on the blockchain. Let's do that.
Go to: https://mempool.space
Then paste your transaction hash into the search box at the top of the page.
You will get to a page like this: https://mempool.space/tx/4eb055ffa0b2f965142492ee162c923ba7a32d12805fe435f536425189982c79
If you've never worked with a block explorer before, this can be intimidating. I'm going to make some notes here that will hopefully be useful.
-
Timestamp. This is the time that that transaction confirmed. If the transaction is not yet confirmed, this area will show an estimate in minutes or hours of how long a wait will be necessary to confirmation.
-
Fee. This was the fee paid to Bitcoin miners for this transaction.
-
Fee rate.
-
Input UTXO(s).
-
Output UTXOs, usually two. In this screenshot we can see a larger one for 0.06 BTC, and then the "change" output fr 0.01585, which is going back to the wallet of the sender.