Author

Topic: chain code validator (Read 106 times)

newbie
Activity: 23
Merit: 2
November 07, 2021, 03:37:06 PM
#6
OK looks like what I thought was a chain code is probably a random serial key. I'm going to leave it, I think I never had any bitcoin in the first place to be honest. Thanks for everyone's help.
newbie
Activity: 23
Merit: 2
November 05, 2021, 05:26:22 AM
#5
OK I really appreciate your help. I'm going to have to try remember the chain code as I did the root key.

Thank you
legendary
Activity: 3640
Merit: 1345
Armory Developer
November 05, 2021, 04:14:21 AM
#4
Quote
By using only the root key in the restore process does that in itself prove the balance is zero?

The chaincode is an integral part of how the addresses are generated, you cant skip it.

Quote
You mention recreating the chain code from 2 consecutive private keys, but I thought that it was random in the old style wallet.

The chaincode is unique and static for the lifetime of a wallet. 1.35c derives the chaincode from the root key, older versions pull 32 random bytes and use that instead. The chaincode is then used to generate key pairs on the chain.

Im not gonna delve in the math but basically to get the privkey N+1, you multiply privkey N by the chaincode. You do the same operation with the public keys. EC maths makes it so that pubkey N will match privkey N, even if you generated pubkey N without ever having knowledge of any private key (that's how we can have deterministic watching only wallets).

You cannot divide public keys because that operation does not exist in EC math, so you can't reveal the chaincode by looking at pubkey N and N+1. You can however do that with 2 consecutive private keys, since they are only scalars:

Code:
priv[N] * chaincode = priv[N+1]
<=>
chaincode = priv[N+1] / priv[N]

Quote
You say there is some way to recreate the chain code?

Unless you have private keys, no. The chaincode for your wallet is a random number, it has no relation to your rootkey, you're going to have to remember it or find an old wallet file with some private keys in it.
newbie
Activity: 23
Merit: 2
November 04, 2021, 03:38:12 PM
#3
Thank you for replying.

So originally I had the old style 4 line wallet.

I lost the paperwork some years ago but managed to remember the root key (I've put this into armory without the chain code and it validates but with an empty wallet I.e zero transaction and zero balance) . Over the last few days I've begun to remember the chain code, I have about 50% of the 72 characters so far.

I will continue to try to remember the chain code, but it's been nearly 10 years so I'm struggling with that. You say there is some way to recreate the chain code?

By using only the root key in the restore process does that in itself prove the balance is zero? Or do I need the chain code for armory to find the right addresses to check for balance?

You mention recreating the chain code from 2 consecutive private keys, but I thought that it was random in the old style wallet.

Thank you for your help, really appreciate it
legendary
Activity: 3640
Merit: 1345
Armory Developer
November 04, 2021, 01:14:56 PM
#2
Quote
also what purpose does the chain code have?

It is clear text data used to generate the address chain. It basically allows the creation of watching only wallets that can derive the addresses without the need to know any private keys.

Quote
i have a partial chain code

What version is your wallet? 1.35c derives the chaincode from the private key. Old versions use a random chaincode. I'm guessing your wallet is of the former kind (4 lines on the backup instead of 2). That said, with either wallet types, if you have 2 consecutive private keys, you can regenerate the chaincode.

Quote
hello, is there any test code that i can run to validate a chain code?

There isn't code per se, you'd have to tell me what information you have and I can point to which calls to use to check the chaincode.
newbie
Activity: 23
Merit: 2
November 03, 2021, 10:07:19 AM
#1
hello, is there any test code that i can run to validate a chain code?

i have a partial chain code, but i don't want to sit at the software and manually input variations of the chain code into the UI, if i can put together a script that can read chain codes from a text file and verify them, that would be awesome.

thank you in advance!

also what purpose does the chain code have?
Jump to: