strangelove-ventures / horcrux

A threshold Tendermint signer
Apache License 2.0
272 stars 93 forks source link

reconstruct priv_validator_key.json #249

Open danbryan opened 10 months ago

danbryan commented 10 months ago

It would be nice if horcrux would allow you to reconstruct priv_validator_key.json from shards.

horcrux create-priv_validator_key --chain-id blah  --threshold 2 --shards 3
akc2267 commented 9 months ago

this would be a great first story to ramp up on horcrux

nitronit commented 9 months ago

@akc2267 and @danbryan.

AFAIK it its impossible to recreate the priv_validator_key.json (the 'seed') as it was before creating shards.

If you look at https://github.com/strangelove-ventures/horcrux/blob/54beead80f63c7c8407674d112363cb752a13c61/signer/cosigner_key_shares.go#L27

What actually is splited is not the seed, its the expanded key. Since the expanded key involves hashing (sha512 in this case) its impossible to convert the splitted keys to the seed.

However it should be fairly trivial to recover the expanded key.