/rsk-explorer-summarizer

Summarize data from RSK Explorer database

Primary LanguageTypeScript

RSK Metrics Summarizer

Summarizing Transactions

  1. Transaction data structure in database
interface {
  _id: string
  hash: string
  nonce: number
  blockHash: string
  blockNumber: number
  transactionIndex: number
  from: string
  to: string
  gas: number
  gasPrice: string
  value: string
  input: string
  v: string | null
  r: string | null
  s: string | null
  timestamp: number
  receipt: {
    transactionHash: string
    transactionIndex: number
    blockHash: string
    blockNumber: number
    cumulativeGasUsed: number
    gasUsed: number
    contractAddress: string | null
    from: string
    to: string
    root: string
    status: string
    logsBloom: string
  }
  txType: 'remasc' | 'contract call' | 'normal' | 'bridge'
  txId: string
}
  1. Grouped Transaction Structure
interface {
  _id: string // %Y-%m-%d
  gas: number
  transactions: {
    name: string
    total: number
  }[]
}
  1. RESULT: Summarized Transaction Structure
interface {
  id: string // %Y-%m-%d
  gas: number
  contract_call?: { name: string; total: number; gas: number }
  contract_deploy?: { name: string; total: number; gas: number }
  bridge?: { name: string; total: number; gas: number }
  remasc?: { name: string; total: number; gas: number }
  normal?: { name: string; total: number; gas: number }
}

Summarizing Stats

  1. Stats Structure in database
interface {
  _id: string // %Y-%m-%d
  circulating: {
    circulatingSupply: string
    totalSupply: number
    bridgeBalance: string
  } | null
  timestamp: number
  hashrate: number
  activeAccounts: number
}
  1. RESULT: Grouped and Summarized Stats Structure
interface {
  id: string // %Y-%m-%d
  hashrate: number
  activeAccounts: number
  circulatingSupply: number
  count: number
}