{"id":39429408,"url":"https://github.com/wupeaking/pbft_impl","last_synced_at":"2026-01-18T04:02:12.298Z","repository":{"id":38999245,"uuid":"284932207","full_name":"wupeaking/pbft_impl","owner":"wupeaking","description":"基于pbft共识算法的贝壳区块链平台","archived":false,"fork":false,"pushed_at":"2023-03-06T05:25:37.000Z","size":7819,"stargazers_count":46,"open_issues_count":15,"forks_count":10,"subscribers_count":3,"default_branch":"dev","last_synced_at":"2024-06-19T00:37:08.089Z","etag":null,"topics":["blockchain","compiler","evm","p2p","pbft"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wupeaking.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-04T09:14:53.000Z","updated_at":"2024-03-27T13:50:01.000Z","dependencies_parsed_at":"2024-06-19T00:22:58.351Z","dependency_job_id":"62d67226-9799-4b5b-8fc1-336474b1554c","html_url":"https://github.com/wupeaking/pbft_impl","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/wupeaking/pbft_impl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wupeaking%2Fpbft_impl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wupeaking%2Fpbft_impl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wupeaking%2Fpbft_impl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wupeaking%2Fpbft_impl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wupeaking","download_url":"https://codeload.github.com/wupeaking/pbft_impl/tar.gz/refs/heads/dev","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wupeaking%2Fpbft_impl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28529455,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T00:39:45.795Z","status":"online","status_checked_at":"2026-01-18T02:00:07.578Z","response_time":98,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blockchain","compiler","evm","p2p","pbft"],"created_at":"2026-01-18T04:02:11.607Z","updated_at":"2026-01-18T04:02:12.291Z","avatar_url":"https://github.com/wupeaking.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"## 贝壳 -- 一个基于PBFT共识算法的区块链平台\n\n### 缘由\n最初是计划学习pbft算法之后对其进行一个Go语言的实现. 编写的过程中发现, 如果想实现PBFT, 需要实现网络通信, 需要加密和验证签名功能.\n于是逐渐的就写了加密模块, 区块链下载模块, 交易缓存, 数据存储等模块. 既然写了这么多, 索性就实现一个完整的区块链.\n\n\n## 模块介绍\n### pbft 共识\npbft共识在网络上有很多文章介绍, 但是具体的开源实现却比较少。 尤其是用在区块链项目中。 本项目的共识算法的状态流转和消息模型参考了\n超级账本的sawtooth-rfcs(https://github.com/wupeaking/sawtooth-rfcs/blob/master/text/0019-pbft-consensus.md)项目的部分设计\n\n### 加密\n使用的是go标准库的椭圆曲线加密算法, 减少依赖 使用起来非常方便。\n\n### P2P网络\n在应用层封装成通信接口, 屏蔽不同的实现.\n在调试场景使用http进行通信的模拟, 调试完成后使用目前比较成熟的开源libp2p进行封装.\n\n### 交易池\n一个本地的消息队列交易池 \n\n### 虚拟机\n目前只能进行账户之间的金额转账. 等此功能完全稳定后, 会考虑将自己之前实现的一个脚本解释器经过修改移植到此项目中.\n[https://github.com/wupeaking/panda]\n\n### 数据存储\n定义为三级存储， 最底层为leveldb实现持久化存储。\n对其他组件提供缓存层.\n\n### 实现的功能\n- pbft共识模块\n    \u003e 在单节点, 3节点, 4节点测试成功\n- blockchain模块\n    - 下载区块\n    - 广播区块\n    - 停止共识\n    - 查询区块高度, 区块详情\n\n- p2p模块\n    - 封装了libp2p\n    - 使用http协议进行调试通信\n- 加密模块\n- 存储模块\n- 虚拟机模块\n    - 进行转账功能\n- 账户系统\n    - 账户查询\n    - 创建\n    - 转账 \n- 交易\n    - 广播交易\n    - 查询交易\n    - 验证交易\n- 命令行工具\n    - 账户创建 查询 转账\n\n## 使用示例\n\n### 使用说明\n```shell\n./counch.x --help         \nNAME:\n   counch 贝壳-一个区块链平台 - counch --help 显示更多使用说明\n\nUSAGE:\n   counch.x [global options] command [command options] [arguments...]\n\nVERSION:\n   v0.0.1\n\nCOMMANDS:\n   account, account  贝壳账户系统\n   help, h           Shows a list of commands or help for one command\n\nGLOBAL OPTIONS:\n   --help, -h     show help (default: false)\n   --version, -v  print the version (default: false)\n\n```\n\n#### 创建账户\n```shell\n./counch.x account create --help\nNAME:\n   counch 贝壳-一个区块链平台 account create - 创建一个新的账户\n\nUSAGE:\n   counch 贝壳-一个区块链平台 account create [command options] [arguments...]\n\nOPTIONS:\n   --password value  密码 (default: 123456)\n   --help, -h        show help (default: false)\n\n```\n\n#### 列出自己的账户\n```shell \n./counch.x account list         \n-------------------------\n\taddress: 0x8e1fbf5b13279c82eac11cc23f456118d12a1babdecd9dbfb643defe4a1d9e62, public: 0x6a1582185f55b394b1da2e695d7935b8d38e8d30cd7e4414a5400490e6c58207f6c15ddfe41ce89a02e3716b351aea04e897bf130952b2161a4ab44c101248cc, private: , index: 1\n\taddress: 0xf52772d71e21a42e8cd2c5987ed3bb99420fecf4c7aca797b926a8f01ea6ffd8, public: 0xc4024ffd0b42495f49002b5da606512aee341c53e43a641b7d8efac8e29f6ed2d5c6449fe4343f41c5216a84ea9dd43e07daeeadb38556bb19527ce699394cd7, private: , index: 2\n累计: 2 \n-------------------------\n\n\n```\n\n#### 查询当前钱包所有余额\n```shell\n./counch.x account balance \n```\n\n### 如何启动一个新的贝壳链\n#### 1. 编译\n```\ngit clone git@github.com:wupeaking/pbft_impl.git\ngo build -v -o counch.x cmd/counch/main.go\n```\n\n#### 启动\n```\n## 创建.counch文件夹\n\u003e mkdir .counch\n## 拷贝配置文件 并根据需要修改\n\u003e cp test_node1/.counch/config.json ./.counch\n## 启动\n\u003e ./counch.x\n\n```\n\n\n### 目前已经部署了3个节点的测试链\n区块链浏览器地址为: http://blockchain.wupengxin.cn\n![snap](./doc/blockchain.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwupeaking%2Fpbft_impl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwupeaking%2Fpbft_impl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwupeaking%2Fpbft_impl/lists"}