github.com/status-im/status-go@v1.1.0/account/address.go (about) 1 package account 2 3 import ( 4 "github.com/status-im/status-go/eth-node/crypto" 5 "github.com/status-im/status-go/eth-node/types" 6 ) 7 8 func CreateAddress() (address, pubKey, privKey string, err error) { 9 key, err := crypto.GenerateKey() 10 if err != nil { 11 return "", "", "", err 12 } 13 14 privKeyBytes := crypto.FromECDSA(key) 15 pubKeyBytes := crypto.FromECDSAPub(&key.PublicKey) 16 addressBytes := crypto.PubkeyToAddress(key.PublicKey) 17 18 privKey = types.EncodeHex(privKeyBytes) 19 pubKey = types.EncodeHex(pubKeyBytes) 20 address = addressBytes.Hex() 21 22 return 23 }