Post
Topic
Board Development & Technical Discussion
Merits 4 from 3 users
Topic OP
Electrum & EPS tests - Master Public Key & Lightning Network wonderings
by
profedustream
on 16/09/2023, 10:52:36 UTC
⭐ Merited by ETFbitcoin (2) ,vjudeu (1) ,Cyrus (1)
Hi fellows,

In the last few weeks, i worked a lot with Electrum Personal Server, set-uping my full node Bitcoin Core with my electurm 4.4.5 wallet. Everything had been done on Windows, 'cause i wanna try this instead of using Umbrel / Linux. I achieved that with some researchs, and did a video tutorial about it in order to help people to do the same: https://www.youtube.com/watch?v=wxiH8hG9G-4

My electrum wallet is also only connected to my own node through TOR; and my full node is connected to the network through TOR too. It also enables me to have a private wallet which is not linked to my IP address, nor my identity IRL (via my Internet Service Provider).



During all those tests and set-ups, i achieved to understand how Electrum Personal Server works; and how a wallet works too.
However, something kinda shocked me: when you connect your Electrum wallet to your ESP, the ESP sends the master public key (from which all adresses are created) to node(s); enabling them to find all the UTXOs from all the adresses of your wallet (even the ones you never used). Once they find them, node(s) send them to the wallet, which shows transactions then calculates how much sats/BTC are available.

My first question is: is the master public key always used to update the wallet balance? Or is it only with ESP?



I also tried to use Lightning Network with this Electrum 4.4.5 wallet, connected to my full node with ESP. Everything worked fine, and my wallet was synchronised.

I also created a LN channel with 0.01 BTC (let's say i had 0.05 BTC in the UTXO before). The network found the transaction and added it in the next bloc: almost 0.04 BTC had been sent to an other address of my Electrum wallet due to miner fees (everything's fine also), and 0.01 BTC had been sent to an other on-chain Bitcoin address.
Quickly, after 3 confirmations, my channel was written as « Opened » whereas my wallet and my ESP started to bug: the synchronisation stopped, and couldn't go further. Indeed, my ESP was telling me that i had to check my master public key, and i should check all my addresses.

The explanation is that, when i opened the LN channel, the 0.01 BTC i've talked about had been sent to an on-chain address which hadn't been created from my master public key. It was like a « sleeping address », waiting something to send the 0.01 BTC to the Lightning Network.
I also checked on the internet and found that it's currently not possible to use the LN with ESP. I also force-closed the channel; and after 6 blocks and a resync' of my ESP / master public key, everything was okay. I only « lost » miner fees, which is nothing.

However, my second question is: where does come this address, at which my 0,01 BTC had been sent? I mean: this address wasn't a hash from my master public key. How had it been created?



To finish, i decided to understand by myself how in-bound and out-bound liquidity worked. It's kinda simple.
To use the LN, i also had to stop using ESP with this wallet; deleting « --oneserver –server 127.0.0.1:50002:s » in my Electrum wallet 'set-up'. It also didn't connect my wallet to my own full node (as expected), and leaked my master public key (i guess, as expected). This also means that all the addresses of this wallet are now linked together for – at least – some nodes; decreasing the privacy of this wallet.

As expected, LN worked perfectly. A new channel had been created, with out-bound liquidity.
In the network parameters of my wallet, it's now connected to 10 nodes automaticaly. About the proxy, the « Use TOR proxy at port 9150 » is stilled checked, and the SOCKS5 proxy configuration i used with ESP is still check too.

My third and last question is a bit stupid, but i wanna check: considering the last paragraph, does my Electrum wallet now use TOR to connect to nodes; hiddening my IP to them?



Thanks for your answers Smiley