https://github.com/ferranbt/blocktracker
Track and reconcile Ethereum blocks on realtime
https://github.com/ferranbt/blocktracker
block ethereum stream track
Last synced: 4 months ago
JSON representation
Track and reconcile Ethereum blocks on realtime
- Host: GitHub
- URL: https://github.com/ferranbt/blocktracker
- Owner: ferranbt
- Created: 2018-08-23T11:21:39.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-08-30T11:18:15.000Z (almost 7 years ago)
- Last Synced: 2025-01-01T23:30:04.456Z (5 months ago)
- Topics: block, ethereum, stream, track
- Language: Go
- Homepage:
- Size: 7.81 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# BlockTracker
Based on [ethereumjs-blockstream](https://github.com/ethereumjs/ethereumjs-blockstream).
## Command Line Tool Usage
Install the command line tool with:
```
go get -u github.com/ferranbt/blocktracker/cmd/blocktracker
```Then run it with:
```
blocktracker
```## Library Usage
Install the library with:
```
go get -u github.com/ferranbt/blocktracker
``````
tracker, err := blocktracker.NewBlockTrackerWithEndpoint(logger, rpcEndpoint, true)
if err != nil {
panic(err)
}eventCh := make(chan blocktracker.Event)
tracker.EventCh = eventChtracker.Start(context.Background())
for {
evnt := <-eventCh:
fmt.Println("-------------------------------------")
for _, b := range evnt.Added {
block := b.(*types.Block)
fmt.Printf("ADD %s: %s\n", block.Number().String(), block.Hash().String())
}
for _, b := range evnt.Removed {
block := b.(*types.Block)
fmt.Printf("DEL %s: %s\n", block.Number().String(), block.Hash().String())
}
}
```