Block explorer tool for given range of block inputs.
Functional Requirements:
- Given a range of blocks OR a user inputed number of blocks to visit from, query the blockchain.
- Return the following information:
- Total ether transfered from block range given.
- Which addresses sent/received and how much sent/receieved total?
- Total count of how many addresses are contract addresses.
- OPTIONAL FEATURE
- What percentage of transactions were contract transactions?
Format: Command line interface
Tech Stack: NodeJs, Javascript
Challenges: How would you solve slow queries over large block ranges?
In order to arrive at a solution, one must have full scope of the problem. Why is it that slow queries occur over large block ranges to begin with?
Assuming the following reasons:
- Newer blocks on the network contain more transactions, and are therefore larger blocks and have larger read/write time.
- Depending on whether or not your ethereum node is fully synced, and its read/write time.
- All blocks need to be validated by the network, so if you are syncing while querying, that could be a cause of slower queries.
- Blocks are sequential and could need to be called or traversed to retreive the query (think of a linked list run time here!
Design Goals:
- User (top priority): Is everything clear and understandable for the user? Is it easy to use?
- Requirements: Are all functional requirements completed?
- Readability: Is code clear, well defined and declared, and commented when needed? Intuitive?
- Documentation: Is there documentation that explains how to run the code, code architecture, testing?
- Tests: Are there automated tests? Do these test edge cases and functionality?
Prereqs:
- NodeJs
- Local Ethereum Node or Ganache Testnet
Dependencies:
In root project directory:
npm install
How To Package:
npm link
Run (packaged):
explorer
Run (unpackaged):
In root project directory:
./explorer.js
Tests:
npm test