Open ahsan-arif opened 1 year ago
Hi @ahsan-arif , Were you able to resolve this ?
@ahsan-arif
publicKey, err := c.PublicPoint().MarshalBinary()
if err != nil {
return err
}
pubkeyECDSA, err := crypto.DecompressPubkey(publicKey)
if err != nil {
return err
}
pub := crypto.FromECDSAPub(pubkeyECDSA)
address := crypto.PubkeyToAddress(*pubkeyECDSA).Hex()
fmt.Printf("address: %s\n", address)
fmt.Printf("public key: %s\n", hex.EncodeToString(pub))
crypto package is "github.com/ethereum/go-ethereum/crypto" I hope this helps you.
Hi! I hope you're doing well. I want to generate Ethereum address from the public key and not being able to retrieve it. I read somewhere that the
r.(*cmp.Config).PublicPoint()
function returns the public key, but its output is as follows:If the output shared above is public key how can I generate Ethereum address from it? Also, the output will change after the
CMPRefresh()
function is called. Can you please help me in this regard?