4

I created a view only wallet using the cli command save_watch_only, but when loading this view wallet it seems to only show only incoming transactions including all the change that comes back. This is why the balance is totally off as its not accounting for spends. How can I create a view only wallet that gives the real balance?

0

getmonero.org

A view-only wallet can only see which incoming transactions belong to you.

The only way verifying whether your "money" was spent is to check the key image of your "money", however the watch-only wallet can't do that.

4

First and foremost, a view-only wallet with merely the private view key will only be able to see incoming transactions to its corresponding public address. A more theoretical explanation can be found here:

Why is the viewkey able to track incoming transactions, but not outgoing transactions?

As a practical example, let's say you received a 10 XMR output initially and thus have an initial balance of 10 XMR. Subsequently, you make a transaction of 2 XMR. The wallet will create a transaction where the 10 XMR output is used input, a 2 XMR output that goes to the recipient, and an 8 XMR (minus fee) output that goes back as change to the sender (you). Now, the view-only wallet will see the change as another incoming transaction and therefore show an "erroneous" balance of 10 XMR + 8 XMR (minus fee).

To get a correct balance in the view-only wallet, one has to import the accompanying key images, i.e., each output has an accompanying key image that allows the view-only wallet to check whether an output has been spent and thus show a proper balance as well. Step 1 to 6 of this guide explain you how to import the key images into a view-only wallet:

Yes, there is. It works a bit different than in Bitcoin due to Monero specifics involving scanning for outputs with the view-key and checking the spent status by using key images.

First, we assume you have a fully-synced node and fully-refreshed watch-only wallet on the hot computer. Also, we assume you have wallet software on the cold computer (don't need the node, just monero-wallet-cli).

  1. Using watch-only wallet, command export_outputs <filename>. There will be a file with <filename> created in the working folder*.
  2. Copy the file to the cold wallet computer.
  3. Using cold wallet, command import_outputs <filename>*. The cold wallet now has all the outputs and can prepare a signed key image for every one of them (unless something new was received after step 1. It won't display the correct balance because it can't check the spent status of the key images, as it is offline.

--- Stop here if you only want to monitor incoming transfers and don't care to see the correct balance and when something has been spent ---

  1. Using cold wallet, command export_key_images <filename>. There will be a file with <filename> created in the working folder*.
  2. Copy the file to the hot wallet computer.
  3. Using watch only wallet, command import_key_images <filename>*. The watch wallet is now aware of spent status for each output and it shows the correct balance (unless something new was received in the meantime, after step 1.

--- Stop here if you only want to monitor the balance with the watch only wallet. Goto 1. after each newly received funds. Continue for cold spending. ---

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.