Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nnqq/eth-parser
https://github.com/nnqq/eth-parser
Last synced: 9 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/nnqq/eth-parser
- Owner: nnqq
- License: mit
- Created: 2023-04-24T13:42:37.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-11-06T21:25:49.000Z (about 1 year ago)
- Last Synced: 2024-06-21T18:44:30.965Z (5 months ago)
- Language: Go
- Size: 22.5 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# eth-parser
Ethereum blockchain parser that will allow to query transactions for subscribed addresses.
## Environment variables
All environment variables are required.
| Variable | Description |
|---------------|----------------------------|
| `RPC_URL` | Ethereum JSONRPC URL |
| `START_BLOCK` | Block number to start from |
| `HTTP_HOST` | HTTP server host |
| `HTTP_PORT` | HTTP server port |
| `DEBUG_LOGS` | Enable debug logs |## HTTP API
| Method | Path | Request body | Request query params | Description |
|---------|------------------|-------------------------------|----------------------|-------------------------------------------|
| `GET` | `/current-block` | `—` | `—` | Get current scanner block number |
| `POST` | `/subscribe` | `{ "address": "ethAddress" }` | `—` | Subscribe to address |
| `GET` | `/transactions` | `—` | `address=ethAddress` | Get transactions for subscribed addresses |### Examples
API deployed to `https://eth-parser.shopgrip.ru` (testnet Sepolia).
```
curl --location --request GET 'https://eth-parser.shopgrip.ru/current-block'
``````
curl --location --request POST 'https://eth-parser.shopgrip.ru/subscribe' \
--header 'Content-Type: application/json' \
--data-raw '{
"address": "0x11D1D2654637c75c89A493Ad8ccD7A2f83ffec1f"
}'
``````
curl --location --request GET 'https://eth-parser.shopgrip.ru/transactions?address=0x11D1D2654637c75c89A493Ad8ccD7A2f83ffec1f'
```## Run locally
With mainnet env examples.
```
DEBUG_LOGS=true HTTP_HOST=0.0.0.0 HTTP_PORT=1234 RPC_URL=https://cloudflare-eth.com START_BLOCK=17126687 go run cmd/main.go
```## Test
Run unit and integration tests.
```
go test ./...
```