Giter Club home page Giter Club logo

tx-parser's Introduction

tx-parser

Ethereum blockchain parser that will allow to query transactions for subscribed addresses.

Run application

to run application use:

go run ./cmd/tx-parser --starting_block <starting_block>

Default values:

  • starting_block=0

Test application

In order to test the application 3 endpoints are available:

To get current processed block do

curl -X GET http://localhost:8080/api/current-block

To get transactions for the address do

curl -X GET http://localhost:8080/api/transactions/{address}

To subscribe to the address do

curl -X POST -H "Content-Type: application/json" -d '{"address":"some-address"}' http://localhost:8080/api/subscribe

Implementation

Scanner scans blocks for the ethereum blockchain and stores hashes of the transactions in the storage.

Storage is implemented as a memory using three maps:

  1. observedAddresses: Stores addresses subscribed to the service.
  2. transactionsOfAddress: Stores transaction hashes for each address (sender or receiver).
  3. transactions: Stores full transaction data for each transaction hash.

Other notes

  1. Transaction data is stored in the database to facilitate returning full transaction details. While it's possible to avoid storing transactions and only store hashes, doing so would require querying the EVM node later for each transaction, which may be costlier if the company does not maintain its own EVM node, but uses some third-party service (e.g. Alchemy, Infura, etc.).
  2. All transactions since the starting block are stored. While this approach ensures data integrity, it may not be necessary for the application's requirements. If only transactions from the block of subscription onwards are needed, storing transactions for subscribed addresses exclusively could be considered.
  3. Since the storage is implemented as a memory and all transactions are stored, the memory consumption of the application grow fast. However, this would not be a problem if the storage is implemented as a database where the data are stored in a persistent volume.

tx-parser's People

Contributors

zorjak avatar

Watchers

 avatar

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.