BlockchainCommons / GordianSeedTool-iOS

Cryptographic Seed Manager for iOS
Other
36 stars 8 forks source link

Support fingerprints on descriptors #145

Closed ChristopherA closed 2 years ago

ChristopherA commented 2 years ago

For reference, Sparrow has this descriptor for the Yimn Blue test seed when used as a segwit '84 account.

wpkh([604b93f2/84h/0h/0h]xpub6DVfq9VduocgjGeR69Nyr8CCi9w5gywnU7wXMYGswpHjffjcbLYNzz6G6555VDcSZLDwZPzJHJQabVWWgkpvYntpunL3UjHGrkCJ6VndbQf/<0;1>/*)#8hmvszgp

A) I believe the #8hmvszgp is the unique fingerprint for this account. If it is truly unique, we need to start using it.

B) We should document this and support it when saving account descriptors to text.

shannona commented 2 years ago

That's the checksum:

https://github.com/bitcoin/bitcoin/blob/master/doc/descriptors.md#checksums

I don't think there's any guarantee it's unique. It's just meant to detect errors in transmission.

It can be calculated using the bitcoin-core getdescriptorinfo RPC call.

shannona commented 2 years ago

Here's a function for the checksum: https://github.com/bitcoin/bitcoin/blob/master/src/script/descriptor.cpp#L95

wolfmcnally commented 2 years ago

Fixed in next beta release.

shannona commented 2 years ago

The checksum now shows up on all output descriptors.

ChristopherA commented 2 years ago

@shannona can you verify the results are same in Sparrow?

shannona commented 2 years ago

As far as I've been able to tell, Sparrow doesn't output descriptors.

The gold standard would be to test against getdescriptorinfo in bitcoin-cli. I can spin up an instance to check, it'll just take a bit.

shannona commented 2 years ago

Running through the descriptors on bitcoin-cli:

The three Cosigner descriptors are not checkable because Bitcoin Core does not recognize the "cosigner" function in descriptors:

error code: -5
error message:
A function is needed within P2SH

I in fact can't find cosigner documented anywhere as a valid descriptor, not even in more extensive uses such BDK. @wolfmcnally can you reference where it came from and how standard it is?

In any case, this should be closed, but I want to make sure the compatibility question of the cosigner function is addressed by us.