Bitcoin blk*.dat文件解析 | 您所在的位置:网站首页 › blk是什么格式 › Bitcoin blk*.dat文件解析 |
工具选取参考链接:http://blog.hubwiz.com/2019/12/03/blockchain-analytic-tools/
一、区块文件读取工具
1、bitcoin-blockchain-parser
测试选择:bitcoin-blockchain-parser:比特币blk.dat解析库 Github地址:https://github.com/alecalve/python-bitcoin-blockchain-parser 数据库选择:MongoDB 2、blockapi 区块链分析API 【最好在linux上操作,有点麻烦】Github地址:https://github.com/blockchain-unica/blockapi BlockAPI的工作流主要包括两个步骤: 构建区块链视图并存入数据库使用数据库的查询语言分析视图BlockAPI目前支持的区块链包括比特币、莱特币和以太坊,目前支持的数据库 有MongoDB、MySQL、PostgreSQL和Fuseki。 二、额外的参考: 1、od - 16进制查看工具od是一个简单的工具,它将文件内容导出为你选择的格式 od -x --endian=big -N 293 -An blk00000.dat 其中: -x: 显示为16进制 --endian=big: 按big endian顺序显示字节 -N 293 : 声明要读取的字节数 -An:不显示文件偏移量 od通常内置于各种linux发行版中。 2、hexdump - 16进制及ascii查看工具类似于od,不过hexdump可以显示数据的ascii文本,这对于快速查看交易中包含的信息会很方便。 $ hexdump -C -s 8 -n 285 blk00000.dat 其中: -C:显示字节及ascii文本 -s:声明要显示数据的偏移位置 -n:声明要读取的字节数 也可以指显示原始的16进制数据 $ hexdump -C -s 8 -n 285 blk00000.dat | cut -c 11-58 | tr '\n' ' ' | tr -d ' ' 其中: cut -c 11-58 :仅保留每行的11到58列 tr '\n' ' ' :将换行翻译为空格 tr -d ' ' :删除所有空格 hexdump通常内置于各种linux发行版中。参考:https://www.jianshu.com/p/07359694925c。 |
CopyRight 2018-2019 实验室设备网 版权所有 |