aptos-core
aptos-core copied to clipboard
[Bug]Why do not mod parent Private
🐛 Bug
export const CKDPriv = ({ key, chainCode }: Keys, index: number): Keys => {
const buffer = new ArrayBuffer(4);
new DataView(buffer).setUint32(0, index);
const indexBytes = new Uint8Array(buffer);
const zero = new Uint8Array([0]);
const data = new Uint8Array([...zero, ...key, ...indexBytes]);
const I = hmac.create(sha512, chainCode).update(data).digest();
const IL = I.slice(0, 32);
const IR = I.slice(32);
return {
key: IL,
chainCode: IR,
};
};
but bitcoin use parentPriv.add(newPriv).mod(ECKey.CURVE.getN());
If submitting a bug report, please tell us in detail what the bug is.
"But Bitcoin uses [...]" does not qualify as a bug report.
Note that we are not Bitcoin: we do not use ECDSA signatures over secp256k1 curves. We used Ed25519 signatures. HD wallets for Ed25519 operate slightly differently than HD wallets for Bitcoin.
Aptos HD wallet generation rules are different from Bitcoin generation rules