https://github.com/bard/gs-log
Composable command-line blockchain logger for Gitcoin's Grants Stack
https://github.com/bard/gs-log
Last synced: 4 months ago
JSON representation
Composable command-line blockchain logger for Gitcoin's Grants Stack
- Host: GitHub
- URL: https://github.com/bard/gs-log
- Owner: bard
- Created: 2023-12-15T13:04:04.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-12-15T23:50:14.000Z (over 2 years ago)
- Last Synced: 2025-02-14T03:28:55.145Z (over 1 year ago)
- Language: TypeScript
- Homepage: https://bard.github.io/gitcoin-hackathon-2023-presentation/
- Size: 432 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# gs-log
Blockchain event logger for [Allo (v1)](https://github.com/gitcoinco/grants-stack-allo-contracts-v1) contracts. Built for Gitcoin's December 2023 hackathon ([presentation](https://github.com/bard/gitcoin-hackathon-2023-presentation)). Companion to [gs-index](https://github.com/bard/gs-index).
## Features
- outputs events as JSON lines to stdout for easy composition: save to file, send to network, pipe into [gs-index](https://github.com/bard/gs-index), etc.
- one-shot or continuous operation
- watch multiple chains with independent ranges
- resumable: just feed it a past log to pick up from where it stopped
## Installation
```sh
$ npm i -g https://github.com/bard/gs-log
```
## Examples
Log events on PGN testnet from origin to current block:
```sh
$ gs-log --chains 58008:origin..last
```
Same, but keep watching for new events after reaching current block:
```sh
$ gs-log --chains 58008:origin..ongoing
```
Same, but for Ethereum and Optimism at the same time:
```sh
$ gs-log --chains 1:origin..ongoing,10:origin..ongoing
```
Log events from origin, manually interrupt, and pick up from it left, while keeping a log:
```sh
$ gs-log --chains 58008:origin..ongoing | tee event_log.ndjson
# ...
^C
# ...later...
$ cat event_log.ndjson | gs-log --resume | tee -a event_log.ndjson
```
Log events, process them with [gs-index](https://github.com/bard/gs-index), and save them to Postgres:
```sh
$ gs-log --chains 58008:origin..ongoing | gs-index | psql mydb
```