Guest User

Untitled

a guest
Apr 24th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. func getLatestTxs() map[string]interface{}{} {
  2. fmt.Println("hello")
  3. resp, err := http.Get("http://api.etherscan.io/api?module=account&action=txlist&address=0x266ac31358d773af8278f625c4d4a35648953341&startblock=0&endblock=99999999&sort=asc&apikey=5UUVIZV5581ENPXKYWAUDGQTHI956A56MU")
  4. defer resp.Body.Close()
  5. body, _ := ioutil.ReadAll(resp.Body)
  6. if err != nil {
  7. fmt.Errorf("etherscan访问失败")
  8. }
  9. ret := map[string]interface{}{}
  10. json.Unmarshal(body, &ret)
  11. if ret["status"] == 1 {
  12. return ret["result"]
  13. }
  14. }
Add Comment
Please, Sign In to add comment