Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Showing incorrect balance when adding public key [Bug] #18234

Closed
jeherschberger opened this issue Jun 22, 2024 · 23 comments
Closed

Showing incorrect balance when adding public key [Bug] #18234

jeherschberger opened this issue Jun 22, 2024 · 23 comments
Assignees
Labels
bug Something isn't working

Comments

@jeherschberger
Copy link

What happened?

I added a public key to the new reference wallet 2.4.0, but the balance is similar to a wallet with private keys on the same computer. I added a public key from a 2 year wallet and a newly created wallet. Both showed the same wallet as the local wallet. I also obtained the same result in both the GUI and the CLI.

Version

2.4.0

What platform are you using?

Linux

What ui mode are you using?

GUI

Relevant log output

No response

@jeherschberger jeherschberger added the bug Something isn't working label Jun 22, 2024
@wjblanke
Copy link
Contributor

Public keys only support unhardened addresses so if you have an older wallet that uses some hardened addresses those coins won't show up. You can resend your balance from a private key wallet to a new address (unhardened by default) and the balance should show up in all wallets, private or public. Let us know how it goes.

@jeherschberger
Copy link
Author

jeherschberger commented Jun 29, 2024

OK, thanks! I was using ozone to make a new wallet and used that public key. The chia wallet reference wallet reflected the same balance on the wallet with public keys as the wallet with private keys. Later I added the public key of the ozone wallet to the chia reference wallet that had a new private key. Then I used an address derived from the wallet with the public key to send xch from my ozone wallet. The balance was correct after a successful transfer.

@jeherschberger
Copy link
Author

Actually, I thought the wallet updated properly when sending to a new address. However, the send address given when displaying the public key did not provide the correct receive address.

@wjblanke
Copy link
Contributor

wjblanke commented Jul 3, 2024

Can u send a screenshot. The GUI shows the current unused address. Wallets have many, many addresses for privacy reasons.

@jeherschberger
Copy link
Author

The first image is of the wallet with the public key and the second image is of the wallet with the private key. Both wallets have the same balance and receive addresses.

Screenshot from 2024-07-03 20-12-26

Screenshot from 2024-07-03 20-11-56

@wjblanke
Copy link
Contributor

Everything looks good here. Are you having any issues anymore? Thanks

@sadiesue43
Copy link

I was having this issue on 2.4.1; just updated to 2.4.2, still there.

@jeherschberger
Copy link
Author

I am also still having issues

@jeherschberger
Copy link
Author

I downloaded the chia version 2.4.2 and it is the same issue. Now the private key and public key have different receive addresses. However, the balances in both wallets remain the same and the receive address provided by the observer wallet is signable by the private wallet.

@wjblanke
Copy link
Contributor

The addresses can be different even though the key is the same (public versus private). It depends on how chia chooses which addresses are free given the state that the current machine knows about. But all those addresses should be usable by either machine given there are unhardened (observer) addresses. Since the balances are the same it seems like things are fine. Are you having issues using the addresses from either machine? They should all work. Thinking this is not a bug but will leave open for now for comments and thanks for your concern and report!

@jeherschberger
Copy link
Author

No, the balances should not be the same because the public key is derived from a different private than the actual private key in the wallet. Additionally, the receive address from the public (observer) wallet should not be signable by the wallet with the private key if it the observer wallet is derived from a different private key.

@sadiesue43
Copy link

+1. The UI is absolutely picking up the wrong key on the Select Key screen.

This is 4 separate mnemonics: Green is observable w/ private key, Red is non-observable(?) (very old) w/ private key, Blues are two observable mnemonics with only public key.

image

Selecting any of them shows this (Green's wallet info):
image
image

@sadiesue43
Copy link

Also, while "logged in" to Blue 2024, I was able to send Green Farmer's tokens.

@wjblanke
Copy link
Contributor

OK we see now, so there is some kind of aliasing going on between different "keys" when you are using the observer feature for any of them. We will look into this. Thanks for the additional screenshots and determined responses.

@jeherschberger
Copy link
Author

Thanks!

@Quexington
Copy link
Contributor

Hey @jeherschberger or @sadiesue43 can you look in your logs for any errors? I'm particularly suspecting KeychainSecretsMissing.

@Quexington
Copy link
Contributor

Quexington commented Jul 25, 2024

I believe I have the fix please feel free to install from source and try it out.

Also worth noting that if you remove the non-observer keys from your keychain then everything should work fine (in the meantime)

@sadiesue43
Copy link

Awesome! I won't be able to test this until tomorrow, but will let you know.

@jeherschberger
Copy link
Author

I just tried to install the chia wallet GUI from source and I got this error.

2024-07-25T20:20:28.876 wallet wallet_server : WARNING API not ready, ignore request: {'data': 'some long hexcode',
2024-07-25T20:20:28.998 daemon chia.daemon.keychain_server: ERROR

I replaced the actual hexcode with text for privacy reasons.

@jeherschberger
Copy link
Author

I also deleted the wallet db and rename the .chia_keys folder. Then I added the public key of wallet 1 and it worked. However when I added the wallet 2 by private keys it gave this error.

wallet chia.wallet.wallet_state_manager: ERROR Failed to add coin_state: CoinState { coin: Coin { parent_coin_info: 0eeededcc9c10924a8ebd07902aa4e5e8b69a1681c33c91d9284fcbbc45addf8, puzzle_hash: de7bf599a1b7e217b5ed301c8c8ceb8e255ea50a56aa542232672a42370799dc, amount: 1 }, spent_height: None, created_height: Some(5151458) }, error: 2

@jeherschberger
Copy link
Author

Ok, it is working after I ran "chia stop -d all".

@sadiesue43
Copy link

I've tested this and it appears to be working now. Yay!

@wjblanke
Copy link
Contributor

Great! Thanks for the information guys

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants