FIO Relic
Table of Contents
- 1 Table of Contents
- 2 Overview
- 2.1 Components
- 2.1.1 Application Components
- 2.1.1.1 Data Pipeline
- 2.1.1.2 Database
- 2.1.1.3 API
- 2.1.2 Push Notification System
- 2.1.1 Application Components
- 2.1 Components
- 3 Specification
- 3.1 Deployment Requirements
- 3.2 Data Model
- 3.2.1 blocks
- 3.2.2 transactions
- 3.2.3 traces
- 3.2.4 accounts
- 3.2.5 account_activity
- 3.2.6 domains
- 3.2.7 domain_activity
- 3.2.8 handles
- 3.2.9 handle_activity
- 3.2.10 pub_addresses
- 3.2.11 nft_signatures
- 3.2.12 token_transfers
- 3.2.13 token_staking
- 3.2.14 fio_requests
- 3.2.15 fio_data
- 3.3 Parsing Rules
- 3.3.1 Trigger: every block
- 3.3.1.1 Table: blocks NEW RECORD
- 3.3.2 Trigger: every trace where action_ordinal = 1
- 3.3.2.1 Table: transactions NEW RECORD
- 3.3.2.2 Table: account_activity NEW RECORD
- 3.3.3 Trigger: every trace where action_ordinal > 1
- 3.3.3.1 Table: traces NEW RECORD
- 3.3.4 Trigger: fio.address:bind2eosio
- 3.3.4.1 Table: accounts NEW RECORD
- 3.3.4.2 Table: account_activity NEW RECORD
- 3.3.5 Trigger: fio.token:trnsfiopubky and action_ordinal = 1
- 3.3.6 Trigger: fio.token:trnsloctoks and action_ordinal = 1
- 3.3.7 Trigger: fio.token:transfer and receiver = fio.token
- 3.3.8 Trigger: fio.token:issue and receiver = fio.token
- 3.3.9 Trigger: fio.token:stakefio and action_ordinal = 1
- 3.3.9.1 Table: token_staking NEW RECORD
- 3.3.10 Trigger: fio.token:retire and action_ordinal = 1
- 3.3.10.1 Table: token_transfers NEW RECORD
- 3.3.11 Trigger: fio.token:unstakefio and action_ordinal = 1
- 3.3.11.1 Table: token_staking NEW RECORD
- 3.3.12 Trigger: fio.address:regdomain and action_ordinal = 1
- 3.3.13 Trigger: fio.address:renewdomain and action_ordinal = 1
- 3.3.13.1 Table: domains update
- 3.3.13.2 Table: domain_activity NEW RECORD
- 3.3.14 Trigger: fio.address:xferdomain and action_ordinal = 1
- 3.3.14.1 Table: domains update
- 3.3.14.2 Table: domain_activity NEW RECORD
- 3.3.14.3 Table: account_activity NEW RECORD
- 3.3.15 Trigger: fio.address:setdomainpub and action_ordinal = 1
- 3.3.15.1 Table: domains update
- 3.3.15.2 Table: domain_activity NEW RECORD
- 3.3.16 Trigger: fio.address:wrapdomain and action_ordinal = 1
- 3.3.16.1 Table: domains update
- 3.3.16.2 Table: domain_activity NEW RECORD
- 3.3.16.3 Table: account_activity NEW RECORD
- 3.3.17 Trigger: fio.address:xferescrow
- 3.3.17.1 Table: domains update
- 3.3.17.2 Table: domain_activity NEW RECORD
- 3.3.17.3 Table: account_activity NEW RECORD
- 3.3.18 Trigger: fio.address:regaddress and action_ordinal = 1
- 3.3.19 Trigger: fio.address:renewaddress and action_ordinal = 1
- 3.3.19.1 Table: handles update
- 3.3.19.2 Table: handle_activity NEW RECORD
- 3.3.20 Trigger: fio.address:xferaddress and action_ordinal = 1
- 3.3.20.1 Table: handles update
- 3.3.20.2 Table: handle_activity NEW RECORD
- 3.3.20.3 Table: account_activity NEW RECORD
- 3.3.20.4 Table: pub_addresses DELETE and NEW RECORD
- 3.3.20.5 Table: nft_signatures DELETE
- 3.3.21 Trigger: fio.address:addbundles and action_ordinal = 1
- 3.3.21.1 Table: handle_activity NEW RECORD
- 3.3.22 Trigger: fio.address:addaddress and action_ordinal = 1
- 3.3.22.1 Table: handle_activity NEW RECORD
- 3.3.22.2 Table: pub_addresses NEW RECORD or update (if exists)
- 3.3.22.3 Table: handles update
- 3.3.23 Trigger: fio.address:remaddress and action_ordinal = 1
- 3.3.23.1 Table: handle_activity NEW RECORD
- 3.3.23.2 Table: pub_addresses DELETE
- 3.3.24 Trigger: fio.address:remalladdr and action_ordinal = 1
- 3.3.24.1 Table: handle_activity NEW RECORD
- 3.3.24.2 Table: pub_addresses DELETE
- 3.3.25 Trigger: fio.address:addnft and action_ordinal = 1
- 3.3.26 Trigger: fio.address:remnft and action_ordinal = 1
- 3.3.26.1 Table: handle_activity NEW RECORD
- 3.3.26.2 Table: nft_signatures DELETE
- 3.3.27 Trigger: fio.address:remallnfts and action_ordinal = 1
- 3.3.27.1 Table: handle_activity NEW RECORD
- 3.3.27.2 Table: nft_signatures DELETE
- 3.3.28 Trigger: fio.address:updcryptkey and action_ordinal = 1
- 3.3.28.1 Table: handles update
- 3.3.28.2 Table: handle_activity NEW RECORD
- 3.3.29 Trigger: fio.address:regdomadd and action_ordinal = 1
- 3.3.30 Trigger: fio.address:burnaddress and action_ordinal = 1
- 3.3.30.1 Table: handles update
- 3.3.30.2 Table: handle_activity NEW RECORD
- 3.3.30.3 Table: pub_addresses DELETE
- 3.3.30.4 Table: nft_signatures DELETE
- 3.3.31 Trigger: fio.address:newfundsreq and action_ordinal = 1
- 3.3.31.1 Table: handle_activity NEW RECORD
- 3.3.31.2 Table: account_activity NEW RECORD
- 3.3.31.3 Table: fio_requests NEW RECORD
- 3.3.32 Trigger: fio.address:cancelfndreq and action_ordinal = 1
- 3.3.32.1 Table: handle_activity NEW RECORD
- 3.3.32.2 Table: fio_requests UPDATE
- 3.3.33 Trigger: fio.address:rejectfndreq and action_ordinal = 1
- 3.3.33.1 Table: handle_activity NEW RECORD
- 3.3.33.2 Table: fio_requests UPDATE
- 3.3.34 Trigger: fio.address:recordobt and action_ordinal = 1
- 3.3.34.1 Table: handle_activity NEW RECORD
- 3.3.34.2 Table: account_activity NEW RECORD
- 3.3.34.3 Table: fio_data NEW RECORD
- 3.3.34.4 Table: fio_requests UPDATE
- 3.3.35 Trigger: Table Deltas: added:false and kvo->table:domains
- 3.3.35.1 Table: domains update
- 3.3.35.2 Table: domain_activity NEW RECORD
- 3.3.36 Trigger: Table Deltas: added:false and kvo->table:fionames
- 3.3.36.1 Table: handles update
- 3.3.36.2 Table: handle_activity NEW RECORD
- 3.3.37 Trigger: Action in list
- 3.3.1 Trigger: every block
- 3.4 API
- 3.4.1 /get_blocks
- 3.4.2 /get_transactions
- 3.4.3 /get_accounts
- 3.4.4 /get_domains
- 3.4.5 /get_handles
- 3.4.6 /get_pub_addresses
- 3.4.7 /get_nft_signatures
- 3.4.8 /get_token_transfers
- 3.4.9 /get_fio_requests
- 3.4.10 /get_fio_data
- 3.4.11 /get_domain_activity
- 3.4.12 /get_handle_activity
Overview
FIO Relic is an application which connects to to the FIO Chain node to receive all transaction data, transforms this data into FIO Protocol specific data, inserts int into a relational database and makes the content available via HTTP API. The following document is intended to be functional specification for the FIO Relic System.
Components
Application Components
Data Pipeline
Data Pipeline (FIO.Chronicle) is a software application designed to connect to FIO Chain State History, receive the data and transform it to JSON. It is a fork of the EOSChronicle project.
receiver – a new receiver will be made that will meet RELIC specific needs. the receiver will process only relic relevant events from the fio state history node.
decoder – a decoder component will be made that meets relic specific needs, converting relic bin data collected and queued from history node receiver into json to be consumed by a relic specific exporter.
exporter – a new exporter will be made that will export data directly into the relic Postgres relational database.
Database
Postgres Relational Database to store FIO Chain information.
API
HTTP server to return information from database.
Push Notification System
This component will be developed in Phase 2.
This component allows an API user to subscribe to specific events and then receive notification if such event has occurred during data transformation.
Examples
“Notify supplied webhook on every new FIO Domain registration”
“Notify when a FIO Request for specific FIO Handle is observed”
Specification
Deployment Requirements
FIO Relic will likely be run on the same environment as the FIO Chain node. Therefore, it should be compatible with that environment
It should be very easy to configure and deploy FIO Relic as a product.
Avoid:
Long installation instructions
Requiring install of multiple components which may have their own versions and dependancies
Consider:
Clear instructions on installation and dependency requirementgs
Single repo
Single install and run script
Data Model
blocks
Add only. Every block is a new entry.
Field | Description | Relationship |
---|---|---|
number | FROM CHAIN DATA Block number as generated by FIO Node | transactions → block_num |
id | FROM CHAIN DATA Block ID as generated by FIO Node |
|
timestamp | FROM CHAIN DATA Timestamp as generated by FIO Node |
|
producer | FROM CHAIN DATA Account name of producer which produced the block |
|
schedule_version | FROM CHAIN DATA Version of BP schedule |
|
transactions
Add only. Every transaction is a new entry.
Field | Description | Relationship |
---|---|---|
block_number | FROM CHAIN DATA Block which contained this transaction | blocks → number |
id | FROM CHAIN DATA Transaction id | traces → transaction_id |
action_account | FROM CHAIN DATA Account name for action |
|
action_name | FROM CHAIN DATA Action name |
|
account | FROM CHAIN DATA Account which executed the transaction |
|
tpid | FROM CHAIN DATA TPID which was recorded in tranaction |
|
fee | FROM CHAIN DATA FIO Chain fee paid for this transaction |
|
request_data | FROM CHAIN DATA Raw request data for primary trace |
|
response_data | FROM CHAIN DATA Raw response data for primary trace |
|
status | FROM CHAIN DATA Transaction status |
|
traces
Add only. Every trace is a new entry.
Field | Description | Relationship |
---|---|---|
id | GENERATED Trace ID - generated. |
|
transaction_id | FROM CHAIN DATA Transaction ID | transactions → id |
receiver | FROM CHAIN DATA Receiver of trace |
|
action_ordinal | FROM CHAIN DATA Sequential order of trace in transaction |
|
action_account | FROM CHAIN DATA Account name for trace |
|
action_name | FROM CHAIN DATA Action name fro trace |
|
request_data | FROM CHAIN DATA Raw request data for trace |
|
accounts
Add only. Every account created is a new entry.
Field | Description | Relationship |
---|---|---|
account | FROM CHAIN DATA Account name | account_activity → account domains → account handles → account token_transfers → payer_account token_transfers → payee_account token_staking → staker_account fio_requests → payee_account fio_requests → payer_account fio_data → payee_account fio_data → payer_account |
public_key | FROM CHAIN DATA Primary public key |
|
balance | DEFINED BY RULES Running FIO Token balance. Default: 0 |
|
timestamp | FROM CHAIN DATA Block timestamp of when account was created |
|
account_activity
Add only. Every activity is a new entry.
Field | Description | Relationship |
---|---|---|
account | FROM CHAIN DATA Account name | accounts → account |
transaction_id | FROM CHAIN DATA Transaction ID | transactions → id |
type | DEFINED BY RULES Type of activity. Options:
|
|
domains
Add and update. Represents current state of domains. Will be updated every time domain info changes. Records will not be removed, just marked burned.
Field | Description | Relationship |
---|---|---|
domain | FROM CHAIN DATA Domain name | domain_activity → domain |
account | FROM CHAIN DATA DEFINED BY RULES Account name of current owner | accounts → account |
is_public | FROM CHAIN DATA Is domain public |
|
expiration | FROM CHAIN DATA Timestamp of domain expiration |
|
status | DEFINED BY RULES Current status of domain. Options:
|
|
domain_activity
Add only. Every activity is a new entry
Field | Description | Relationship |
---|---|---|
domain | FROM CHAIN DATA Domain name | domains → domain |
transaction_id | FROM CHAIN DATA Transaction ID | transactions → id |
type | DEFINED BY RULES Type of activity. Options:
|
|
handles
Add and update. Represents current state of handles. Will be updated every time handle info changes. Records will not be removed, just marked burned.
Field | Description | Relationship |
---|---|---|
handle | FROM CHAIN DATA Handle name | handle_activity → handle pub_addresses → handle nft_signatures → handle fio_requests → payer_handle fio_requests → payee_handle fio_data → payer_handle fio_data → payee_handle |
domain | DEFINED BY RULES Domain on which handle is registered. Right of @ in user@domain | domains → domain |
account | FROM CHAIN DATA Account name of current owner | accounts → account |
encryption_key | FROM CHAIN DATA Encryption public key |
|
encryption_key_set | DEFINED BY RULES Defines if encryption key was specifically set. Options:
|
|
expiration | FROM CHAIN DATA DEFINED BY RULES Timestamp of handle expiration |
|
status | DEFINED BY RULES Current status of handle. Options:
|
|
handle_activity
Add only. Every activity is a new entry
Field | Description | Relationship |
---|---|---|
handle | FROM CHAIN DATA Handle name | handles → handle |
transaction_id | FROM CHAIN DATA Transaction ID | transactions → id |
type | DEFINED BY RULES Type of activity. Options:
|
|
pub_addresses
Add, update, delete. Represents current state of mapped public addresses. Will be updated every time mapping changes. Records will be removed if needed.
Field | Description | Relationship |
---|---|---|
handle | FROM CHAIN DATA Handle name | handles → handle |
chain_code | FROM CHAIN DATA Chain code |
|
token_code | FROM CHAIN DATA Token code |
|
public_address | FROM CHAIN DATA Public Address |
|
nft_signatures
Add, update, delete. Represents current state of NFT signatures. Will be updated every time signatures are changed. Records will be removed if needed.
Field | Description | Relationship |
---|---|---|
handle | FROM CHAIN DATA Handle name | handles → handle |
chain_code | FROM CHAIN DATA Chain code |
|
contract_address | FROM CHAIN DATA Contract address |
|
token_id | FROM CHAIN DATA Token ID |
|
url | FROM CHAIN DATA url |
|
hash | FROM CHAIN DATA hash |
|
metadata | FROM CHAIN DATA metadata |
|
token_transfers
Add only. Every transfer is a new entry. Includes internal transfers.
Field | Description | Relationship |
---|---|---|
payer_account | FROM CHAIN DATA DEFINED BY RULES Account of payer (sender) | accounts → account |
payee_account | FROM CHAIN DATA DEFINED BY RULES Account of payee (receiver) | accounts → account |
transaction_id | FROM CHAIN DATA Transaction ID | transactions → id |
amount | FROM CHAIN DATA DEFINED BY RULES Token amount in FIO |
|
type | DEFINED BY RULES Type of transfer. Options:
|
|
memo | FROM CHAIN DATA Memo in transfer |
|
Update accounts
→ balance
Every time an entry is inserted into token_transfers the accounts
→ balance
should be updated as follows:
amount
should be subtracted fromaccounts
→balance
forpayer_account
amount
should be added toaccounts
→balance
forpayee_account
token_staking
Add only. Every stake or unstake is a new entry. Includes internal transfers.
Field | Description | Relationship |
---|---|---|
staker_account | FROM CHAIN DATA Account of staker | accounts → account |
transaction_id | FROM CHAIN DATA Transaction ID | transactions → id |
amount | FROM CHAIN DATA DEFINED BY RULES Token amount in FIO, unstake will be negative |
|
fio_requests
Add and update. Represents current state of requests. Will be updated every time request status changes. Records will not be removed.
Field | Description | Relationship |
---|---|---|
id | FROM CHAIN DATA FIO Request ID | fio_data → request_id |
payee_handle | FROM CHAIN DATA Handle of payer | handles → handle |
payer_handle | FROM CHAIN DATA Handle of payee | handles → handle |
content | FROM CHAIN DATA Encrypted blob |
|
payee_pub_key | FROM CHAIN DATA Public Key of payee |
|
payer_pub_key | FROM CHAIN DATA Public Key of payer |
|
status | FROM CHAIN DATA DEFINED BY RULES Status of request. Options:
|
|
transaction_id | FROM CHAIN DATA Transaction ID | transactions → id |
fio_data
Add and update. Represents current state of FIO Data. Will be updated every time request status changes. Records will not be removed.
Field | Description | Relationship |
---|---|---|
request_id | FROM CHAIN DATA FIO Request ID (optional) | fio_requests → id |
payee_handle | FROM CHAIN DATA Handle of payer | handles → handle |
payer_handle | FROM CHAIN DATA Handle of payee | handles → handle |
content | FROM CHAIN DATA Encrypted blob |
|
payee_pub_key | FROM CHAIN DATA Public Key of payee |
|
payer_pub_key | FROM CHAIN DATA Public Key of payer |
|
status | FROM CHAIN DATA Status of data. Currently always “sent_to_blockchain”. |
|
transaction_id | FROM CHAIN DATA Transaction ID |