monero-project / monero

Monero: the secure, private, untraceable cryptocurrency
https://getmonero.org
Other
8.99k stars 3.11k forks source link

Transactions do NOT add up to final balance! There's a mismatch. #7410

Open xmrdog opened 3 years ago

xmrdog commented 3 years ago

I have both hot and cold machines running Linux. Both have the same v0.17.1.9 Monero version.

After performing these steps:

  1. On hot machine, remove wallet file (leaving only the watch-only .keys file).
  2. On hot machine, run export_outputs all.
  3. On cold machine, run import_outputs.
  4. On cold machine, run export_key_images all.
  5. On hot machine, run import_key_images.
  6. On hot machine, run show_transfers all

The final balance shown (after refresh completes) does NOT match up with the transactions! First of all:

Assuming that's the case, the transactions add up to a greater balance than what I'm supposed to have.

Could this be related to https://github.com/monero-project/monero/issues/1406? I'm not sure because that was supposed to be fixed years ago.

[] UPDATE:** Removed irrelevant info.

xmrdog commented 3 years ago

I even tried adding an extra step between 2 and 3: On cold machine, delete wallet file (leaving only .keys file).

Same result.

xmrdog commented 3 years ago

CCing @moneromooo-monero since he was involved with potentially related #1406.

xmrdog commented 3 years ago

Updated above with clarification.

xmrdog commented 3 years ago

@dEBRUYNE-1 CC

dEBRUYNE-1 commented 3 years ago

Does the wallet state that any key images are missing?

xmrdog commented 3 years ago

@dEBRUYNE-1 No, it doesn't. (It did after step 1 + refresh, but after running all the steps above, the "missing key images" message is gone as expected.)

xmrdog commented 3 years ago

@dEBRUYNE-1 @fluffypony @moneromooo-monero

I found a different way to reproduce exactly the same mismatch: By running export_transfers all output=foo.csv, I do indeed get a final "running balance" that is greater than shown by balance.

(So my earlier manual balance calculation was correct.)

Could this be an inflation bug or some other serious bug? The silence worries me.

glv2 commented 3 years ago

Do you have transactions where your wallet sent money only to itself? I remember beeing suprised some time ago because the show_transfers command did not show the whole picture in this case.

xmrdog commented 3 years ago

@glv2 No such thing in my case. Was your case a reported bug that was fixed? What was your solution?

I was able to investigate my case further. Since my wallet is simply transactions to/from an exchange, I know exactly what transactions to expect (since the exchange has a detailed ledger on their end).

Thankfully, the balance shown after refresh is exactly as expected. However, two out transactions that should be there are not showing up in show_transfers/export_transfers. This results in the mismatch between the final "running balance" and actual balance.

What could be the reasons for missing transactions?

FYI:

dEBRUYNE-1 commented 3 years ago

Do you see any errors in the log (monero-wallet-cli.log) related to inability to 'decrypt' the missing transactions?

JustFranz commented 3 years ago

Can you send the whole incorrect balance or just the outputs that should not be there and will they go through?

moneromooo-monero commented 3 years ago

Can you send me an compressed then encrypted log level 2 of simplewallet scanning this wallet, as well as the txids of the missing transactions please ? My key's in utils/gpg_keys/moneromooo.asc, since the log will contain private info (though not the wallet keys).

xmrdog commented 3 years ago

@moneromooo-monero

I was able to recover the missing transactions by copying the entire blockchain data over to the offline laptop, run ./monerod --offline, run ./monero-wallet-cli (without --offline), resync the wallet, and export the transactions.

The problem must be later in the pipeline, presumably somewhere in the hot/cold steps I outlined above.

I don't want to send over any private info like this.

Isn't this a great opportunity for someone to fully 100% reflect on and grasp the code of that entire pipeline again? To do some spring cleaning, check if there is some dust in there, so to speak. There's clearly a bug in there somewhere. Can someone here start a bug bounty on the Monero website? I will contribute.

selsta commented 3 years ago

@xmrdog https://hackerone.com/monero

woodser commented 3 years ago

In case it's related to https://github.com/monero-project/monero/issues/5812, which I'm not able to reproduce now.