Skip to content

Commit fe18267

Browse files
committed
Added derivation code
1 parent be7bc5e commit fe18267

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Diff for: src/main/java/hello/KeyGenerator.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,15 @@ public KeyGenerator(String masterKey, String chainCode) {
2222
}
2323
this.masterKey = new BigInteger(masterKey,16).toByteArray();
2424
this.chainCode = md.digest(chainCode.getBytes());
25-
25+
2626
generatePrivateKey();
2727
}
2828

2929
private void generatePrivateKey(){
30-
// TODO some derivation here
30+
DeterministicKey dk = HDKeyDerivation.createMasterPrivKeyFromBytes(masterKey,chainCode);
31+
dk = HDKeyDerivation.deriveChildKey(dk,0);
32+
privateKey = dk.getPrivateKeyAsHex();
33+
// System.out.println(dk.getPrivateKeyAsHex());
3134
}
3235

3336
public String getPrivateKey() {

0 commit comments

Comments
 (0)