bnb-chain / tss-lib

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

KEYGEN sometimes giving 63byte instead of 64byte #278

Closed 21fahm closed 1 year ago

21fahm commented 1 year ago

To derive keys for ethereum we need the x and y coordinates to be 64byte long. Sometimes keygen is outputing 63byte.

pk := ecdsa.PublicKey{
    Curve: tss.S256(),
    X:     save.ECDSAPub.X(),
    Y:     save.ECDSAPub.Y(),
}
pubKey = pk.X.String() + pk.Y.String()
//After hex:(I have added `0x04. You can ignore`)
`0x0416c762ed0e6c96cbc284ccfdcad9b4d918201acc4e440ee5f35cc746ea9c818812f952d93fe3f769b8e0100f6afb1e7900ec9bdb42476d5798d0a0074be71f1a9`

This cannot go though hashing and slicing to provide a valid ethereum address,because of public key. Kindly assist

21fahm commented 1 year ago

Issue was how i was converting. Padding is also required sometimes. Pubkey is okay!