Skip to content

Instantly share code, notes, and snippets.

    thread-0  controller.cpp:1523 validate_tapos
1017176ms thread-0   net_plugin.cpp:2546           operator()           ] accept txn threw  3040007 invalid_ref_block_exception: Invalid Reference Block
Transaction's reference block did not match. Is this transaction from a different fork?
    {"tapos_summary":{"block_id":"001d8bb1a0b8bae095e4b38c096ed1e5a1296dd87d67f69f50e1dee96101ee24"}}
    thread-0  controller.cpp:1522 validate_tapos

    {}
    thread-0  controller.cpp:1523 validate_tapos
1017241ms thread-0   net_plugin.cpp:2546           operator()           ] accept txn threw  3040007 invalid_ref_block_exception: Invalid Reference Block

删除错误数据

db.eosset.find({"block_num" : {$exists:false}})
db.eosset.remove({"block_num" : {$exists:false}})

创建索引

db.eosset.ensureIndex({"block_num": 1},{unique: true})

eos的块数据导入MongoDB后
进行查询操作

比如查询所有包含buyrambytes动作的块

#!/usr/bin/env python3
# coding:utf-8

from pymongo import MongoClient

调用eos的get_block接口
获取块的json格式数据
将其导入MongoDB便于查询分析

#!/usr/bin/env python3
# coding:utf-8

import requests
import json
{
  "account_name": "eosio.unregd",
  "head_block_num": 1711233,
  "head_block_time": "2018-06-20T13:50:30.500",
  "privileged": false,
  "last_code_update": "2018-06-09T11:58:02.000",
  "created": "2018-06-09T11:57:53.500",
  "ram_quota": -1,
  "net_weight": -1,
{
  "account_name": "eosio.vpay",
  "head_block_num": 1709902,
  "head_block_time": "2018-06-20T13:39:24.500",
  "privileged": false,
  "last_code_update": "1970-01-01T00:00:00.000",
  "created": "2018-06-09T11:57:51.500",
  "ram_quota": -1,
  "net_weight": -1,
{
  "account_name": "eosio.stake",
  "head_block_num": 1709684,
  "head_block_time": "2018-06-20T13:37:35.500",
  "privileged": false,
  "last_code_update": "1970-01-01T00:00:00.000",
  "created": "2018-06-09T11:57:45.500",
  "ram_quota": -1,
  "net_weight": -1,
{
  "account_name": "eosio.saving",
  "head_block_num": 1709608,
  "head_block_time": "2018-06-20T13:36:57.500",
  "privileged": false,
  "last_code_update": "1970-01-01T00:00:00.000",
  "created": "2018-06-09T11:57:48.000",
  "ram_quota": -1,
  "net_weight": -1,
{
  "account_name": "eosio.names",
  "head_block_num": 1709500,
  "head_block_time": "2018-06-20T13:36:03.500",
  "privileged": false,
  "last_code_update": "1970-01-01T00:00:00.000",
  "created": "2018-06-09T11:57:43.500",
  "ram_quota": -1,
  "net_weight": -1,