Created
September 7, 2017 09:53
-
-
Save raza-basit/8ca5aa72975b1341b405177923e7eb8d to your computer and use it in GitHub Desktop.
Creating ethereum account using golang
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var callOptions = []byte(`{"jsonrpc": "2.0", "method":"personal_newAccount", "params":["yourpassword"], "id":"1"}`) | |
req, err := http.NewRequest("post", "http://localhost:8545/", bytes.NewBuffer(callOptions)) | |
if err != nil { | |
log.Fatal(err) | |
} | |
client := &http.Client{} | |
resp, err := client.Do(req) | |
if err != nil { | |
log.Fatal(err) | |
} | |
defer resp.Body.Close() | |
body, _ := ioutil.ReadAll(resp.Body) | |
log.Println(string(body)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment