十、Sample Code

接口调用示例代码

1、调用V2版地址风险检测接口

Python版

import requests

url = "https://openapi.chaineyes.com/openapi/v2/risk/address/check?api_key=a0876......bb6f&network=Ethereum&address=0x53......a920b&coin=eth&app_id=6491......21qa&address_role=to"

payload = {}
headers = {
  'sign': '8a96......1911',
  'timestamp': '1697788140'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

Golang版

package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://openapi.chaineyes.com/openapi/v2/risk/address/check?api_key=a0876......bb6f&network=Ethereum&address=0x53......a920b&coin=eth&app_id=6491......21qa&address_role=to"
  method := "GET"

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, nil)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("sign", "8a96......1911")
  req.Header.Add("timestamp", "1697788140")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}

2、调用V2版交易风险检测接口

Python版

Golang版

Last updated