First of all thanks for all the awesome tools. Especially Andrew Chow and Sjoors Provoost, for my use case.
Now, I´m a little confused. A transaction I sent from a mobile wallet to a watch only wallet in core is not showing.
I am on bitcoin core 0.19.01 on Raspbian , running hwi.py v1.0.3 and using a Trezor One.
The steps i followed:
1. in bitcoin core GUI, create an unencrypted wallet without private keys (i.e. watch only)
2. unlock trezor using pin challenge on wallet.trezor.io
3. export public keys from trezor using HWI
./hwi.py --fingerprint xxxxxx getdescriptors --account 0
returns the expected .json with 1 pkh, 1 sh(wpkh) ,1 wpkh each for receive and internal (change?)
- create .json file to parse as argument to importmulti like so
'[{"range": [0, 1000], "timestamp": "now", "keypool": true, "watchonly": true, "desc": "sh(wpkh([..../0/*...", "internal": false},
{"range": [0, 1000], "timestamp": "now", "keypool": true, "watchonly": true, "desc": "sh(wpkh([..../1/*...", "internal": true}]'
by copy pasting the sh(wpkh lines in the output from getdescriptors
5. run importmulti jsonstring_above --> success and success for both xpub´s
6. rescanblockchain --> found all the addresses previously sent to my trezor, they all start with 3 - all the money is there, the watch only wallet works
SO FAR SO GOOD
- in this wallet, generated a receiving address with default bech32 format (starting with bc1)
- scanned the qr code with mycelium (can send an receive bech32) and sent the transaction (was only a small amount for testing)
- it went into the next block and got confirmed 3-4 times in 10 minutes
- went back to core and ran
rescanblockchain block_height_a_few_hours_back
but there's no new transaction. Core didn't notify me when it hit the mempool or the blockchain.
The send address in mycelium is the same as generated in core. - tried importing the wpkh xpubs to the wallet using importmulti, also success and success, rescanblockchain, but still no sign of the transaction.
So my question: where my money at? :) Can you help please? How can the watch only wallet derive bech32 addresses just by knowing the pubkeys? And why does it not see/report transactions it has created itself? It makes for a strange user experience. Also the fact that the receive address is no showing/verified on the trezor makes it a bit scary process. This seems like the place where scammers would attack a noob like me.
That wallet.trezor.io does not support bech32 receive addresses doesn´t help confidence, altough that's not directly related to my issue I think.
Hope this makes sense. Thanks already for the help!!
Update
Thanks, Andrew! I had to first index the transactions, took a little while. Below is the output of the commands. I am not sure what they mean though.
22:06:56

gettransaction 1f10f68c1c21fbab3ddda0138cfb3dfec55e158f630c56997ea690adaece56e2
22:06:56

Invalid or non-wallet transaction id (code -5)
22:07:14

getrawtransaction 1f10f68c1c21fbab3ddda0138cfb3dfec55e158f630c56997ea690adaece56e2
22:07:14

0100000000010159e285bec79b5287fc82eb200fe460537a3a299ee39b65755a8c61ad8a1443820000000000ffffffff0260e3160000000000160014bb7017605d2c404a9e161ae9a8b8d82166dcee3f9eac1f0000000000160014a38c7bd94c6daf16408338d1b424a1a7635faaf702483045022100deae3ae36d8373cffc4a925ac2ef68e12c855ce6451abcd9f91b651b73fda14602200b72c3b452eb97cb10a766976d3718e516d177e979ed576ba4c661decea90663012102b682a49236776bff9a29b844d4b1234202a628abdb10deab7924d87a682c5c7f00000000
The receive address I created shows in Bitcoin core as bc1qhdcpwcza93qy48skrt563wxcy9ndem3lu43d9r
The Blockstream block explorer shows that this is the address where the transaction was sent: https://blockstream.info/tx/1f10f68c1c21fbab3ddda0138cfb3dfec55e158f630c56997ea690adaece56e2?expand As far as I understand, it checks out.
Any idea why I cannot list it in Bitcoin core in the transactions list?
This is what the command return in core. I don't see the derivation path. Am I missing something obvious? The part with "ismine":false is a little stressful lol. Any idea?
20:33:00

getaddressinfo bc1qhdcpwcza93qy48skrt563wxcy9ndem3lu43d9r
20:33:00

{
"address": "bc1qhdcpwcza93qy48skrt563wxcy9ndem3lu43d9r",
"scriptPubKey": "0014bb7017605d2c404a9e161ae9a8b8d82166dcee3f",
"ismine": false,
"solvable": false,
"iswatchonly": false,
"isscript": false,
"iswitness": true,
"witness_version": 0,
"witness_program": "bb7017605d2c404a9e161ae9a8b8d82166dcee3f",
"ischange": false,
"labels": [
]
}
I unlocked the trezor and tried this in the bash console. Based on what I understood about the displayaddress arguments. The error messages are not clear to me.
$./hwi.py --fingerprint xxxxx displayaddress --path m/49h/0h/0h/1/*
{"error": "('Invalid BIP32 path', 'm/49h/0h/0h/1/*')", "code": -7}
$./hwi.py --fingerprint xxxx displayaddress --desc sh(wpkh([xxxxx/49h/0h/0h]xpub6DQ...../0/0))
bash: syntax error near unexpected token `('
I am still confused.
Why does the Bitcoin Core watch-only wallet not watch transactions that it lists in the 'Receiving Addresses'? Is this the bug you mentioned?
I couldn't find the path that was used to derive the address in
getaddressinfo
output.
But I get something out of the device that makes more sense.
$ ./hwi.py --fingerprint xxxxxx displayaddress --path m/84h/0h/0h/0/0 --wpkh
--> trezor returns a bc1qxxxxxx address that is also in the list seen in Core at 'Receiving addresses'
Same with m/84h/0h/0h/0/1
. But I imported 1000 addresses as you can see in my importmulti
.
Is there any way to find the m/84h/0h/0h/0/n
n-th address that correspond to bc1qhdcpwcza93qy48skrt563wxcy9ndem3lu43d9r? I don't want to have to for-loop 1000 tries with the trezor :D Thanks!
Update The fix with the manual edit worked! No for-loop needed haha. I removed the sh() around wpkh and calculated/replaced the hash as you suggested. Did impotmulti and rescanblockchain and now the bc1 address shows up. Thanks!
Now i have to figure out if the funds are spendable with a trezor.
gettransaction
orgetrawtransaction
work for your transaction?hwi displayaddress
? You can find the derivation path using thegetaddressinfo
RPC. I think this is related to a rescanning bug in Core that I have been unable to nail down.getaddressinfo
output indicates that your wallet isn't actually watching for these addresses. For thedisplayaddress
error, your arguments are incorrect. You have given it the derivation path range that imported. You need to give it a single derivation path likem/49h/0h/0h/1/0
.importmulti
again but changingsh(wpkh()
descriptor you have into awpkh()
? Don't use thewpkh()
given by HWI. Rather take thesh(wpkh())
, remove the beginningsh(
part and the last)
you see. Also remove the checksum (the#....
stuff at the end of the descriptor). You will need to first usegetdescriptorinfo
with that modified descriptor to produce a correct checksum. Then you can import it withimportmulti
.