bds-eth 是开源项目区块链数据服务(BDS)的其中一个独立模块 - 提供全节点服务。
bds-eth 基于 ethereum/go-ethereum 的 v1.9.9 版本进行二次开发,支持直接将新增的区块数据往消息中间件服务 kafka 发送,方便上游的服务来订阅消费。
1.编译
make geth
或者, 构建整套工具:
make all
2.运行全节点,并支持向 kafka 发送消息
geth --rpc --datadir <data directory> --rpcapi admin,db,eth,debug,miner,net,shh,txpool,personal,web3 --syncmode full --gcmode=archive --cache 4096 console --port <port> --rpcport <rpcport> --kafka.endpoint <kafka rest proxy, default "http://localhost:8082/topics/eth">
参见 kafka 官网
修改 config/server.properties 文件
- message.max.bytes=1048576000
参见 confluent
解压缩 confluent 安装包并运行Confluent Rest Proxy
修改 /etc/kafka-rest/kafka-rest.properties 文件
- max.request.size = 1048576000
- buffer.memory = 1048576000
- send.buffer.bytes = 1048576000
参见BDS
我们现在支持 SQL server 和 PostgreSQL 两种数据库,您可以选择其中一种作为数据存储方法。
参见 Grafana 官网
- 增加了向 kafka 发送消息的新功能(每次一个新块被全节点同步时,该块的数据将以定制的数据结构被发送到 kafka 中)
- sendblock 和 sendbatchblock 是新添加的两个 RPC 接口,用于触发全节点发送特定块的数据。