Title: Electrum can't handle "send to pubkey" inputs Post by: LoyceV on April 27, 2022, 11:40:30 AM I just found out Electrum can't handle "send to pubkey" inputs. If you for instance import 1PTYXwamXXgQoAhDbmUf98rY2Pg1pYXhin (https://blockchair.com/bitcoin/address/1PTYXwamXXgQoAhDbmUf98rY2Pg1pYXhin) (to create a new watch-only wallet), it shows all the spam transactions it received and a total balance of 0.00181009 BTC. The real balance is 3,233.17181009 BTC.
I can't really find much information about this, searching on keywords give completely different results. Is this a bug? Does Electrum simply not care about the few (but highly funded!) old addresses out there? Or am I missing something? Until a week ago, I didn't even know "send to pubkey" exists. I clearly joined Bitcoin late. Title: Re: Electrum can't handle "send to pubkey" inputs Post by: NeuroticFish on April 27, 2022, 11:50:58 AM Does Electrum simply not care about the few (but highly funded!) old addresses out there? Or am I missing something? I've found here an explanation (https://github.com/spesmilo/electrum/issues/6180). From my understanding P2PK does not translate clearly to an address so we could say it's that the one who has received the funds. Title: Re: Electrum can't handle "send to pubkey" inputs Post by: hosseinimr93 on April 27, 2022, 12:39:13 PM I can't really find much information about this, searching on keywords give completely different results. I think the replies made in the topic created by BlackHatCoiner last year should be helpful. He asked the same question.Electrum doesn't show rewarded coins (https://bitcointalk.org/index.php?topic=5327269) Title: Re: Electrum can't handle "send to pubkey" inputs Post by: Charles-Tim on April 27, 2022, 01:09:17 PM I can't really find much information about this, searching on keywords give completely different results. I think the replies made in the topic created by BlackHatCoiner last year should be helpful. He asked the same question.Electrum doesn't show rewarded coins (https://bitcointalk.org/index.php?topic=5327269) That btt link gives detailed explanation. Which means it was public key paid to, not to address. If address was imported, only the bitcoin sent to the address which is hash of public key is shown on Electrum. This is not an issue on blockchain explorer as the address is linked to its public key. Title: Re: Electrum can't handle "send to pubkey" inputs Post by: o_e_l_e_o on April 27, 2022, 02:05:06 PM This is not an issue on blockchain explorer as the address is linked to its public key. Just to be pedantic, but actually you are considering the issue in reverse. This is an issue with blockchain explorers incorrectly linking P2PK coins to the addresses we are now more familiar with that Also note that Electrum can indeed successfully sweep coins from P2PK inputs; it just won't let you watch them as you can for an address. Title: Re: Electrum can't handle "send to pubkey" inputs Post by: LoyceV on April 27, 2022, 02:28:02 PM Also note that Electrum can indeed successfully sweep coins from P2PK inputs; it just won't let you watch them as you can for an address. I did not know this (and it is the main part of my problem). From what I was told, Fork wallets can't do this (but I don't want to expose the private key to test it).If Electrum can sweep/import private keys with P2PK-funds, it's not possible to sign offline if it can't import the balance from the pubkey. Considering all of those have a very valuable balance, that's a big shortcoming. Title: Re: Electrum can't handle "send to pubkey" inputs Post by: o_e_l_e_o on April 27, 2022, 03:11:41 PM -snip- Interesting. Does seem to be an issue. The relevant replies by SomberNight make no mention of airgapped use:https://github.com/spesmilo/electrum/issues/5497#issuecomment-509690955 https://github.com/spesmilo/electrum/pull/3125#issue-268581561 Perhaps there is a way around it by crafting a transaction using the pubkey and the command line, but I'd have to tinker for a while when I'm not on mobile to figure it out. Title: Re: Electrum can't handle "send to pubkey" inputs Post by: hosseinimr93 on April 27, 2022, 03:47:12 PM This is an issue with blockchain explorers incorrectly linking P2PK coins to the addresses we are now more familiar with that didn't even exist at the time the P2PK outputs were created. You are saying that there was no address when the transaction mentioned by LoyceV was made? Am I getting you correctly?If so, electrum shouldn't show any transactions made before that transaction? Right? But if you import 19uf6F6EDijkH4ZUaqsi3pZ2SVD6A5RG8X into electrum, you will see some transactions made on February 6, 2010 (11 days before the transaction mentioned by LoyceV) What am I missing here? Maybe, in that time, people could create both P2PK and p2pkh outputs. Right? Title: Re: Electrum can't handle "send to pubkey" inputs Post by: LoyceV on April 27, 2022, 04:02:41 PM Maybe, in that time, people could create both P2PK and p2pkh outputs. Right? I think so, yes.Title: Re: Electrum can't handle "send to pubkey" inputs Post by: o_e_l_e_o on April 27, 2022, 04:17:55 PM Maybe, in that time, people could create both P2PK and p2pkh outputs. Right? Correct.I got my dates wrong above. I thought P2PKH came later. The first P2PKH transaction was actually in January 2009: https://mempool.space/tx/6f7cf9580f1c2dfb3c4d5d043cdbb128c640e3f20161245aa7372e9666168516 P2PK was commonly used for some time after that, and indeed, can still be used if you wanted to. Of note, mempool.space correctly segregates transactions based on P2PK and P2PKH. Title: Re: Electrum can't handle "send to pubkey" inputs Post by: Cricktor on April 27, 2022, 07:59:11 PM I tried to setup a watch-only wallet with Electrum for the Satoshi and Patoshi "addresses", well that failed apparently because you can't subscribe with Electrum to such P2PK transactions. They seem all to be P2PK coinbase transactions with are "invisible" for Electrum. My "Patoshi" watch-only wallet sees only the spam transactions to the "derived" PKH addresses. :P
Does anyone have an idea or suggestion which wallet would be able to setup such a watch-only wallet that properly recognizes the P2PK transaction balances and additionally the later mostly P2PKH spam to the derived addresses? Maybe with Bitcoin Core, but I've not yet processed what is stated in https://github.com/bitcoin/bitcoin/blob/master/doc/descriptors.md (https://github.com/bitcoin/bitcoin/blob/master/doc/descriptors.md) and I'm not sure if and how to use it. Title: Re: Electrum can't handle "send to pubkey" inputs Post by: LoyceV on April 27, 2022, 08:19:00 PM Does anyone have an idea or suggestion which wallet would be able to setup such a watch-only wallet that properly recognizes the P2PK transaction balances and additionally the later mostly P2PKH spam to the derived addresses? Bitcoin Core can do this:Quote from: from Bitcoin Core Console Code: importpubkey "pubkey" ( "label" rescan ) Title: Re: Electrum can't handle "send to pubkey" inputs Post by: Pmalek on April 27, 2022, 08:21:21 PM Does anyone have an idea or suggestion which wallet would be able to setup such a watch-only wallet that properly recognizes the P2PK transaction balances and additionally the later mostly P2PKH spam to the derived addresses? Yes, Bitcoin Core should do the trick. I found a post from achow101 from a few years ago. He explains how you have to import the public key into your watch only wallet for P2PK outputs to become visible. You can't import the address they are supposedly in because P2PK scripts don't have addresses. The public key should create the correct watch-only wallet. Maybe with Bitcoin Core... The second is that importing an address will not give you the pubkey necessary for a P2PK output as those scripts don't have addresses. To add P2PK outputs as watchonly, you will need to import the public key directly. Title: Re: Electrum can't handle "send to pubkey" inputs Post by: Cricktor on April 28, 2022, 09:21:50 AM Thank you for reminding me of importpubkey and importmulti, if that is the only solution with Bitcoin Core. I will need to do some more scripting to cram all pubkeys and addresses of my interest into a new Bitcoin Core watch-only wallet.
Too bad there seems to be no SPV wallet solution? Title: Re: Electrum can't handle "send to pubkey" inputs Post by: LoyceV on April 28, 2022, 09:32:18 AM Too bad there seems to be no SPV wallet solution? I haven't found one. I'm curious which SPV wallets would check for P2PK-balances when you enter a private key, but I can't really test that.I'm currently searching the latest transactions that sent funds to a pubkey, to see how often it's still used. My guess is it's barely used, and considering I haven't missed this feature in years, it makes (some) sense they haven't implemented it. Update: just this month: Code: 730941 d26c7bbb1b02c378cecb493376a45ba5d8a9b0a07990c7e1127255749f272218 2022-04-08 05:49:27 30194 13.1308 1QHPwFgm6MyQEV7j4ye9Czk9LgB6FEcK95 pubkey 41048e4f1cbf53f83bd08dbde89c24171843cdf150f1f1acbf11f4baced58b53e64504eb86de988c5f078e0439cde29e4ab1d5c040206a815bc756eb0d6013414fd2ac 0 1 Title: Re: Electrum can't handle "send to pubkey" inputs Post by: Cricktor on April 28, 2022, 09:39:24 AM https://github.com/spesmilo/electrum/pull/3125#issue-268581561 I can't test it either, but from above I read that Electrum tries to sweep P2PK UTXOs from private keys in addition to P2PKH or P2SH UTXOs.Title: Re: Electrum can't handle "send to pubkey" inputs Post by: LoyceV on April 28, 2022, 09:51:16 AM Electrum tries to sweep P2PK UTXOs from private keys in addition to P2PKH or P2SH UTXOs. Does that mean the import private key feature does it too?Title: Re: Electrum can't handle "send to pubkey" inputs Post by: Cricktor on April 28, 2022, 10:11:30 AM Electrum tries to sweep P2PK UTXOs from private keys in addition to P2PKH or P2SH UTXOs. Does that mean the import private key feature does it too?I may be wrong as I haven't checked the Electrum source code and don't have any private key that controls a P2PK UTXO. Title: Re: Electrum can't handle "send to pubkey" inputs Post by: o_e_l_e_o on April 28, 2022, 11:19:38 AM I may be wrong as I haven't checked the Electrum source code You are correct. The relevant code for the sweep function is here: https://github.com/spesmilo/electrum/blob/5f7388a475cd796c30caab688e7f8136a8c6ac27/electrum/wallet.py#L145-L174The sweep function calls the function find_utxos_for_privkey at line 171. This is defined at line 147, which then calls the function _append_utxos_to_inputs at line 149. This is then in turn defined at line 108, which looks for P2PK outputs. This is not implemented across the wallet because it would involve every address in every wallet also having its pubkey queried for P2PK outputs, which would be an unnecessary increase in server load for a very rarely used type of script. Anyone still creating P2PK outputs is clearly doing so for a specific reason and not doing so via Electrum. Title: Re: Electrum can't handle "send to pubkey" inputs Post by: PawGo on April 29, 2022, 03:43:32 PM I just found out Electrum can't handle "send to pubkey" inputs. Ah! That’s the reason why rpc-explorer does not show balance for any of them! I was going to blame it… |