Skip to content

Instantly share code, notes, and snippets.

@raza-basit
Created September 7, 2017 09:53
Show Gist options
  • Save raza-basit/8ca5aa72975b1341b405177923e7eb8d to your computer and use it in GitHub Desktop.
Save raza-basit/8ca5aa72975b1341b405177923e7eb8d to your computer and use it in GitHub Desktop.
Creating ethereum account using golang
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