Created
September 7, 2017 09:52
-
-
Save raza-basit/6d623dd05f748ded30a6538875d39f1c to your computer and use it in GitHub Desktop.
Get List of accounts in ethereum node 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_listAccounts", "params":[], "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