Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 11 Next »

Table of Contents

Overview

FIO Relic is a fork of Antelope Memento and is intended to receive FIO Chain data stream from the FIO Chain Node via EOS Chronicle. FIO specific data is extracted from the stream and stored in a Relational Database (RDB) for future query via API. The following document is intended to be functional specification for the FIO Relic System.

Components

Data Transformation

This component is responsible for reading the data in the data stream and looking for FIO-specific data, parsing it, and inserting into RDB.

Example:

  • When an action registering FIO Domain is observed, insert it into domains table.

Query API

This component is responsible for receiving an API request, fetching relevant data from the RDB and returning to the API user.

Example:

  • Fetch all FIO Domains registered in specific time-frame.

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

Data Model

blocks

Add only. Every block is a new entry.

Field

Description

Relationship

number

Block number as generated by FIO Node

transactions → block_num

id

Block ID as generated by FIO Node

timestamp

Timestamp as generated by FIO Node

producer

Account name of producer which produced the block

schedule_version

Version of BP schedule

transactions

Add only. Every transaction is a new entry.

Field

Description

Relationship

block_number

Block which contained this transaction

blocks → number

id

Transaction id

traces → transaction_id

action_account

Account name for action

action_name

Action name

account

Account which executed the transaction

tpid

TPID which was recorded in tranaction

fee

FIO Chain fee paid for this transaction

request_data

Raw request data for primary trace

response_data

Raw response data for primary trace

status

Transaction status

traces

Add only. Every trace is a new entry.

Field

Description

Relationship

id

Trace ID - generated.

transaction_id

Transaction ID

transactions → id

action_ordinal

Sequential order of trace in transaction

action_account

Account name for trace

action_name

Action name fro trace

request_data

Raw request data for trace

accounts

Add only. Every account created is a new entry.

Field

Description

Relationship

account

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

Primary public key

account_activity

Add only. Every activity is a new entry.

Field

Description

Relationship

account

Account name

accounts → account

transaction_id

Transaction ID

transactions → id

type

Type of activity

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

Domain name

domain_activity → domain

account

Account name of current owner

accounts → account

is_public

Is domain public

expiration

Timestamp of domain expiration

status

Current status of domain

domain_activity

Add only. Every activity is a new entry

Field

Description

Relationship

domain

Domain name

domains → domain

transaction_id

Transaction ID

transactions → id

type

Type of activity

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

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

account

Account name of current owner

accounts → account

encryption_key

Encryption public key

encryption_key_set

Defines if encryption key was specifically set

bundled_tx

Bundled tx count

expiration

Timestamp of handle expiration

status

Current status of handle

handle_activity

Add only. Every activity is a new entry

Field

Description

Relationship

handle

Handle name

handles → handle

transaction_id

Transaction ID

transactions → id

type

Type of activity

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

Handle name

handles → handle

chain_code

Chain code

token_code

Token code

public_address

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

Handle name

handles → handle

chain_code

Chain code

contract_address

Contract address

token_id

Token ID

url

url

hash

hash

metadata

metadata

token_transfers

Add only. Every transfer is a new entry. Includes internal transfers.

Field

Description

Relationship

payer_account

Account of payer (sender)

accounts → account

payee_account

Account of payee (receiver)

accounts → account

transaction_id

Transaction ID

transactions → id

amount

Token amount in FIO

type

Type of transfer

memo

Memo in transfer

token_staking

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

Field

Description

Relationship

staker_account

Account of staker

accounts → account

transaction_id

Transaction ID

transactions → id

amount

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

FIO Request ID

fio_data → request_id

payee_handle

Handle of payer

handles → handle

payer_handle

Handle of payee

handles → handle

content

Encrypted blob

payee_pub_key

Public Key of payee

payer_pub_key

Public Key of payer

status

Status of request

transaction_id

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

FIO Request ID (optional)

fio_requests → id

payee_handle

Handle of payer

handles → handle

payer_handle

Handle of payee

handles → handle

content

Encrypted blob

payee_pub_key

Public Key of payee

payer_pub_key

Public Key of payer

status

Status of data

transaction_id

Transaction ID

transactions → id

Parsing Rules

The parsing rules below are triggered by any of the following:

  • block

  • transaction

  • trace

  • specific account and name inside traceaction_tracesact. It will be presented as Trigger: action_account:action:name, e.g. Trigger: eosio:newaccount

and are organized by defining the table where record needs to be added as well as data source, typically from the trace.

Please pay attention to sequence of traces to accommodate relationships, e.g. when transferring tokens to a new account, the account has to be inserted into accounts table, before transfer is recorded.

Trigger: every block

Table: blocks NEW RECORD

Field

Source Data

number

block_num

id

block_id

timestamp

block_timestamp

producer

producer

schedule_version

schedule_version

Trigger: every trace where action_ordinal = 1

Table: transactions NEW RECORD

Field

Source Data

block_number

block_num

id

traceid

action_account

traceaction_tracesactaccount

action_name

traceaction_tracesactname

account

traceaction_tracesactauthorizationactor

tpid

traceaction_tracesactdatatpid

fee

responsefee_collected

request_data

traceaction_tracesactdata

response_data

response

status

tracestatus

Table: account_activity ​NEW RECORD

Field

Source Data

account

traceaction_tracesactdataactor

transaction_id

Transaction ID

type

“sender”

Trigger: every trace where action_ordinal > 1

Table: traces NEW RECORD

Field

Source Data

id

Trace id. Auto-generated ID or transaction_id + action_ordinal, e.g. 770989df18fac96e48ca03d6702991d4462bebacceab8cf6b389507e998ca7fe-2

transaction_id

traceid

action_ordinal

traceaction_tracesaction_ordinal

action_account

traceaction_tracesactaccount

action_name

traceaction_tracesactname

request_data

traceaction_tracesactdata

Trigger: fio.address:bind2eosio

Table: accounts NEW RECORD

Field

Source Data

account

traceaction_tracesactdataaccount

public_key

traceaction_tracesactdataclient_key

Table: account_activity NEW RECORD

Field

Source Data

account

traceaction_tracesactdataname

transaction_id

traceid

type

“account_created”

Trigger: fio.token:trnsfiopubky and action_ordinal = 1

Table: token_transfers NEW RECORD

Field

Source Data

payer_account

traceaction_tracesactdataactor

payee_account

traceaction_tracesactdatapayee_public_key hashed to account

transaction_id

traceid

amount

traceaction_tracesactdataamount / 1000000000

type

“transfer”

memo

Trigger: fio.token:trnsloctoks and action_ordinal = 1

Table: token_transfers NEW RECORD

Field

Source Data

payer_account

traceaction_tracesactdataactor

payee_account

traceaction_tracesactdatapayee_public_key hashed to account

transaction_id

traceid

amount

traceaction_tracesactdataamount / 1000000000

type

“transfer_locked”

memo

Trigger: fio.token:transfer and receiver = fio.token

Table: token_transfers NEW RECORD

Field

Source Data

payer_account

traceaction_tracesactdatafrom

payee_account

traceaction_tracesactdatato

transaction_id

traceid

amount

traceaction_tracesactdataquantity (strip " FIO")

type

If memo:FIO fee* type is “blockchain_fee”

If memo:Paying TPID from treasury. type is “tpid_reward”

If memo:Paying Staking Rewards type is “staking_reward”

If memo:Paying producer from treasury. type is “bp_reward”

If memo:Paying foundation from treasury. type is “foundation_reward”

If memo:Token Wrapping Oracle Fee type is “oracle_fee”

If memo:Token Unwrapping type is “unwrap”

memo

traceaction_tracesactdatamemo

Trigger: fio.token:issue and receiver = fio.token

Table: token_transfers NEW RECORD

Field

Source Data

payer_account

“eosio”

payee_account

traceaction_tracesactdatato

transaction_id

traceid

amount

traceaction_tracesactdataquantity (strip " FIO")

type

“token_mint”

memo

traceaction_tracesactdatamemo

Trigger: fio.token:wraptokens and action_ordinal = 1

Table: token_transfers NEW RECORD

Field

Source Data

payer_account

traceaction_tracesactdataactor

payee_account

“fio.oracle"

transaction_id

traceid

amount

traceaction_tracesactdataamount / 1000000000

type

“wrap”

memo

Trigger: fio.token:stakefio and action_ordinal = 1

Table: token_staking NEW RECORD

Field

Source Data

staker_account

traceaction_tracesactdataactor

transaction_id

traceid

amount

traceaction_tracesactdataamount / 1000000000

Trigger: fio.token:retire and action_ordinal = 1

Table: token_transfers ​NEW RECORD

Field

Source Data

payer_account

traceaction_tracesactdataactor

payee_account

transaction_id

traceid

amount

traceaction_tracesactdataquantity / 1000000000

type

“retire”

memo

traceaction_tracesactdatamemo

Trigger: fio.token:unstakefio and action_ordinal = 1

Table: token_staking NEW RECORD

Field

Source Data

staker_account

traceaction_tracesactdataactor

transaction_id

traceid

amount

Negative of (traceaction_tracesactdataamount / 1000000000)

Trigger: fio.address:regdomain and action_ordinal = 1

Table: domains NEW RECORD or UPDATE (if exists based on domain)

Field

Source Data

domain

traceaction_tracesactdatafio_domain

account

traceaction_tracesactdataowner_fio_public_key hashed to account

is_public

“false”

expiration

responseexpiration

status

“active"

Table: domain_activity NEW RECORD

Field

Source Data

domain

traceaction_tracesactdatafio_domain

transaction_id

traceid

type

“register”

Trigger: fio.address:renewdomain and action_ordinal = 1

Table: domains UPDATE

Field

Source Data

domain

traceaction_tracesactdatafio_domain

expiration

responseexpiration

Table: domain_activity NEW RECORD

Field

Source Data

domain

traceaction_tracesactdatafio_domain

transaction_id

traceid

type

“renew”

Trigger: fio.address:xferdomain and action_ordinal = 1

Table: domains UPDATE

Field

Source Data

domain

traceaction_tracesactdatafio_domain

account

traceaction_tracesactdatanew_owner_fio_public_key hashed to account

Table: domain_activity NEW RECORD

Field

Source Data

domain

traceaction_tracesactdatafio_domain

transaction_id

traceid

type

“transfer”

Trigger: fio.address:setdomainpub and action_ordinal = 1

Table: domains UPDATE

Field

Source Data

domain

traceaction_tracesactdatafio_domain

is_public

traceaction_tracesactdatais_public (1 - true; 0 - false)

Table: domain_activity NEW RECORD

Field

Source Data

domain

traceaction_tracesactdatafio_domain

transaction_id

traceid

type

is_public: 1 type is “public”

is_public: 0 type is “non-public”

Trigger: fio.address:wrapdomain and action_ordinal = 1

Table: domains UPDATE

Field

Source Data

domain

traceaction_tracesactdatafio_domain

account

“fio.oracle”

Table: domain_activity NEW RECORD

Field

Source Data

domain

traceaction_tracesactdatafio_domain

transaction_id

traceid

type

“wrap”

Trigger: fio.address:xferescrow

Table: domains UPDATE

Field

Source Data

domain

traceaction_tracesactdatafio_domain

account

traceaction_tracesactdatapublic_key hashed to account

Table: domain_activity NEW RECORD

Field

Source Data

domain

traceaction_tracesactdatafio_domain

transaction_id

traceid

type

“unwrap”

Trigger: fio.address:regaddress and action_ordinal = 1

Table: handles NEW RECORD or UPDATE (if exists based on handle)

Field

Source Data

handle

traceaction_tracesactdatafio_address

account

traceaction_tracesactdataowner_fio_public_key hashed to account

encryption_key

traceaction_tracesactdataowner_fio_public_key

encryption_key_set

“false”

bundled_tx

“100”

expiration

responseexpiration

status

“active"

Table: handle_activity NEW RECORD

Field

Source Data

handle

traceaction_tracesactdatafio_address

transaction_id

traceid

type

“register”

Table: pub_addresses NEW RECORD

Field

Source Data

handle

traceaction_tracesactdatafio_address

chain_code

“FIO”

token_code

“FIO”

public_address

traceaction_tracesactdataowner_fio_public_key

Trigger: fio.address:renewaddress and action_ordinal = 1

Table: handles UPDATE

Field

Source Data

handle

traceaction_tracesactdatafio_address

bundled_tx

Increment current value by “100”

expiration

responseexpiration

Table: handle_activity NEW RECORD

Field

Source Data

handle

traceaction_tracesactdatafio_address

transaction_id

traceid

type

“renew”

Trigger: fio.address:xferaddress and action_ordinal = 1

Table: handles UPDATE

Field

Source Data

handle

traceaction_tracesactdatafio_address

account

traceaction_tracesactdatanew_owner_fio_public_key hashed to account

encryption_key

traceaction_tracesactdatanew_owner_fio_public_key

encryption_key_set

“false”

Table: handle_activity NEW RECORD

Field

Source Data

handle

traceaction_tracesactdatafio_address

transaction_id

traceid

type

“transfer”

Table: pub_addresses DELETE and NEW RECORD

Remove all objects matching in traceaction_tracesactdatafio_address and add:

Field

Source Data

handle

traceaction_tracesactdatafio_address

chain_code

“FIO”

token_code

“FIO”

public_address

traceaction_tracesactdatanew_owner_fio_public_key

Table: nft_signatures DELETE

Remove all objects matching in traceaction_tracesactdatafio_address

Trigger: fio.address:addbundles and action_ordinal = 1

Table: handles UPDATE

Field

Source Data

handle

traceaction_tracesactdatafio_address

bundled_tx

Increment current value by traceaction_tracesactdatabundle_sets * 100

Table: handle_activity NEW RECORD

Field

Source Data

handle

traceaction_tracesactdatafio_address

transaction_id

traceid

type

“add_bundles”

Trigger: fio.address:addaddress and action_ordinal = 1

Table: handle_activity NEW RECORD

Field

Source Data

handle

traceaction_tracesactdatafio_address

transaction_id

traceid

type

“add_pubbadd”

Table: pub_addresses NEW RECORD or UPDATE (if exists)

For each object in traceaction_tracesactdatapublic_addresses update or insert new record

Field

Source Data

handle

traceaction_tracesactdatafio_address

chain_code

traceaction_tracesactdatapublic_addresseschain_code

token_code

traceaction_tracesactdatapublic_addressestoken_code

public_address

traceaction_tracesactdatapublic_addressespublic_address

Table: handles UPDATE

Update only if encryption_key_set = false and chain_code = “FIO” and (token_code = “FIO” or token_code = “*”)

Field

Source Data

handle

traceaction_tracesactdatafio_address

encryption_key

traceaction_tracesactdatapublic_addressespublic_address

Trigger: fio.address:remaddress and action_ordinal = 1

Table: handle_activity NEW RECORD

Field

Source Data

handle

traceaction_tracesactdatafio_address

transaction_id

traceid

type

“rem_pubbadd”

Table: pub_addresses DELETE

Remove each object in traceaction_tracesactdatapublic_addresses which matches

Field

Source Data

handle

traceaction_tracesactdatafio_address

chain_code

traceaction_tracesactdatapublic_addresseschain_code

token_code

traceaction_tracesactdatapublic_addressestoken_code

public_address

traceaction_tracesactdatapublic_addressespublic_address

Trigger: fio.address:remalladdr and action_ordinal = 1

Table: handle_activity NEW RECORD

Field

Source Data

handle

traceaction_tracesactdatafio_address

transaction_id

traceid

type

“rem_all_pubbadd”

Table: pub_addresses DELETE

Remove all objects matching in traceaction_tracesactdatafio_address

Trigger: fio.address:addnft and action_ordinal = 1

Table: handle_activity NEW RECORD

Field

Source Data

handle

traceaction_tracesactdatafio_address

transaction_id

traceid

type

“add_nft”

Table: nft_signatures NEW RECORD or UPDATE (if exists)

For each object in traceaction_tracesactdatanfts update or insert new record

Field

Source Data

handle

traceaction_tracesactdatafio_address

chain_code

traceaction_tracesactdatanfts-> chain_code

contract_address

traceaction_tracesactdatanftscontract_address

token_id

traceaction_tracesactdatanftstoken_id

url

traceaction_tracesactdatanftsurl

hash

traceaction_tracesactdatanftshash

metadata

traceaction_tracesactdatanftsmetadata

Trigger: fio.address:remnft and action_ordinal = 1

Table: handle_activity NEW RECORD

Field

Source Data

handle

traceaction_tracesactdatafio_address

transaction_id

traceid

type

“rem_nft”

Table: nft_signatures DELETE

Remove each object in traceaction_tracesactdatanfts which matches

Field

Source Data

handle

traceaction_tracesactdatafio_address

chain_code

traceaction_tracesactdatanfts-> chain_code

contract_address

traceaction_tracesactdatanftscontract_address

token_id

traceaction_tracesactdatanftstoken_id

url

traceaction_tracesactdatanftsurl

hash

traceaction_tracesactdatanftshash

metadata

traceaction_tracesactdatanftsmetadata

Trigger: fio.address:remallnfts and action_ordinal = 1

Table: handle_activity NEW RECORD

Field

Source Data

handle

traceaction_tracesactdatafio_address

transaction_id

traceid

type

“rem_all_nft”

Table: nft_signatures DELETE

Remove all objects matching in traceaction_tracesactdatafio_address

Trigger: fio.address:updcryptkey and action_ordinal = 1

Table: handles UPDATE

Field

Source Data

handle

traceaction_tracesactdatafio_address

encryption_key

traceaction_tracesactdataencrypt_public_key

encryption_key_set

“true”

Table: handle_activity NEW RECORD

Field

Source Data

handle

traceaction_tracesactdatafio_address

transaction_id

traceid

type

“upd_encryptkey”

Trigger: fio.address:regdomadd and action_ordinal = 1

Execute same as for trigger fio.address:regdomain and fio.address:regaddress

Trigger: fio.address:burnaddress and action_ordinal = 1

Table: handles UPDATE

Field

Source Data

handle

traceaction_tracesactdatafio_address

status

“burnt”

Table: handle_activity NEW RECORD

Field

Source Data

handle

traceaction_tracesactdatafio_address

transaction_id

traceid

type

“self_burn”

Table: pub_addresses DELETE

Remove all objects matching in traceaction_tracesactdatafio_address

Table: nft_signatures DELETE

Remove all objects matching in traceaction_tracesactdatafio_address

Trigger: fio.address:newfundsreq and action_ordinal = 1

Table: handle_activity NEW RECORD

Field

Source Data

handle

traceaction_tracesactdatafio_address

transaction_id

traceid

type

“new_request”

Table: fio_requests NEW RECORD

Field

Source Data

id

responsefio_request_id

payee_handle

traceaction_tracesactdatapayee_fio_address

payer_handle

traceaction_tracesactdatapayer_fio_address

content

traceaction_tracesactdatacontent

payee_pub_key

Look-up accountsencrypt_key where account is owner of traceaction_tracesactdatapayee_fio_address

payer_pub_key

Look-up accountsencrypt_key where account is owner of traceaction_tracesactdatapayer_fio_address

status

“pending”

transaction_id

traceid

Trigger: fio.address:cancelfndreq and action_ordinal = 1

Table: handle_activity NEW RECORD

Field

Source Data

handle

traceaction_tracesactdatafio_address

transaction_id

traceid

type

“cancel_request”

Table: fio_requests UPDATE

Field

Source Data

id

traceaction_tracesactdatafio_request_id

status

“cancelled”

Trigger: fio.address:recordobt and action_ordinal = 1

Table: handle_activity NEW RECORD

Field

Source Data

handle

traceaction_tracesactdatafio_address

transaction_id

traceid

type

“record_obt”

Table: fio_data NEW RECORD

Field

Source Data

request_id

traceaction_tracesactdatafio_request_id

payee_handle

traceaction_tracesactdatapayee_fio_address

payer_handle

traceaction_tracesactdatapayer_fio_address

content

traceaction_tracesactdatacontent

payee_pub_key

Look-up accountsencrypt_key where account is owner of traceaction_tracesactdatapayee_fio_address

payer_pub_key

Look-up accountsencrypt_key where account is owner of traceaction_tracesactdatapayer_fio_address

status

“sent_to_blockchain”

transaction_id

traceid

Table: fio_requests UPDATE

Update only if traceaction_tracesactdatafio_request_id is present

Field

Source Data

id

traceaction_tracesactdatafio_request_id

status

“sent_to_blockchain”

Trigger: fio.address:burndomain

Table: domains UPDATE

Field

Source Data

domain

traceaction_tracesactdatadomainname

status

“burnt”

Table: domain_activity NEW RECORD

Field

Source Data

domain

traceaction_tracesactdatadomainname

transaction_id

traceid

type

“auto_burn”

API

/get_blocks

Returns block information from blocks table.

Request

Parameter

Description

time_start

OPTIONAL Filters block by timestamp

time_end

OPTIONAL Filters block by timestamp

producer

OPTIONAL Filters block by producer

sort

OPTIONAL Sorting:

timestamp_asc

timestamp_desc

Response

Field

Source Data

number

blocksnumber

id

blocksid

timestamp

blockstimestamp

producer

blocksproducer

schedule_version

blocksschedule_version

Example
[
	{
		"number": "2",
		"id": "00000002953a8ab87a1855c0c40786e6a910a86cb2dd160f181418d05d233ea7",
		"timestamp": "2020-03-25T00:05:21.000",
		"producer": "eosio",
		"schedule_version": "1"
	}
]

/get_transactions

Returns transaction information from transactions table.

Request

Parameter

Description

time_start

OPTIONAL Filters block by timestamp

time_end

OPTIONAL Filters block by timestamp

block_number

OPTIONAL Filters block by block_number

action_account

OPTIONAL Filters block by action_account

action_name

OPTIONAL Filters block by action_name

sort

OPTIONAL Sorting:

timestamp_asc

timestamp_desc

Response

Field

Source Data

id

transactionsid

block_number

transactionsblock_number

action_account

transactionsaction_account

action_name

transactionsaction_name

account

transactionsaccount

tpid

transactionstpid

fee

transactionsfee

request_data

transactionsrequest_data

request_data

transactionsresponse_data

status

transactionsstatus

type_specific_data

Example
[
	{
		
	}
]

TODO

  • burned addresses and domains pre JAN-2024 - maybe table deltas?

  • No labels