使用场景

由于需要对链上数据进行大量自定义得查询,一般来说还是通过部署同步节点,然后使用mongo插件将链上数据同步到Mongo进行使用更直接和方便。(虽然有其他得替代方案比如(Hyperion-History-API)(history-tools),测试下来,mongo更直接些,如果以后有其他方案更新,我们在做文章跟进,此处我们只讨论同步mongo得方案)

mongo 插件配置

必须开启以下配置,才能获取以下讨论中谈及得数据

  • mongodb-store-block-states = true
  • mongodb-store-blocks = true
  • mongodb-store-transactions = true
  • mongodb-store-transaction-traces = true
  • mongodb-store-action-traces = true

Mongo 数据表介绍

使用官方得mongo插件同步后,库数据表如下

  • account_controls
  • accounts
  • action_traces
  • block_states
  • blocks
  • pub_keys
  • transaction_traces
  • transactions

// 稍后补充

附加

action_traces表默认没有"trx_id"得索引,如果想根据"trx_id"查询得话,可以自行添加索引,不然会很慢。

db.action_traces.getIndexes()
db.action_traces.createIndex({"trx_id":1, "background":true})