Coder Social home page Coder Social logo

natepappenhagen / etherscan-graphql-api Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 1.0 61.51 MB

A graphQL wrapper for the popular Etherscan.io REST API [Please append '/staging' to server URL in the graphQL playground ]

Home Page: https://z81urwmpq2.execute-api.us-west-2.amazonaws.com/staging

JavaScript 100.00%
graphql-yoga apex-up babel aws graphql

etherscan-graphql-api's Introduction

EtherscanQL

A graphQL wrapper for the popular Etherscan.io REST API.

This implementation uses a single public API key and is limited to 5 req/s

Please append '/staging' to the server URL of the playground or the connection will fail

Once you make it to the graphQL playground and the server is connected you can explore the self-documenting API to start crafting your queries!

To connect to this endpoint with Apollo Client so you can serve some ethereum information on your front end head over to : https://www.apollographql.com/docs/tutorial/client.html

and connect to: https://z81urwmpq2.execute-api.us-west-2.amazonaws.com/staging/

Accounts:

  • Get Ether Balance for a single Address (returned in wei; * 0.000000000000000001 to return ETHER) 👍
  • Get Ether Balance for multiple Addresses in a single call👍
  • Get a list of 'Normal' Transactions By Address👍
  • Get a list of 'Internal' Transactions by Address👍
  • Get "Internal Transactions" by Transaction Hash👍
  • Get a list of "ERC20 - Token Transfer Events" by Address👍
  • Get list of Blocks Mined by Address👍

Contracts:

  • Get Contract ABI for Verified Contract Source Codes👍
  • Get Contract Source Code for Verified Contract Source Code👍

Transactions:

  • [BETA] Check Contract Execution Status (if there was an error during contract execution) 👍
  • [BETA] Check Transaction Receipt Status (Only applicable for Post Byzantium fork transactions) 👍

Blocks:

  • [BETA] Get Block And Uncle Rewards by BlockNo 👍

Event Logs:

  • [Beta] The Event Log API was designed to provide an alternative to the native eth_getLogs. 🛠️

GETH/Parity proxy:

  • eth_blockNumber👍

=> Returns the number of most recent block

  • eth_getBlockByNumber👍

=> Returns information about a block by block number.

  • eth_getUncleByBlockNumberAndIndex👍

=> Returns information about a uncle by block number.

  • eth_getBlockTransactionCountByNumber👍

=> Returns the number of transactions in a block from a block matching the given block number

  • eth_getTransactionByHash👍

=> Returns the information about a transaction requested by transaction hash

  • eth_getTransactionByBlockNumberAndIndex👍

=> Returns information about a transaction by block number and transaction index position

  • eth_getTransactionCount👍

=> Returns the number of transactions sent from an address

  • eth_sendRawTransaction 🛠️

=> Creates new message call transaction or a contract creation for signed transactions

  • eth_getTransactionReceipt👍

=> Returns the receipt of a transaction by transaction hash

  • eth_call👍

=> Executes a new message call immediately without creating a transaction on the block chain

  • eth_getCode👍

=> Returns code at a given address

  • eth_getStorageAt (**experimental)👍

=> Returns the value from a storage position at a given address.

  • eth_gasPrice👍

=> Returns the current price per gas in wei.

  • eth_estimateGas🛠️

=> Makes a call or transaction, which won't be added to the blockchain and returns the used gas, which can be used for estimating the used gas

Tokens:

  • Get ERC20-Token TotalSupply by ContractAddress 👍
  • Get ERC20-Token Account Balance for TokenContractAddress 👍

Stats:

  • Get Total Supply of Ether (returned in wei; * 0.000000000000000001 to return ETHER)👍

  • Get ETHER LastPrice Price👍

Sample Query

Get a list of 'Normal' Transactions By Address

  • [Optional Parameters] startblock: starting blockNo to retrieve results
  • endblock: ending blockNo to retrieve results (Returns up to a maximum of the last 10000 transactions only)
query {
  normalTxByAddress(
    account: "0xddbd2b932c763ba5b1b7ae3b362eac3e8d40121a"
    startblock: "47884"
    endblock: "915000"
  ) {
    blockNumber
    gas
    hash
  }
}

normal TX by address

Next Steps

Build a proper front end with React and Apollo Client to consume this API

  • I would like to explore more with NextJS to play with server-side-rendering in React.

  • I also want to write more plain CSS (no bootstrap/frameworks) with Flexbox and Grid

Continue expanding the capabilities of graphQL

  • Caching results and creating a database store (looking at you Redis)

  • Offer support for WebSockets for real-time data and as a way to use pub/sub patterns to possibility reduce the amout of calls on the system.

  • Eventually I would like to try and tackle of creating a graphQL API for infura to offer more direct and comprehensive API to interact with the ethereum and IPFS ecosytem.

  • Add testing coverage

etherscan-graphql-api's People

Contributors

natepappenhagen avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

etherscan-graphql-api's Issues

API is down

{
  "error": "NetworkError when attempting to fetch resource."
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.