Get Event Logs by Address and Topics
curl --request GET \
--url 'https://api.etherscan.io/v2/api?apikey='import requests
url = "https://api.etherscan.io/v2/api?apikey="
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.etherscan.io/v2/api?apikey=', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.etherscan.io/v2/api?apikey=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.etherscan.io/v2/api?apikey="
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.etherscan.io/v2/api?apikey=")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.etherscan.io/v2/api?apikey=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"status": "1",
"message": "OK",
"result": [
{
"address": "0x59728544b08ab483533076417fbbb2fd0b17ce3a",
"topics": [
"0x27c4f0403323142b599832f26acd21c74a9e5b809f2215726e244a4ac588cd7d",
"0x00000000000000000000000023581767a106ae21c074b2276d25e5c3e136a68b",
"0x000000000000000000000000000000000000000000000000000000000000236d",
"0x000000000000000000000000c8a5592031f93debea5d9e67a396944ee01bb2ca"
],
"data": "0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000f207539952d0000",
"blockNumber": "0xe60262",
"blockHash": "0xb40d77b4ffba5ae2a38cbc87a65a6c9b56f9af5d8bf320aa1f1b6af00b850778",
"timeStamp": "0x62c26caf",
"gasPrice": "0x5e2d742c9",
"gasUsed": "0xfb7f8",
"logIndex": "0x4b",
"transactionHash": "0x26fe1a0a403fd44ef11ee72f3b4ceff590b6ea533684cb279cb4242be463304c",
"transactionIndex": "0x39"
},
{
"address": "0x59728544b08ab483533076417fbbb2fd0b17ce3a",
"topics": [
"0x27c4f0403323142b599832f26acd21c74a9e5b809f2215726e244a4ac588cd7d",
"0x00000000000000000000000023581767a106ae21c074b2276d25e5c3e136a68b",
"0x0000000000000000000000000000000000000000000000000000000000002261",
"0x000000000000000000000000c8a5592031f93debea5d9e67a396944ee01bb2ca"
],
"data": "0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000de0b6b3a7640000",
"blockNumber": "0xe6035b",
"blockHash": "0x5a46aeca5eaf8af1fbf56439b12dfea8fb27d18ca31020cc723271e119cffc04",
"timeStamp": "0x62c27ab1",
"gasPrice": "0x27e523173",
"gasUsed": "0x3b86e",
"logIndex": "0x1d7",
"transactionHash": "0x3a299413cf2c91e376e542efcf3fc308c562da79af6e992401217cc6208c7f74",
"transactionIndex": "0x92"
}
]
}
Logs
Get Event Logs by Address and Topics
Retrieves event logs from a specified address, filtered by topics and block range.
GET
/
v2
/
api
Get Event Logs by Address and Topics
curl --request GET \
--url 'https://api.etherscan.io/v2/api?apikey='import requests
url = "https://api.etherscan.io/v2/api?apikey="
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.etherscan.io/v2/api?apikey=', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.etherscan.io/v2/api?apikey=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.etherscan.io/v2/api?apikey="
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.etherscan.io/v2/api?apikey=")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.etherscan.io/v2/api?apikey=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"status": "1",
"message": "OK",
"result": [
{
"address": "0x59728544b08ab483533076417fbbb2fd0b17ce3a",
"topics": [
"0x27c4f0403323142b599832f26acd21c74a9e5b809f2215726e244a4ac588cd7d",
"0x00000000000000000000000023581767a106ae21c074b2276d25e5c3e136a68b",
"0x000000000000000000000000000000000000000000000000000000000000236d",
"0x000000000000000000000000c8a5592031f93debea5d9e67a396944ee01bb2ca"
],
"data": "0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000f207539952d0000",
"blockNumber": "0xe60262",
"blockHash": "0xb40d77b4ffba5ae2a38cbc87a65a6c9b56f9af5d8bf320aa1f1b6af00b850778",
"timeStamp": "0x62c26caf",
"gasPrice": "0x5e2d742c9",
"gasUsed": "0xfb7f8",
"logIndex": "0x4b",
"transactionHash": "0x26fe1a0a403fd44ef11ee72f3b4ceff590b6ea533684cb279cb4242be463304c",
"transactionIndex": "0x39"
},
{
"address": "0x59728544b08ab483533076417fbbb2fd0b17ce3a",
"topics": [
"0x27c4f0403323142b599832f26acd21c74a9e5b809f2215726e244a4ac588cd7d",
"0x00000000000000000000000023581767a106ae21c074b2276d25e5c3e136a68b",
"0x0000000000000000000000000000000000000000000000000000000000002261",
"0x000000000000000000000000c8a5592031f93debea5d9e67a396944ee01bb2ca"
],
"data": "0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000de0b6b3a7640000",
"blockNumber": "0xe6035b",
"blockHash": "0x5a46aeca5eaf8af1fbf56439b12dfea8fb27d18ca31020cc723271e119cffc04",
"timeStamp": "0x62c27ab1",
"gasPrice": "0x27e523173",
"gasUsed": "0x3b86e",
"logIndex": "0x1d7",
"transactionHash": "0x3a299413cf2c91e376e542efcf3fc308c562da79af6e992401217cc6208c7f74",
"transactionIndex": "0x92"
}
]
}
{
"status": "1",
"message": "OK",
"result": [
{
"address": "0x59728544b08ab483533076417fbbb2fd0b17ce3a",
"topics": [
"0x27c4f0403323142b599832f26acd21c74a9e5b809f2215726e244a4ac588cd7d",
"0x00000000000000000000000023581767a106ae21c074b2276d25e5c3e136a68b",
"0x000000000000000000000000000000000000000000000000000000000000236d",
"0x000000000000000000000000c8a5592031f93debea5d9e67a396944ee01bb2ca"
],
"data": "0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000f207539952d0000",
"blockNumber": "0xe60262",
"blockHash": "0xb40d77b4ffba5ae2a38cbc87a65a6c9b56f9af5d8bf320aa1f1b6af00b850778",
"timeStamp": "0x62c26caf",
"gasPrice": "0x5e2d742c9",
"gasUsed": "0xfb7f8",
"logIndex": "0x4b",
"transactionHash": "0x26fe1a0a403fd44ef11ee72f3b4ceff590b6ea533684cb279cb4242be463304c",
"transactionIndex": "0x39"
},
{
"address": "0x59728544b08ab483533076417fbbb2fd0b17ce3a",
"topics": [
"0x27c4f0403323142b599832f26acd21c74a9e5b809f2215726e244a4ac588cd7d",
"0x00000000000000000000000023581767a106ae21c074b2276d25e5c3e136a68b",
"0x0000000000000000000000000000000000000000000000000000000000002261",
"0x000000000000000000000000c8a5592031f93debea5d9e67a396944ee01bb2ca"
],
"data": "0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000de0b6b3a7640000",
"blockNumber": "0xe6035b",
"blockHash": "0x5a46aeca5eaf8af1fbf56439b12dfea8fb27d18ca31020cc723271e119cffc04",
"timeStamp": "0x62c27ab1",
"gasPrice": "0x27e523173",
"gasUsed": "0x3b86e",
"logIndex": "0x1d7",
"transactionHash": "0x3a299413cf2c91e376e542efcf3fc308c562da79af6e992401217cc6208c7f74",
"transactionIndex": "0x92"
}
]
}
Authorizations
Enter your Etherscan API key, or set one up if you don't have one.
Query Parameters
Chain ID to query, eg 1 for Ethereum, 42161 for Arbitrum from our supported chains.
Response
200 - application/json
Successful response
OK on success, otherwise an error description such as NOTOK. See common error messages.