Skip to content

Instantly share code, notes, and snippets.

@SaveTheAles
Last active February 15, 2021 17:01
Show Gist options
  • Save SaveTheAles/65ed6de11a44316cb76b745b9d599c89 to your computer and use it in GitHub Desktop.
Save SaveTheAles/65ed6de11a44316cb76b745b9d599c89 to your computer and use it in GitHub Desktop.
Spec of the current cyberindex version

Current state of cyberindex

block worker_type_juno instance_type_table

column description
id SERIAL PRIMARY KEY
height integer NOT NULL UNIQUE
hash character varying(64) NOT NULL UNIQUE
total_gas integer DEFAULT 0
proposer_address character varying(40) NOT NULL REFERENCES validator(address)
pre_commits integer NOT NULL
timestamp timestamp without time zone NOT NULL

cyberlink worker_type_juno instance_type_table

column description
object_from VARCHAR(256) NOT NULL
object_to VARCHAR(256) NOT NULL
subject CHAR(44) NOT NULL
timestamp timestamp without time zone NOT NULL
height integer NOT NULL REFERENCES block(height)
txhash CHAR(64) NOT NULL REFERENCES transaction(txhash)
karma integer NOT NULL

message worker_type_juno instance_type_table

column description
id SERIAL PRIMARY KEY
subject CHAR(44) NOT NULL
type character varying(64) NOT NULL
value jsonb NOT NULL DEFAULT '{}'::jsonb
timestamp timestamp without time zone NOT NULL
height integer NOT NULL REFERENCES block(height)
txhash CHAR(64) NOT NULL REFERENCES transaction(txhash)
code integer DEFAULT 0
codespace character varying(64)

object worker_type_juno instance_type_table

column description
id SERIAL PRIMARY KEY
object VARCHAR(256) NOT NULL
subject CHAR(44) NOT NULL
timestamp timestamp without time zone NOT NULL
height integer NOT NULL REFERENCES block(height)
txhash CHAR(64) NOT NULL REFERENCES transaction(txhash)

pre_commit worker_type_juno instance_type_table

column description
id SERIAL PRIMARY KEY
validator_address character varying(40) NOT NULL REFERENCES validator(address)
timestamp timestamp without time zone NOT NULL
voting_power integer NOT NULL
proposer_priority integer NOT NULL
height integer NOT NULL

transaction worker_type_juno instance_type_table

column description
id SERIAL PRIMARY KEY
timestamp timestamp without time zone NOT NULL
gas_wanted integer DEFAULT 0
gas_used integer DEFAULT 0
height integer NOT NULL REFERENCES block(height)
txhash character varying(64) NOT NULL UNIQUE
subject CHAR(44) NOT NULL
events jsonb DEFAULT '[]'::jsonb
messages jsonb NOT NULL DEFAULT '[]'::jsonb
fee jsonb NOT NULL DEFAULT '{}'::jsonb
signatures jsonb NOT NULL DEFAULT '[]'::jsonb
memo character varying(256)
code integer DEFAULT 0
codespace character varying(64)
rawlog jsonb NOT NULL DEFAULT '[]'::jsonb

validator worker_type_juno instance_type_table

column description
id SERIAL PRIMARY KEY
address character varying(40) NOT NULL UNIQUE
consensus_pubkey character varying(83) NOT NULL UNIQUE

relevance worker_type_juno instance_type_table

column description
id SERIAL PRIMARY KEY
object VARCHAR(256) NOT NULL
height integer NOT NULL
rank numeric NOT NULL

relevance_leaderboard instance_type_table

short description: rewards_view group by address and sum shares

column description
subject CHAR(44) NOT NULL
share real

built by:

  • top_1000 worker_type_juno instance_type_table
  • top_stats instance_type_table
  • rewards_view instance_type_table

depends on:

  • relevance worker_type_juno instance_type_table
  • cyberlink worker_type_juno instance_type_table

accs_by_act instance_type_table

short description:

account activity by major events

column description
subject CHAR(44) NOT NULL
first_delegation timestamp
first_send timestamp
first_link timestamp
first_tweet timestamp
first_follow timestamp
first_avatar timestamp
follows integer
cyberlinks integer
tweets integer
first_5_folls timestamp
first_25_folls timestamp
first_10_links timestamp
first_100_links timestamp

depends on:

  • transaction worker_type_juno instance_type_table
  • message worker_type_juno instance_type_table
  • cyberlink worker_type_juno instance_type_table

karma_view instance_type_table

short description:

account summary karma. Grouped by account from cyberlinks table

column description
subject CHAR(44) NOT NULL
karma integer

depends on:

  • cyberlink worker_type_juno instance_type_table

pre_commit_view instance_type_table

short description:

validator summary pre_commits. Grouped by validator from pre_commits and old_pre_commits tables by consensus_pubkey

column description
consensus_pubkey character varying(83) NOT NULL UNIQUE
precommits integer

depends on:

  • old_pre_commits worker_type_juno instance_type_table
  • validator worker_type_juno instance_type_table
  • pre_commit worker_type_juno instance_type_table

gift_info worker_type_juno instance_type_table

short description:

static table with information about gifted addresses by the distribution company

column description
subject CHAR(44) NOT NULL UNIQUE PRIMARY KEY
euler4 CHAR(51)
urbit CHAR(42)
cosmos CHAR(45)
ethereum CHAR(42)

depends on:

  • gift_info.csv

old_pre_commits worker_type_juno instance_type_table

short description:

static table with information about euler-5 pre_commits

column description
consensus_pubkey character varying(83) NOT NULL UNIQUE PRIMARY KEY
precommits NUMERIC

depends on:

  • old_pre_commits.csv

Analytics views instance_type_table

short description:

storing daily analytic data with accumulating. General view:

column description
data timestamp
instance_per_day integer
instance_total(accumulated) integer

List of views:

  • euler4_per_day
  • euler4_total
  • ethereum_per_day
  • ethereum_total
  • urbit_per_day
  • urbit_total
  • cosmos_per_day
  • cosmos_total
  • new_per_day
  • new_total
  • unique_per_day
  • unique_total
  • objects_per_day
  • objects_total
  • txs_per_day
  • txs_total
  • tweets_per_day
  • tweets_total
  • cyberlinks_per_day
  • cyberlinks_total

depends on:

  • transaction worker_type_juno instance_type_table
  • message worker_type_juno instance_type_table
  • cyberlink worker_type_juno instance_type_table

Support views for cohort API (in progress)

  • tx_order instance_type_table
  • cohorts instance_type_table

Future design of cyberindex

Regular tables worker_type_juno instance_type_table

  • validator (what exactly is consensus address?)
  • pre_commit
  • block (sum of pre commits?)
  • transaction (subject needed)
  • message
  • cyberlink (?)

auth module worker_type_juno instance_type_table

account

List of accounts in the network

column description
address TEXT NOT NULL PRIMARY KEY

bank module worker_type_juno instance_type_table

supply. Historical supply change. Can follow it with views by coins denom.

column description
coins COIN[] NOT NULL
height BIGINT NOT NULL UNIQUE PRIMARY KEY

account_balance. Historical account balance changing. Possible to follow account balance changing, also make a richlist by denom.

column description
address TEXT NOT NULL REFERENCES account (address)
coins COIN[] NOT NULL DEFAULT '{}'
height BIGINT NOT NULL

staking module worker_type_juno instance_type_table

validator_info

column description
consensus_address TEXT NOT NULL UNIQUE PRIMARY KEY REFERENCES validator(consensus_address)
operator_address TEXT NOT NULL UNIQUE
self_delegate_address TEXT REFERENCES account (address)
max_change_rate TEXT NOT NULL
max_rate TEXT NOT NULL

validator_status. Histrorical

column description
validator_address TEXT NOT NULL REFERENCES validator (consensus_address)
status INT NOT NULL
jailed BOOLEAN NOT NULL
height BIGINT
PRIMARY KEY (validator_address, height)

consensus module worker_type_juno instance_type_table

list of tables:

  • average_block_time_per_minute
  • average_block_time_per_hour
  • average_block_time_per_day
  • average_block_time_from_genesis

mint module worker_type_juno instance_type_table

inflation

column description
value DECIMAL NOT NULL
height BIGINT NOT NULL
PRIMARY KEY (value, height)

slashing worker_type_juno instance_type_table instance_type_table

validator_signing_info

column description
validator_address TEXT NOT NULL
start_height BIGINT NOT NULL
index_offset BIGINT NOT NULL
jailed_until TIMESTAMP WITHOUT TIME ZONE NOT NULL
tombstoned BOOLEAN NOT NULL
missed_blocks_counter BIGINT NOT NULL
height BIGINT NOT NULL REFERENCES block (height)

slashing_params. Historical. Can understand lost values by validator.

column description
signed_block_window BIGINT NOT NULL
min_signed_per_window DECIMAL NOT NULL
downtime_jail_duration BIGINT NOT NULL
slash_fraction_double_sign DECIMAL NOT NULL
slash_fraction_downtime DECIMAL NOT NULL
height BIGINT NOT NULL REFERENCES block (height)

additional views for analytics

Analytics views instance_type_table

short description:

storing daily analytic data with accumulating. General view:

column description
data timestamp
instance_per_day integer
instance_total(accumulated) integer

List of views:

  • euler4_per_day
  • euler4_total
  • ethereum_per_day
  • ethereum_total
  • urbit_per_day
  • urbit_total
  • cosmos_per_day
  • cosmos_total
  • new_per_day
  • new_total
  • unique_per_day
  • unique_total
  • objects_per_day
  • objects_total
  • txs_per_day
  • txs_total
  • tweets_per_day
  • tweets_total
  • cyberlinks_per_day
  • cyberlinks_total

depends on:

  • transaction worker_type_juno instance_type_table
  • message worker_type_juno instance_type_table
  • cyberlink worker_type_juno instance_type_table

Support views for cohort API (in progress)

  • tx_order instance_type_table
  • cohorts instance_type_table
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment