|
|
## Block processing
|
|
|
Data from blocks in haf database will be gathered in sink process to `hafbe_app` schema tables.
|
|
|
### witness_votes
|
|
|
Block data from existing `haf_block_log` database is massively processed (in chunks of 100 blocks) into `hafbe_app` schema tables, then block-by-block processing is started until app catches up with live sync.
|
|
|
|
|
|
### witness_votes_history
|
|
|
```
|
|
|
witness_id | voter_id | approve | timestamp
|
|
|
INT | INT | BOOLEAN | TIMESTAMP
|
|
|
```
|
|
|
`*_id` will be taken from `hive.accounts_view`<br>
|
|
|
`approve` and `timestamp` are necessary to calculate `votes_daily_change` and `voters_num_change` in [response](https://gitlab.syncad.com/hive/haf_block_explorer/-/wikis/New-API-Calls#response-10) <br>
|
|
|
data gathered from `account_witness_vote_operation`
|
|
|
Holds sequential data from all `account_witness_vote_operation`
|
|
|
|
|
|
### account_proxies
|
|
|
### current_witness_votes
|
|
|
```
|
|
|
witness_id | voter_id | approve | timestamp
|
|
|
INT | INT | BOOLEAN | TIMESTAMP
|
|
|
```
|
|
|
voter_id | proxy_id
|
|
|
INT | INT
|
|
|
Same as `witness_votes_history` table, but only last voter's vote per witness is saved (either approve or disapprove a witness).
|
|
|
|
|
|
### current_witnesses
|
|
|
```
|
|
|
`*_id` same as `witness_votes` <br>
|
|
|
Data will be gathered from `account_witness_proxy_operation`. When account is unproxied, `proxy = ""` in operation json.<br>
|
|
|
This will be used to calculate `vests`, `account`, `proxied` during sql query as part of [response](https://gitlab.syncad.com/hive/haf_block_explorer/-/wikis/New-API-Calls#response-10)
|
|
|
witness_id | url | price_feed | bias | feed_age | block_size | signing_key | version
|
|
|
INT | TEXT | FLOAT | NUMERIC | INTERVAL | INT | TEXT | TEXT
|
|
|
```
|
|
|
"voters": [
|
|
|
{
|
|
|
"name": TEXT,
|
|
|
"vests": INT, # hive power instead but stored in vests
|
|
|
"account": INT, # how much hive acc has powered up, from transfer to vesting completed op
|
|
|
"proxied": INT # if acc is proxied through voter, voter gets acc's hp
|
|
|
},
|
|
|
...
|
|
|
],
|
|
|
New witnesses are added when: <br>
|
|
|
1) witness is discovered in `account_witness_vote_operation`<br>
|
|
|
2) witness is discovered in one of `feed_publish_operation`, `witness_update_operation`, `witness_set_properties_operation`
|
|
|
|
|
|
Then, up-tp-date witness props are inserted from `feed_publish_operation`, `witness_update_operation`, `pow_operation`, `pow2_operation`, `witness_update_operation`
|
|
|
|
|
|
### account_proxies_history
|
|
|
```
|
|
|
account_id | proxy_id | proxy | timestamp
|
|
|
INT | INT | BOOLEAN | TIMESTAMP
|
|
|
```
|
|
|
Holds sequential data from all `proxy_cleared_operation`. <br>
|
|
|
`proxy` is opposite of `clear`. <br>
|
|
|
Account can be proxied only once and recursive proxying is possible until depth of 5.
|
|
|
|
|
|
### current_account_proxies
|
|
|
```
|
|
|
account_id | proxy_id | proxy
|
|
|
INT | INT | BOOLEAN
|
|
|
```
|
|
|
`vests = account + proxied` is necessary for ordering voters list in UI <br>
|
|
|
`account`is amount of powered up hive (HP) in vests 'currency' <br>
|
|
|
`proxied` is amount of HP 'delegated' to voter by proxied account. When account is proxied, it's `account = 0` and for proxy account, `proxied += account (of proxy)`. |
|
|
\ No newline at end of file |
|
|
Same as `account_proxies_history` table, but only last proxy or unproxy operation is saved per account. <br>
|
|
|
`timestamp` is not included as it is not required by API.
|
|
|
|
|
|
### hived_account_cache
|
|
|
```
|
|
|
account | data
|
|
|
TEXT | JSON
|
|
|
```
|
|
|
this table stores account data after calling `get_account()` method.<br>
|
|
|
`condenser_api.get_accounts` is called with mentioned method, because most of required info is not available on haf database.
|
|
|
|
|
|
### account_operation_cache
|
|
|
```
|
|
|
account_id | op_type_id
|
|
|
INT | SMALLINT
|
|
|
```
|
|
|
Helper table that holds types of operations per account, used for operation filtering on UI side.
|
|
|
|
|
|
### account_vests
|
|
|
```
|
|
|
account_id | vests
|
|
|
INT | BIGINT
|
|
|
```
|
|
|
|
|
|
Holds vests of all accounts, used for witness and voter account `vests` or `votes` value calculation. |