chainviz

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2021 License: Apache-2.0, MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Query

func Query(ctx context.Context, db *pg.DB, minHeight, chainLength uint64) (*models.BlockSet, error)

Query captures the chain formation persisted behind a pg.DB connection and returns models.NewBlockSet to be exported for visualization. When provided a DB connection, it expects to find a table in the public schema called `observed_headers` with the following definition:

  • miner_id (text)
  • header_cid (text)
  • parents (text as comma delimited list)
  • header_timestamp (int8 as unix epoch)

It also expects the function `unix_to_height(int) -> bigint` which takes the unix epoch and returns the expected height. This might be represented in SQL by `SELECT ((unix_epoch - chain_genesis_epoch) / 30)::bigint;`.

The Query will identify the block and its parents, then associate the block and parent tuple with its metadata.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL