Chia-Network / chia-blockchain

Chia blockchain python implementation (full node, farmer, harvester, timelord, and wallet)
Apache License 2.0
10.83k stars 2.02k forks source link

[Bug] Chia Light Wallet showing different balance than cli wallet after transaction #9384

Closed mahaupt closed 2 years ago

mahaupt commented 2 years ago

What happened?

I did a transaction with the chia light wallet an hour ago.

https://xchscan.com/txns/0x01b6ed55095722202be5bb15f5a6d382078864e442e9ecdfff2d9c9913a6c36a

After the transaction, the light wallet showed the correct balance and classic wallet (cli) showed a lower, incorrect balance. The transaction doesn't show up on the cli wallet. It seems like the cli wallet is not aware of the remaining of the spent coin

Version

1.2.11

What platform are you using?

Linux

What ui mode are you using?

CLI

Relevant log output

No response

Cal-um commented 2 years ago

Same issue for me.

ojura commented 2 years ago

The light wallet is aware of a new format of receive addresses (and hence some coins sitting there), while the old one is not (it will be when the light wallet changes exit beta and get merged). In the meantime I think you can try sending your full balance to yourself, but to a receive address known by the legacy wallet; this way, the legacy wallet should see all of them.

emlowe commented 2 years ago

As mentioned - the lite wallet defaults to showing "observable" addresses that the previous wallet code is not watching for and so it unaware of those transactions. closing issue

ojura commented 2 years ago

@emlowe where can we find out more about observable addresses? I tried grepping throught the codebase but couldn't find anything. What's different about them? The derivation path?

emlowe commented 2 years ago

Yes, the more "typical" nomenclature is hardened and unhardened (see BIP32 and EIP-2333 for more information). You can also look at https://github.com/Chia-Network/bls-signatures#hd-keys-using-eip-2333

We call it observable because it allows for watch-only or observer wallets without needing the private key.

ojura commented 2 years ago

I see. During light wallet sync, an unhardened public key is passed to full nodes, which enables them to derive all our other public keys and grep for our coins. Right?

s

emlowe commented 2 years ago

The lite wallet protocol doesn't work quite like that, however, yes, it could do so. The lite wallet generates the list of puzzle hashes and asks the node for anything of interest wrt that list. However, this list could be generated from only the public key (with the caveat here that such a list would ignore "old" addresses)

One thing it will eventually allow us to do is to separate out the public and private keys such that the wallet can show you your balance without needing the private keys - this may include allowing you to enter a public key instead of 24 words, or leaving the private key encrypted on disk.