0

After adding watch only address to my bitcoin core and perform some transaction that make my watch only address balance to 0, but when i run getbalance and listaccount with watch only is true, my watch only address still have coin. Only listunspent address show that my watch only address dont have any fund to spend more.

So any idea to sync my balance for watch only address ?

1 Answer 1

1

Using importaddress you can sync your balance for watch only address with rescan set to true:

importaddress "address" ( "label" rescan p2sh )

Adds a script (in hex) or address that can be watched as if it were in your wallet but cannot be used to spend. Requires a new wallet backup.

Arguments:
1. "script"           (string, required) The hex-encoded script (or address)
2. "label"            (string, optional, default="") An optional label
3. rescan               (boolean, optional, default=true) Rescan the wallet for transactions
4. p2sh                 (boolean, optional, default=false) Add the P2SH version of the script as well

Note: This call can take minutes to complete if rescan is true, during that time, other rpc calls
may report that the imported address exists but related transactions are still missing, leading to temporarily incorrect/bogus balances and unspent outputs until rescan completes.
If you have the full public key, you should call importpubkey instead of this.

Note: If you import a non-standard raw script in hex form, outputs sending to it will be treated
as change, and not show up in many RPCs.

Examples:

Import a script with rescan
> bitcoin-cli importaddress "myscript"

Import using a label without rescan
> bitcoin-cli importaddress "myscript" "testing" false

As a JSON-RPC call
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "importaddress", "params": ["myscript", "testing", false] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/
2
  • you mean that i have to re importaddress again ? So i have to importaddress again every time when my watch only address balance change to sync new data ?
    – redondoxx
    Oct 16, 2018 at 5:08
  • One time only, if you need to get previous transactions/balance of watch-only address then rescan set to true else the future transactions/balance will auto sync for watch-only addresses. You can check with testnet
    – Shahbaz
    Oct 16, 2018 at 7:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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