Cronos (CRO) APIs | Transfers, Trades, Tokens & DEX

Cronos (CRO) APIs | Transfers, Trades, Tokens & DEX

Table of Contents

  1. What is Cronos?
  2. Top Tokens Trades
  3. Latest Trades
  4. Get Cronos DEXs - Names & Trades
  5. Monthly Transactions & Gas
  6. Smart Contracts Analytics
  7. Monthly Transfer Count
  8. Ethereum Compatible (Bitquery)
  9. Queries Links

What is Cronos?

Cronos is the first blockchain network that interoperates with both the Ethereum and Cosmos ecosystems, supporting DeFi, NFTs, and the metaverse. It aims to massively scale the Web3 user community by providing builders with the ability to instantly port apps and crypto assets from other chains with low cost, high throughput, and fast finality.

In this article we will see how to get some data, but remember, Bitquery is much more powerful than that! Note that Cronos in Bitquery works almost the same as Ethereum, so if you have already used our APIs, you will be able to use Cronos just fine.

Top Tokens Trades

Now we will use a query to get the most popular tokens, we will do this by filtering by the tokens with the most transfers!

{
  ethereum(network: cronos) {
    transfers(options: {desc: "count", limit: 20}) {
      currency {
        symbol
        address
      }
      count
      senders: count(uniq: senders)
      receivers: count(uniq: receivers)
      days: count(uniq: dates)
      from_date: minimum(of: date)
      till_date: maximum(of: date)
      amount
    }
  }
}

Example output (formatted for clarity):

- Currency symbol: CRO
- Count: 34212849
- Senders: 659040
- Receivers: 812937
- Days: 382
- From date: 2021-11-08
- Till date: 2022-11-24
- Amount: 113090504925

Latest Trades

In this query we will use the dexTrades API, we will filter by the block height and the trade index, that way we will get the last trade based on the date.

{
  ethereum(network: cronos) {
    dexTrades(
      options: {desc: ["block.height", "tradeIndex"], limit: 10}
      date: {since: null, till: null}
    ) {
      block {
        timestamp {
          time(format: "%Y-%m-%d %H:%M:%S")
        }
        height
      }
      tradeIndex
      protocol
      exchange {
        fullName
      }
      smartContract {
        address {
          address
        }
      }
      buyAmountInUSD: buyAmount(in: USD)
      buyCurrency {
        address
        symbol
      }
      sellAmountInUSD: sellAmount(in: USD)
      sellCurrency {
        address
        symbol
      }
      transaction {
        hash
      }
    }
  }
}

Example output (formatted for clarity):

Protocol: Uniswap v2
Full name: Uniswap v2
Smart contract Address: 0xbf62c67ea509e86f07c8c69d0286c0636c50270b
Tx Hash: 0x97a78d49d70590514ac79274a582358f62e27c4d500dc6a406aa3f7d1bb2d391
And trade data.

Get Cronos DEXs - Names & Trades

With the query we will use now we will get some DEXs that exist in Cronos, along with the name, trades and total transfers for each month. Remember that the Uniswap protocol can exist in any compatible evm chain.

{
  ethereum(network: cronos) {
    dexTrades(
      options: {desc: "tradeAmount"}
      date: {since: "2021-11-08", till: "2022-11-23"}
    ) {
      date: date {
        date(format: "%Y-%m")
      }
      exchange {
        fullName
      }
      count
      tradeAmount(in: USD)
    }
  }
}

Example output (formatted for clarity):

Full name: Uniswap v2
Count: 1395618
Trade Amount: 345340948
Date: 2021-11

Monthly Transactions & Gas

Now with this query we will obtain the amount of transactions as well as the gas that has been spent, all this by months. This can be very useful to create graphs with our widgets!

{
  ethereum(network: cronos) {
    transactions(options: {asc: "date.date"}, date: {since: "2021-11-08"}) {
      date {
        date(format: "%y-%m")
      }
      count: count
      gasValue
    }
  }
}

Example output (formatted for clarity):

Date: 21-11
Count: 3928882
Gas Value: 2948394

Smart Contracts Analytics

With this query we will obtain the number of contracts created, the callers, the calls to the methods and clearly the date!

{
  ethereum(network: cronos) {
    smartContractCalls(
      options: {asc: "date.date"}
      date: {since: "2021-11-08", till: "2022-11-23"}
    ) {
      date: date {
        date(format: "%Y-%m")
      }
      count: count
      contracts: count(uniq: smart_contracts)
      callers: count(uniq: senders)
      methods: count(uniq: smart_contract_methods)
    }
  }
}

Example output (formatted for clarity):

Date: 2021-11
Count: 28342288
Contracts: 6503
Callers: 106965
Methods: 1156

Monthly Transfer Count

Here we will get all transactions that have been made since the specified month!

{
  ethereum(network: cronos) {
    transfers(options: {asc: "date.date"}, date: {since: "2021-11-08"}) {
      date {
        date(format: "%y-%m")
      }
      transfer_count: count
    }
  }
}

Example output (formatted for clarity):

Date: 21-11
Transfer Count: 12251473

Ethereum Compatible (Bitquery)

Yes, you have read correctly, the scheme that exists for chrono is identical to that of ethereum, what does this mean? That if in our IDE you are looking for a query for Cronos but it is only for Ethereum, most probably you will be able to copy that query to make it work in Cronos!

Queries Links

About Bitquery

Bitquery 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® APIs provide blockchain money flow analysis 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®.
  • Digital Assets API provides index information related to all major cryptocurrencies, coins, and tokens.
  • DEX API 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, Discord or email us at hello@bitquery.io. Also, subscribe to our newsletter below, we will keep you updated with the latest in the cryptocurrency world.

1 Like