9/18/2023 0 Comments Ethereum public key from addressSince the public key is derived from the private key, go- ethereum's crypto private key has a Public method that will return the public key. This is the private key which is used for signing transactions and is to be treated like a password and never be shared, since who ever is in possesion of it will have access to all your funds. Then we strip of the 0x after it's hex encoded. We can now convert it to a hexadecimal string by using the go- ethereum hexutil package which provides the Encode method which takes a byte slice. privateKeyBytes := crypto.FromECDSA(privateKey) Then we can convert it to bytes by importing the golang crypto/ecdsa package and using the FromECDSA method. To generate a new wallet first we need to import the go- ethereum crypto package that provides the GenerateKey method for generating a random private key.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |