spesmilo / electrum

Electrum Bitcoin Wallet
https://electrum.org
MIT License
7.24k stars 3.03k forks source link

Imported addresses wallet does not find P2PK coinbases in history #6180

Closed MO207 closed 4 years ago

MO207 commented 4 years ago

When adding an address in a watch only wallet or Electrum 3.3.8 it doesn't show the correct balance. It only shows newer transactions and funds but ignores older ones.

There are two examples: 1FbPLPR1XoufBQRPGd9JBLPbKLaGjbax5m had a coinbase TX + some later input on 2020.05.26 only this input is shown.

19PYG68GkQ9nY99QeUSyUFy6vWxSyPmXA8 has a coinbase TX but it is not shown at all.

SomberNight commented 4 years ago

19PYG68GkQ9nY99QeUSyUFy6vWxSyPmXA8 has a coinbase TX but it is not shown at all.

No, that address does not have any transaction history. Historically, old version of Bitcoin Core, and some block explorers conflated P2PK and P2PKH scripts, associating both with the same address. However, this was confusing as it violated the assumption that the address -> scriptPubKey relation is a function. Nowadays to restore this assumption most software only associate the P2PKH script with the address, and the P2PK script does not have any corresponding address. Old coinbases such as the ones here used to pay to P2PK scripts.

The blockstream.info block explorer exhibits the same behaviour: https://blockstream.info/address/19PYG68GkQ9nY99QeUSyUFy6vWxSyPmXA8 https://blockstream.info/tx/ae26f535371eda809a77c958f6f7d3da8697d592de670db7c160cc174e1ffc8a?expand