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

[Bug] - Wallet Balances Incorrect #15633

Open
KryptomineCH opened this issue Jun 27, 2023 · 19 comments
Open

[Bug] - Wallet Balances Incorrect #15633

KryptomineCH opened this issue Jun 27, 2023 · 19 comments
Assignees
Labels
bug Something isn't working

Comments

@KryptomineCH
Copy link

KryptomineCH commented Jun 27, 2023

What happened?

My Transaction history is all over the place eventhough I do not send/receive any chia.
I dont know how to better describe it. there are plenty of 0 value transactions as well as additions and removals:
image
The issue exists on windows, linux, cli and gui.

No money is actually removed/lost/added, so it seems to be a mostly visual bug.
However, the Transaction history is barely usable like that.
As far as I was able to invetigate, this is related to offerings which are beeing cancelled and reissued with an updated price. So It would be nice to see that in a separate list or with a filter which is able to filter out offers which have been cancelled or accepted by oneself and thus net 0. Alternatively, the list could be updated to show more valuable information such as

  • offer created, own offer got accepted, foreign offer accepted, offer cancelled
  • transfer, cat transfer, transfer received...

Version

1.8.1

What platform are you using?

macOS

What ui mode are you using?

GUI

Relevant log output

No response

@KryptomineCH KryptomineCH added the bug Something isn't working label Jun 27, 2023
@acoolprogrammer123
Copy link

I can confirm that I am also seeing the same thing, with one addition. I am running two full nodes on the same network. Sometimes when I cancel an offer, the coin will appear removed on the one machine, and then re-added on the other machine. It scared me the first time I saw it, because it looked like someone made a withdrawal without my permission. Regardless, the -0 entries are a pain to deal with, please take a look at how canceled offers are handled in the GUI.

@KryptomineCH
Copy link
Author

yes, that was litterally my same concern in the beginning.
I also am running a full node on my network

@forReason
Copy link

issue seems to be existing in 1.8.2 still

@github-actions
Copy link
Contributor

This issue has not been updated in 14 days and is now flagged as stale. If this issue is still affecting you and in need of further review, please comment on it with an update to keep it from auto closing in 7 days.

@github-actions github-actions bot added the stale-issue flagged as stale and will be closed in 7 days if not updated label Jul 13, 2023
@BrandtH22
Copy link
Contributor

Hey, @forReason @KryptomineCH and @acoolprogrammer123 . These additional transactions are expected when cancelling offers on-chain as cancelling on-chain means that the coins associated with the offer are being sent to one of your own addresses (this "spends" the coin making the offer null and void).

It seems that we might be able to convert this issue ticket into a feature request for including filtering options within the transactions list, would you all agree that this would help to navigate the transaction list without completely removing the on-chain cancel offer transactions?

@github-actions github-actions bot removed the stale-issue flagged as stale and will be closed in 7 days if not updated label Jul 14, 2023
@KryptomineCH
Copy link
Author

That makes sense.
I have my own cat which I need to refresh offerings for frequently to adjust to price changes.

the change would be much appreciated.

@wjblanke
Copy link
Contributor

possibly there are issues with creating and canceling large amounts of offers. are you running your own local node?

@acoolprogrammer123
Copy link

I am running a full node on one machine, and a wallet on another machine looking at the full node as a trusted peer. Both machines are looking at the same wallet. The wallet machine is where the offers are created, canceled and accepted. I understand that an on chain canceling of an offer will create a - transaction and a + transaction. What I am seeing is that the - and + transactions are not totaling up so that my wallet shows a much larger balance than I ever had of the token. Stopping the wallet, deleting the db and letting it resync seems to correct the issue, but then it crops up again.

@forReason
Copy link

forReason commented Jul 21, 2023

Setup/Environment

The setup looks very simmilar to mine:

  • Also have one full node running on a Ubuntu Server virtual machin in my network.
  • Multiple Wallets (5-10) in differend environments (virtualized serves, windows, ubuntu and en user machines) connecting to the full node
  • Wallets seem affected simmilarly throughout versions. Some on virtual ubuntu servers, some on Windows, GUI and CLI
  • I think I first noticed the issue on 1.8.0. but its possible it was present earlier.
  • Some lookup queries are running directly to the fullnode via rpc as well.
  • there is also a testnet node in my network.

Wallet Balances

I also encounter simmilar Wallet Balance issues which appeared recently, but I do noit really think they are related.
Both issues appeared at the same time and the wallet balance issues were originally why I checked my Transactions.

Balances are totally off for both, xch and my cats (it only showed too little balance so far)
On my full node I was able to resolve the issue with deleting the wallet db. On some wallets though, I needed to send my full wallet balance to myself on a wallet which showed all balance for the other wallets to correct themselves. That was quite concerning as multiple wallets showed the same, incorrect balance.

I encountered this (balance) issue on multiple wallets, one of which is my farmer wallet which usually neither creates offers, nor merges/splits coins.

for clarification purposes:
KryptomineCH is my business account. Unfortunately I cannot access it from everywhere.

@wjblanke
Copy link
Contributor

"What I am seeing is that the - and + transactions are not totaling up so that my wallet shows a much larger balance than I ever had of the token"

This is the wallet balance as reported by Chia or are you totaling the TX history?

We know the TX history can be incomplete but balances should be correct. Sending your funds to yourself would result in coins being merged down which could help alleviate a bug. Are there any exceptions in your log files that would point to issues handling coins? We do filter XCH dust which means the balance may not always be the same on different machines but that would be very minimal amounts of XCH.

@github-actions
Copy link
Contributor

This issue has not been updated in 14 days and is now flagged as stale. If this issue is still affecting you and in need of further review, please comment on it with an update to keep it from auto closing in 7 days.

@github-actions github-actions bot added the stale-issue flagged as stale and will be closed in 7 days if not updated label Aug 10, 2023
@forReason
Copy link

What I noticed one time was that I had plenty transactions in my wallet which showed pending. a delete of the db resloved the issue.

As of right now I am in the process of reverse engineering the transactions history.
If I find further insights, I will post them here.

@KryptomineCH
Copy link
Author

KryptomineCH commented Aug 10, 2023

Another try resyncing my wallet.

Completely deleted my wallet db folder and resynced from known good local full node:
image

Roughly 15% total sum is missing.
unfortunately, the log file was 18 mb large due to not running datalayer client.


So going again, with disabled data layer and cleaned db + cleared log file:


exactly the same result.
here my log file:
debug.log


resynced with doubled derivation index (5500) this had no effect on the displayed balance at all

image


I noticed that the Transaction History varies massively.
in the beginning, I had 400ish transactions.
second sync > 600 transactions
now there are only 155 transactions.

But the balance in between syncs stayed the same.


triggered a resync of my wallet in the settings without deleting the db in hopes the derivation index would trigger then.
The transaction count was the highest of them yet at 721 but the wallet balance is still exactly the same.

At this point I do not know how I can bring back the correct amount and how I should trust the wallet...


here my other wallet on another host:

@kryp-btf:~$ chia wallet show
Wallet height: 4067751
Sync status: Synced
Balances, fingerprint: 241................

Chia Wallet:
   -Total Balance:         6.863138174419 xch (6863138174419 mojo)
   -Pending Total Balance: 7.863138174419 xch (7863138174419 mojo)
   -Spendable:             1.445384997132 xch (1445384997132 mojo)
   -Type:                  STANDARD_WALLET
   -Wallet ID:             1

BTF:
   -Total Balance:         999998611.649  (999998611649 mojo)
   -Pending Total Balance: 999998811.649  (999998811649 mojo)
   -Spendable:             983998536.876  (983998536876 mojo)
   -Type:                  CAT
   -Asset ID:              6e55e6dde6bf3fd9e474f2c45cb63e30af64f74285b7ef0b92bbf3503aa14e42
   -Wallet ID:             2

I beg to god this wallet doesnt crash...
On this note I also noticed missing xch in the same wallet:
image

@KryptomineCH
Copy link
Author

KryptomineCH commented Aug 10, 2023

So as a summary:

  • resyncing wallet doesnt help
  • increasing derivation index doesnt help
  • the result seems to be the same in between each try. May need to test on another machine still
  • to me the log didnt show anything particular
  • the transaction history even differs each start
  • cat and xch wallet is affected.
  • accepting an offer does not seem to show any effect. The wallet is "stuck" in its state

If you want to let me know what else I can test, go ahead, ill test it. This issue is mission critical to me.


ps @bramv-chia , can the stale issue please be removed?
Incorrectly shown balances and the inability to bring them back to normal is a super critical issue as far as my judgement goes.

There are several people affected, I have also seen some in the discord asking for help:
image

@KryptomineCH KryptomineCH changed the title [Bug] - transaction history all over the Place [Bug] - Wallet Balances Incorrect Aug 10, 2023
@KryptomineCH
Copy link
Author

So I started testing different versions:

2.0.1-b2 dev 0
the balances are very slightly different, but overal its the same.

1.7.0
I thought the issue might be related to my full node, so tested 1.7.0 on my ubuntu, not connecting to my full node:
image

the result is the same, so its not related to my node, nor to the version.

@github-actions github-actions bot removed the stale-issue flagged as stale and will be closed in 7 days if not updated label Aug 11, 2023
@KryptomineCH
Copy link
Author

KryptomineCH commented Aug 16, 2023

Okay, another update.

As of now, for me, the issue seems to be related to the automatic Derivation Index calculation.
Creating and closing a lot of offers seems to mess with this calculation as new addresses are involved every single time I think.
Perhaps this issue is also present with normal transactions but we have not really seen it as the couple of users here have very accelerated wallet usage.
Another thing that may play a role is that I split the CAT coin of 1000000`000 into plenty smalll coins so that the full amount does not get locked all the time when an offer is beeing creatded. Though I do not know the full workings behind.

I had to bump the derivation index to over 9000
The wallet would not let me do that by default. It would only let me increase it by 500 at a time, so it took nearly 20 minutes just to go from 2500 to 9000 in 12 steps.

The derivation index sets the range of wallet addresses that the wallet scans the blockchain for. This number is generally higher if you have a lot of transactions or canceled offers for XCH, CATs, or NFTs. If you believe your balance is incorrect because it’s missing coins, then increasing the derivation index could help the wallet include the missing coins in the balance total.

The gui help does seem to be accurate on that manner, but that does not help if you have to bump it over 9000 and the wallet will only let you do 500 per minute and only when its in sync.

@KryptomineCH
Copy link
Author

KryptomineCH commented Aug 25, 2023

I have now also been able to reproducet the invalid wallet balance, where the wallet shows more balance that actually exists.

I cannot tell if its reproducible but here is what I did:

  1. transfer 2 cat to new testnet wallet
  2. Create an offer on a separate (gui) wallet
  3. Cancel the offer (without a fee)
  4. All of a sudden noticed, I had 4 CAT in my wallet.

please note the transaction history and wallet info below:

user@chiatestnett:~/.chia/mainnet/wallet/db$ chia wallet show -f 3011902820
Wallet height: 3066450
Sync status: Synced
Balances, fingerprint: 3011902820

Chia Wallet:
   -Total Balance:         0.0 txch (0 mojo)
   -Pending Total Balance: 0.0 txch (0 mojo)
   -Spendable:             0.0 txch (0 mojo)
   -Type:                  STANDARD_WALLET
   -Wallet ID:             1

DataLayer Wallet:
   -Total Balance:         0.0
   -Pending Total Balance: 0.0
   -Spendable:             0.0
   -Type:                  DATA_LAYER
   -Wallet ID:             2

BTF:
   -Total Balance:         4.0  (4000 mojo)
   -Pending Total Balance: 4.0  (4000 mojo)
   -Spendable:             4.0  (4000 mojo)
   -Type:                  CAT
   -Asset ID:              fbaac130d4fe250cd5896e1106d810246feb41a07638e108881fd89f2cf19a74
   -Wallet ID:             3

Connections:
Type      IP                                      Ports       NodeID      Last Connect      MiB Up|Dwn
FULL_NODE 127.0.0.1                               58444/58444 56442c0c... Aug 25 14:23:37      0.2|6.5
                                                  -Height: No Info    -Hash: No Info    -Trusted: True
user@chiatestnet:~/.chia/mainnet/wallet/db$ chia wallet get_transactions -f 3011902820 --id 3
Transaction 0e5c56de8ff55119487ddd39c978ca6379e15831025a3ce58d8504fdf27271f8
Status: Confirmed
Amount received: 2 BTF
To address: txch1yf5gu6q73m73l60284z6jwhp90sd9acrnn47ahtfw8s2fhd9pspqnvn0mf
Created at: 2023-08-21 10:57:28

there seem to be more inconsistencies as well so I might try to resync


resync helped in this case. I do not think the issues are related. Putting that one aside from now

@wjblanke
Copy link
Contributor

Can u send us the walletdb for the 4 BTF wallet?

or

chia wallet coins list

It would be interesting to see which coins are listed.

@KryptomineCH
Copy link
Author

KryptomineCH commented Nov 9, 2023

Is it safe to share the wallet db? Obviously, I do not want to risk anything with a public fund.

Notably I have quite some unconfirmed Additions/Removals. They might be related to open offers?

Wallet 1 (XCH)

 chia wallet coins list
There are a total of 10 coins in wallet 1.
3 confirmed coins.
7 unconfirmed additions.
6 unconfirmed removals.
Confirmed coins:
Coin ID: 0xe8aa8efa0346f406428dcd72d5d724371fcfbf1e89a95b76849381894cbfa150
        Address: xch1jtax8r949ptj2jra8cvj5yrpuc37rranwhlrk57wyd8f8wxj9zdqujtzxt Amount: 4.605872149976  (4605872149976 mojo), Confirmed in block: 4460324

Coin ID: 0x71a0012c29195aec753a25c1256c3e3a9c925bef8e555e6e8a02498b0a5052c3
        Address: xch14zeaqlr4kvpt8lsfrv2cewarkc70pu8z804jvqlwe0ds9rk6uvfsv2ypfd Amount: 1.917785305429  (1917785305429 mojo), Confirmed in block: 4460322

Coin ID: 0xf23ed9821a5ce82b7eae48fb68ea3d9b1fa64e84848d80f4d728d4fbb82d5f4f
        Address: xch104lwttcr6kaeyfsmgqk6f6dvrfc6gxqsjmdnkzmx7l5x3zqkq40qqax4e0 Amount: 0.999999994000  (999999994000 mojo), Confirmed in block: 4460318

Please note, I did a coin split. Because I cannot create offers of varying sizes with just one single coin

Wallet 3 (BTF:)

 chia wallet coins list -i 2
There are a total of 997 coins in wallet 2.
996 confirmed coins.
1 unconfirmed additions.
0 unconfirmed removals.
Confirmed coins:
Coin ID: 0xad1b7e8b892fc569279c88ae6fb748fae911bddba33c61436244a6a7230b1de9
        Address: xch18g0w6vvgf5m0gtkflqujykrf7n7ljplsmerpapjy47p236pgu47qwv3wfy Amount: 0.001000000000  (1 mojo), Confirmed in block: 3873287

Coin ID: 0x6fa62dd5c909663fff7ee827e9c05d810095a9d4f64fa010fee46ecc769a348e
        Address: xch1at80ewd3s0kdlalcv0pxcfnvs2zyk3y6qmglmrdpjm8x8dgjzrtsz2xxfn Amount: 0.001000000000  (1 mojo), Confirmed in block: 3873287

Coin ID: 0x68039951e293f1850d8a1a7d3698619215d741ff7e538219ff1ddf324889c3fb
        Address: xch1hjdzt979z90xq3dk2hdnly4q5v8alf0v50q9ph07yx5lxpnn5scqtraq4v Amount: 1999997.000000000000  (1999997000 mojo), Confirmed in block: 4316092

Coin ID: 0xc3e329396caa4068451e09562c218fe35741f9f5343c568d78d0dbd29a233dea
        Address: xch1t5eca87ye0y3ty6w3gvc4ykuf5regt8fs5m67q55jk0frgcrywgsv4kg9n Amount: 1999997.000000000000  (1999997000 mojo), Confirmed in block: 3873325

Coin ID: 0xdae8386013980a78ca47a194e2df36b651034e493a5f2f9d83b8c26715a7e7da
        Address: xch1f577sl5g0llw08y3r78rnx5r6j0vnh92z0cgqkx5ur83psjy34fq77y6qn Amount: 1999997.000000000000  (1999997000 mojo), Confirmed in block: 3873325

Press q to quit, or c to continue

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

6 participants