keybase / keybase/keybase-issues

Question about cross-checking signatures with Bitcoin blockchain

Open
#2,361 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
899
Forks
40
PR merge metrics
No merged PRs in 30d

Description

It's not exactly an issue, rather a question about encoding used in signatures.
I read a document here https://keybase.io/docs/server_security/merkle_root_in_bitcoin_blockchain
and decided to check the keys.
I write it all in C/C++, but the question is not the language. I tested different libs and checked it with openssl command line tools. The problem is I cannot get this working:

> sig = b64decode(re.compile(r"\n\n((\S|\n)*?)\n=").search(root_desc['sig']).group(1))
> assert (to_addr_hash == hexlify(hash160(sig)))

When I extract the key body from 'sig', decode it with base64, then calculate "hash160" (I guess this is rmd160, but just to get sure I also tried realization of hash160 from bitcoin core code) and then finally convert it to readable hex it turns out not equal to the value I get from blockchain.
I also checked converting from blockchain base58 address to hex on data from the example on the page and it's ok.
Maybe some intermediate encoding is used or I mistook the idea?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the linked Merkle-root document and the expressions involving root_desc['sig'], b64decode, hash160, and to_addr_hash. Reproduce the comparison using the example data and the blockchain address conversion described in the issue. Done means determining whether an intermediate encoding is missing or the documented interpretation is incorrect.

Written by the indexing model from the issue text.

Assessment

Tech stack
blockchain
Domain
blockchain, cryptography
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.