FIO Relic

FIO Relic

Table of Contents

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

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

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

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

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

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:

  • sender

  • receiver

 

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

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:

  • active

  • burnt

 

domain_activity

Add only. Every activity is a new entry

Field

Description

Relationship

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:

  • register

  • renew

  • transfer

  • wrap

  • unwrap

  • auto_burn

  • public

  • non-public

 

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

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:

  • false (default)

  • true

 

expiration

FROM CHAIN DATA DEFINED BY RULES Timestamp of handle expiration

 

status

DEFINED BY RULES Current status of handle. Options:

  • active

  • burnt

 

handle_activity

Add only. Every activity is a new entry

Field

Description

Relationship

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:

  • register

  • renew

  • transfer

  • add_bundles

  • add_pubbadd

  • rem_pubbadd

  • rem_all_pubbadd

  • add_nft

  • rem_nft

  • rem_all_nft

  • upd_encryptkey

  • self_burn

  • new_request

  • cancel_request

  • reject_request

  • record_obt

 

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

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

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

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:

  • transfer

  • transfer_locked

  • blockchain_fee

  • tpid_reward

  • staking_reward

  • bp_reward

  • foundation_reward

  • oracle_fee

  • unwrap

  • token_mint

  • wrap

  • retire

 

memo

FROM CHAIN DATA Memo in transfer

 

Update accountsbalance

Every time an entry is inserted into token_transfers the accountsbalance should be updated as follows:

  • amount should be subtracted from accountsbalance for payer_account

  • amount should be added to accountsbalance for payee_account

token_staking

Add only. Every stake or unstake is a new entry. Includes internal transfers.

Field

Description

Relationship

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

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:

  • pending

  • cancelled

  • rejected

  • sent_to_blockchain

 

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

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