An open API service indexing awesome lists of open source software.

https://github.com/graphprotocol/extractor-cosmos


https://github.com/graphprotocol/extractor-cosmos

Last synced: 8 months ago
JSON representation

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
```