https://github.com/graphprotocol/extractor-cosmos
https://github.com/graphprotocol/extractor-cosmos
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/graphprotocol/extractor-cosmos
- Owner: graphprotocol
- Created: 2022-04-29T15:01:18.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-12-07T12:08:39.000Z (about 2 years ago)
- Last Synced: 2024-12-25T16:09:34.819Z (about 1 year ago)
- Language: Go
- Homepage:
- Size: 138 KB
- Stars: 0
- Watchers: 26
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# extractor-cosmos
Blockchain data extraction utilities for Cosmos
## Usage
Initialize globally:
```go
func main() {
extractor.SetWriterFromConfig(&extractor.Config{
OutputFile: "/path/to/output.log",
// Other config options are listed below
})
// Customize the logs prefix (DMLOG is a default)
extractor.SetPrefix("DMLOG")
// Initialize height frame (this is needed when using bundled output) and write block data
extractor.SetHeight(12345)
extractor.WriteLine(extractor.MsgBegin, "%d", 12345)
extractor.WriteLine(extractor.MsgBlock, "...block data...")
extractor.WriteLine(extractor.MsgEnd, "%d", 12345)
}
```
## Cosmos Instrumentation
TODO: Add this section
## Extractor Configuration
To enable extractor module, add the following to your `~/.gaia/config/config.toml` file:
```toml
#######################################################
### Extractor Configuration Options ###
#######################################################
[extractor]
# Enable the extractor workflow
enabled = true
# Output log file for all extracted data
#
# Could be one of the:
# - "stdout", "STDOUT" will print out logs to standard output
# - "stderr", "STDERR" will print out logs to standard error output
# - "path.log" for relative to ~/.gaia directory
# - "/path/to/log.log" - for absolute path
#
# Supported variables in the filename:
# - $date - replaced by YYYYMMDD of current time in UTC
# - $time - replaced by HHMMSS of current time in UTC
# - $ts - replaced by a YYYYMMDD-HHMMSS of current time in UTC
#
output_file = "extractor.log"
# output_file = "extractor-$date.log"
# output_file = "extractor-$ts.log"
# We can also bundle block data per file
bundle = true
bundle_size = 1000 # each file will include data for 1k blocks/heights
# output file will be "output_file.log.0000000000" and so on
# Height range filtering
# start_height = 100
# end_height = 200
```