bnb-chain / tss-lib

Threshold Signature Scheme, for ECDSA and EDDSA
MIT License
790 stars 271 forks source link

how to derive eddsa method #298

Closed malingzhao closed 3 months ago

malingzhao commented 3 months ago

nc DeriveChildKeyFromHierarchy(indicesHierarchy []uint32, pk ExtendedKey, mod big.Int, curve elliptic.Curve) (big.Int, ExtendedKey, error) { var k = pk var err error var childKey *ExtendedKey mod := common.ModInt(mod) ilNum := big.NewInt(0) for index := range indicesHierarchy { ilNumOld := ilNum ilNum, childKey, err = DeriveChildKey(indicesHierarchy[index], k, curve) if err != nil { return nil, nil, err } k = childKey ilNum = mod.Add(ilNum, ilNumOld) } return ilNum, k, nil }

how the eddsa derive

malingzhao commented 3 months ago

and hot adjust the eddsa signing code

felicityin commented 3 months ago

I just submitted a PR, hoping it will be helpful: https://github.com/bnb-chain/tss-lib/pull/299

malingzhao commented 3 months ago

thank you very much

felicityin commented 3 months ago

You need to adjust the public keys like ecdsa does: https://github.com/bnb-chain/tss-lib/blob/master/ecdsa/signing/local_party_test.go#L249

You also need to adjust the private key like ecdsa does: https://github.com/bnb-chain/tss-lib/blob/master/ecdsa/signing/round_1.go#L129