0

I have already created a multi-sig address with funds, and I have already made transactions (2 of 4 Signatures needed). No problem.

But I want to add it to one of my accounts, or a new account, so I can watch the balance. Currently I have to use the Block Explorer to find balance and tx-information.

Do I use: importpubkey or importaddress or something else? I cannot figure out how.

The command setaccount gives me the "this address does not belong to you".

1 Answer 1

1

I believe importaddress is the command you're looking for: Bitcoin RPC Documentation

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/
5
  • Thank you for the answer, but I have tried this countless times. The balance of the multisig-address doesn't appear when I list accounts nor getbalance of account. The "Label" is supposed to become the name of the account, right? Nothing happens :/ Please help more if you can.
    – Rouse
    Aug 9, 2018 at 22:33
  • I tried "bitcoin-cli listaccounts 0 true" now, and now I can see the new account I made that reads the multisig-address balance! But it shows a balance which is 0.120005. And the default account named "" shows negative amount of -0.100005. The correct amount is 0.120005 - 0.100005 = 0.020000 ... Why is it doing that, and how do I make it show the normal balance?
    – Rouse
    Aug 9, 2018 at 23:06
  • Try 'getbalance "account" 0 true'
    – JBaczuk
    Aug 9, 2018 at 23:11
  • Also, see stackoverflow.com/q/22237621/3499115
    – JBaczuk
    Aug 9, 2018 at 23:22
  • That "getbalance" only gives the same result which is 0.120005, which I checked shows exactly the same as "getreceivedbyaccount" and "getreceivedbyaddress". It doesn't make sense that the default "" account shows negative number of actually what is "totalsent".
    – Rouse
    Aug 9, 2018 at 23:23

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.