Skip to content
This repository has been archived by the owner on Jan 21, 2022. It is now read-only.

Example Use Cases

Akhila Raju edited this page Jul 19, 2018 · 15 revisions

Get the amount of gas expended in each transaction sent from address "0xF5bd64885c1330994Ca1E51c003916F3278A8bE9" in block 5000000.

{
  block(number: 5000000) {
    transactionsRoles(from:"0xF5bd64885c1330994Ca1E51c003916F3278A8bE9") {
      gasPrice
    }
  }
}

Account storage

Logs -> Transactions with Logs -> topics and decoded log information.

.

.

Fetch all transactions from block 5000000 that have input data, and for those that can be decoded as token transfers, return the token symbol, sending and receiving addresses, as well as the token balance of the sending address.

{
  block(number: 5000000) {
    hash
    transactions(filter: { withInput: true }) {
      index
      hash
      from {
        address
      }
      to {
        address
      }
      decoded {
        ... on ERC20Transfer {
          tokenContract {
            symbol
          }
          from {
            account {
            	address
            }
            tokenBalance
          }
          to {
            account {
              address
            }
          }
          value
        }
      }
    }
  }
}

For all blocks between 5400000 and 5400005 inclusive (6 blocks), get the balance of all addresses that sent a transaction.

{
  blocksRange(numberRange: [5400000, 5400005]) {
    transactions {
      hash
      value
      from {
        address
        balance
      }
      to {
        address
      }
    }
  }
}