API to get Ethereum Smart Contract Events
Tags: product, tutorial, bitqueryapis
Published: 2020-10-14 09:30:47

---
title: API to get Ethereum Smart Contract Events
published: true
date: 2020-10-05 09:06:00 UTC
tags: Product,Tutorial,bitqueryapis
canonical_url: https://bitquery.io/blog/ethereum-events-api?utm_source=rss&utm_medium=rss&utm_campaign=ethereum-events-api
---

As we know Ethereum blockchain only output events and transactions. Therefore, events provide very important insights into smart contract activities.

However, extracting, storing, and indexing these events can be troublesome for many developers.

Therefore, we provide [Blockchain GraphQL APIs](https://bitquery.io/labs/graphql) to get events data for any Ethereum smart contract.

In this article, we will see how to get smart contract events from famous Ethereum protocols using Bitquery GraphQL API.

## **Tether denylist and destroying funds for denylisted users**

[Tether (USDT) stablecoin smart contract](https://explorer.bitquery.io/ethereum/token/0xdac17f958d2ee523a2206206994597c13d831ec7) has a mechanism to embargo addresses and destroyed funds of those addresses by simply subtracting the balance from the total supply.

![](https://cdn-images-1.medium.com/max/880/1*1ohoBFaH4xY6MIW-zfTlwQ.png)

Every time Tether bans a user, it will emit an “AddBlackList” event. Using the following query you can get these events.

```
{
 ethereum {
 smartContractEvents(options: {desc: "block.height", limit: 10},
 smartContractEvent: {is: "AddedBlackList"},
 smartContractAddress: 
 {is: "0xdac17f958d2ee523a2206206994597c13d831ec7"}) {
 block {
 height
 timestamp {
 iso8601
 unixtime
 }
 }
 arguments {
 value
 argument
 }
 }
 }
}
```

If you also want to know about the destroyed USDT funds of embargoed users. You can track the “DestroyedBlackFunds” event.

```
{
 ethereum {
 smartContractEvents(options: {desc: "block.height", limit: 10},
 smartContractEvent: {is: "DestroyedBlackFunds"},
 smartContractAddress: 
 {is: "0xdac17f958d2ee523a2206206994597c13d831ec7"}) {
 block {
 height
 timestamp {
 iso8601
 unixtime
 }
 }
 arguments {
 value
 argument
 }
 }
 }
}
```

## Tracking ENS registrations

If you want to know the newly registered ENS domains, you can track the “NameRegistered” event of the [ENS Base Registrar smart contract](https://explorer.bitquery.io/ethereum/token/0xdac17f958d2ee523a2206206994597c13d831ec7) by using the query below.

```
{
 ethereum {
 smartContractEvents(options: {desc: "block.height", limit: 10},
 smartContractEvent: {is: "NameRegistered"},
 smartContractAddress: 
 {is: "0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85"}) {
 block {
 height
 timestamp {
 iso8601
 unixtime
 }
 }
 arguments {
 value
 argument
 }
 }
 }
}
```

## Tracking Aave Flash loans

Interested in flash loans? use the following query to get the latest FlashLoan events emitted by the Aave’s [Lending pool smart contract](https://explorer.bitquery.io/ethereum/smart_contract/0x398ec7346dcd622edc5ae82352f02be94c62d119). 

```
{
 ethereum {
 smartContractEvents(options: {desc: "block.height", limit: 10},
 smartContractEvent: {is: "FlashLoan"},
 smartContractAddress: 
 {is: "0x398eC7346DcD622eDc5ae82352F02bE94C62d119"}) {
 block {
 height
 timestamp {
 iso8601
 unixtime
 }
 }
 eventIndex
 arguments {
 value
 argument
 }
 }
 }
}
```

## Uniswap’s newly created Pools/Pools

Want to know about newly created Uniswap pools/pairs? Use the query below to track the “PairCreated” event emitted by the [Uniswap Factory smart contract](https://explorer.bitquery.io/ethereum/smart_contract/0x5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f).

```
{ ethereum { smartContractEvents(options: {desc: "block.height", limit: 10}, smartContractEvent: {is: "PairCreated"}, smartContractAddress: {is: "0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f"}) { block { height timestamp { iso8601 unixtime } } eventIndex arguments { value argument } } } }
```

If you have any questions, you can ask them on our [Telegram channel](https://t.me/Bloxy_info). Also, let us know if you are looking for blockchain data APIs.

You might also be interested in:

- [Why GraphQL is better for blockchain data APIs](https://bitquery.io/blog/blockchain-graphql)
- [APIs to get Latest Uniswap Pair Listing](https://bitquery.io/blog/uniswap-pool-api)
- [Simple rest APIs to get Uniswap data (DEX Data APIs)](https://bitquery.io/blog/dex-data-apis)
- [API to Get Ethereum Token Balance](https://bitquery.io/blog/etheruem-token-api)
- [Simple API To Get Ethereum Supply And Data](https://bitquery.io/blog/get-ethereum-total-supply)
- [Who is actually using Ethereum?](https://bitquery.io/blog/who-is-actually-using-ethereum)

#### **About** Bitquery

[**Bitquery**](https://bitquery.io/?source=blog&utm_medium=about_coinpath) is a set of software tools that parse, index, access, search, and use information across blockchain networks in a unified way. Our products are:

- **[Coinpath®](https://bitquery.io/products/coinpath?utm_source=blog) APIs** provide [blockchain money flow analysis](https://blog.bitquery.io/coinpath-blockchain-money-flow-apis) for more than 24 blockchains. With Coinpath’s APIs, you can monitor blockchain transactions, investigate crypto crimes such as bitcoin money laundering, and create crypto forensics tools. Read [this to get started with Coinpath®](https://blog.bitquery.io/coinpath-api-get-start).

- **[Digital Assets API](https://bitquery.io/products/digital_assets?utm_source=blog&utm_medium=about)** provides index information related to all major cryptocurrencies, coins, and tokens. 

- **[DEX API](https://bitquery.io/products/dex?utm_source=blog&utm_medium=about)** provides real-time deposits and transactions, trades, and other related data on different DEX protocols like Uniswap, Kyber Network, Airswap, Matching Network, etc.

If you have any questions about our products, ask them on our [Telegram channel](https://t.me/Bloxy_info) or email us at [hello@bitquery.io](mailto:hello@bitquery.io). Also, subscribe to our newsletter below, we will keep you updated with the latest in the cryptocurrency world.

The post [API to get Ethereum Smart Contract Events](https://bitquery.io/blog/ethereum-events-api) appeared first on [Bitquery](https://bitquery.io).