Logs
Fetch Ethereum logs for blocks 17000000
to 17000010
.
curl -s --location --request GET \
"https://app.pangea.foundation/v1/api/logs?chains=ETH&from_block=17000000&to_block=17000010" \
--header "Accept: application/jsonstream" \
--header "Accept-Encoding: gzip" --compressed \
--header "Authorization: Basic $PANGEA_AUTH" | jq
Response
[
...
{
"chain": 1,
"block_number": "0x103664a",
"block_hash": "0x5bad63a542b4deebf2d8ba93bf83b98a96ac4693640dfc3c2ccec38c3adc2bf2",
"transaction_index": 253,
"transaction_hash": "0xae76e4d852d8a9d9ebba99787c1ba5859b68bb90a2712cb3e5ce7505a1f8898a",
"log_index": "0x15c",
"address": "0x87870bca3f3fd6335c3f4ce8392d69350b4fa4e2",
"topic0": "0x2b627736bca15cd5381dcf80b0bf11fd197d01a037c52b927a881a10fb73ba61",
"topic1": "0x000000000000000000000000d533a949740bb3306d119cc777fa900ba034cd52",
"topic2": "0x000000000000000000000000e340b00b6b622c136ffa5cff130ec8edcddcb39d",
"topic3": "0x0000000000000000000000000000000000000000000000000000000000000000",
"data": "0x000000000000000000000000b748952c7bc638f31775245964707bcc5ddfabfc000000000000000000000000000000000000000000000009215f570e12dcdd93",
"removed": false
}
]
Filter on events and addresses
The topic0__in
filter can be used to filter on specific log events.
We can obtain the topic0
for the event by hashing the event signature:
cast keccak "Transfer(address,address,uint256)"
0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef
We can also use address__in
to filter the data by a specific contract.
In this example, we get all Transfer
events emitted by the USDT
contract for blocks 17000000
to 17000010
.
curl -s --location --request GET \
"https://app.pangea.foundation/v1/api/logs?chains=ETH&from_block=17000000&to_block=17000010&address__in=0xdac17f958d2ee523a2206206994597c13d831ec7&topic0__in=0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" \
--header "Accept: application/jsonstream" \
--header "Accept-Encoding: gzip" --compressed \
--header "Authorization: Basic $PANGEA_AUTH" | jq
Response
[
...
{
"chain": 1,
"block_number": "0x103664a",
"block_hash": "0x5bad63a542b4deebf2d8ba93bf83b98a96ac4693640dfc3c2ccec38c3adc2bf2",
"transaction_index": 251,
"transaction_hash": "0x3bfa6f89f21a88c03168ca50a9dcf03c9c1b2880c1cb851bc619bbc31dfcfb91",
"log_index": "0x131",
"address": "0xdac17f958d2ee523a2206206994597c13d831ec7",
"topic0": "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"topic1": "0x0000000000000000000000005564ebafeb07df35ed90191593d5c243fb793bd8",
"topic2": "0x000000000000000000000000887bead710f7604e2a8fd9a2fba643065d5e4735",
"topic3": null,
"data": "0x00000000000000000000000000000000000000000000000000000000000f4240",
"removed": false
}
]
Query Parameters
v1/api/logs
chains
: Filters the data by specific blockchain networks.from_block
: Filters the data by a starting block number.to_block
: Filters the data by an ending block number.address__in
: Filters the data by a list of contract addresses.topic0__in
: Filters the data by a list oftopic0
valuestopic1__in
: Filters the data by a list oftopic1
valuestopic2__in
: Filters the data by a list oftopic2
valuestopic3__in
: Filters the data by a list oftopic3
values