{"id":37203451,"url":"https://github.com/qshuai/hardfork","last_synced_at":"2026-01-14T23:27:49.964Z","repository":{"id":117747866,"uuid":"157540447","full_name":"qshuai/hardfork","owner":"qshuai","description":"How to separate the mixed blockchain for bitcoin-abc and bitcoin-sv.","archived":false,"fork":false,"pushed_at":"2019-07-10T04:55:41.000Z","size":10775,"stargazers_count":4,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-03-06T14:02:26.165Z","etag":null,"topics":["bitcoin-abc","bitcoin-sv","blockchain","test-script"],"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/qshuai.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":"2018-11-14T11:43:19.000Z","updated_at":"2024-06-19T12:21:34.427Z","dependencies_parsed_at":null,"dependency_job_id":"e0b05fb9-66b9-4171-8c4a-968d9a3f1fc6","html_url":"https://github.com/qshuai/hardfork","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"purl":"pkg:github/qshuai/hardfork","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qshuai%2Fhardfork","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qshuai%2Fhardfork/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qshuai%2Fhardfork/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qshuai%2Fhardfork/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/qshuai","download_url":"https://codeload.github.com/qshuai/hardfork/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qshuai%2Fhardfork/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28438205,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T22:37:52.437Z","status":"ssl_error","status_checked_at":"2026-01-14T22:37:31.496Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["bitcoin-abc","bitcoin-sv","blockchain","test-script"],"created_at":"2026-01-14T23:27:49.277Z","updated_at":"2026-01-14T23:27:49.945Z","avatar_url":"https://github.com/qshuai.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"hardfork\n---\n这个仓库的目的是为了在区块的中位数时间戳大于等于`1542300000`时，有效分离bitcoin-abc和bitcoin-sv两条链。实现的策略是：在bitcoin-abc链中注入含bitcoin-abc的特有的操作码`OP_CHECKDATASIG`的交易，并且在bitcoin-sv链上注入含有bitcoin-sv的特有操作吗`OP_MUL`，这样可以在bicoin-abc和bitcoin-sv节点各打包出一个含有独有共识的交易，而链认为对方的区块不符合自己的共识规则，从而达到分离bitcoin-abc和bitcoin-sv区块链的目的。\n\n#### 提醒:\n\n这个仓库正处于活跃的开发中，如果您不是专业的开发人员，请不要将您真实的币用于该脚本中。\n\n#### 使用说明:\n\n1. 安装依赖：\n\n    - 安装bitcoin-abc Linux系统下的客户端，安装文档请移步至: [https://github.com/Bitcoin-ABC/bitcoin-abc/tree/master/doc](https://github.com/Bitcoin-ABC/bitcoin-abc/tree/master/doc)；\n\n    - 安装bitcoin-sv Linux系统下的客户端，安装文档请移步至：[https://github.com/bitcoin-sv/bitcoin-sv/tree/master/doc](https://github.com/bitcoin-sv/bitcoin-sv/tree/master/doc);\n\n    - 安装Go语言环境：[Go](http://golang.org/) 1.8版本或者更新；\n\n    - 安装Go包依赖：\n\n        ```\n        go get github.com/bcext/gcash\n        go get github.com/bcext/cashutil\n        go get github.com/qshuai/tcolor\n        go get github.com/shopspring/decimal\n        ```\n\n2. 编译该工具: 该脚本在运行前，需要具有一些UTXO列表，当前的实现是通过硬编码一个UTXO列表在程序里面(主要是考虑在命令行手动输入大量utxo列表容易出错的缘故，故选择硬编码的方式)，那就是说每次在重新启动脚本的时候，您需要检查该UTXO列表是否可用。\n\n    - 编译bitcoin-abc目录下的脚本程序，该脚本程序负责创建bitcoin-abc区块链上的特有交易(包含`OP_CHECKDATASIG`操作码)。\n\n        ```\n        cd $GOPATH/github.com/copernet/tools/hardfork/bitcoin-abc\n        go install\n        ```\n\n    - 编译bitcoin-sv目录下的脚本程序，该脚本程序负责创建bitcoin-sv区块链上的特有交易(包含`OP_MUL`操作码)。\n\n      ```\n      cd $GOPATH/github.com/copernet/tools/hardfork/bitcoin-sv\n      go install\n      ```\n\n    \u003e 如果您没有没有安装Go语言环境和Go包依赖，我们为您准备了相应平台的二进制可执行文件，您可以直接运行，而不用经过上面上面繁琐的安装过程。二进制程序覆盖了linux和MacOS操作系统，您可以在bitcoin-abc和bitcoin-sv目录下找到它们，linux二进制包以`-linux`结尾，MaxOS二进制包以`osx`结尾。\n\n3. 目前您需要检查bitcoin-abc和bitcoin-sv节点是否配置了`rpcuser`和`rpcpassword`选项，如果您执行的脚本程序的不在该节点上，您需要额外配置`rpcallowip`选项。在配置完相关选项之后，分别启动客户端bitcoin-abc和bitcoin-sv(强烈建议分开部署)。 在确定两个节点的数据已经同步到最高区块高度后(一般需要几小时到几十个小时，取决于您的网络环境和电脑配置)。准备工作已经完成，下面就可以执行我们的脚本程序了。\n\n    下面是一个节点配置文件的示例(目前bitcoin-abc和bitcoin-sv的配置项没有什么差别)， 仅供参考:\n\n    ```\n    rpcuser=0XKRwRnyiY7NN2CfArU=\n    rpcpassword=OSAqQIIp6XaPGuH53NvDlVPALQjaWksF4GPJyUimASq9\n    txindex=1\n    daemon=1\n    rpcallowip=106.39.30.175\n    ```\n\n4. 启动脚本程序\n\n    程序中几个选项的说明(具体的说明可以通过 `-h` 参看):\n\n    - privkey: 钱包私钥，和硬编码的utxo需要对应，也就是这个私钥能够花费这些utxo；\n    - rpchost: rpc server的ip和端口，默认为`127.0.0.1:8332`；\n    - rpcuser: rpc server的用户名，用于用户rpc调用的认证；\n    - rpcpassword：rpc server的密码，用户用户rpc调用的认证；\n    - wait： 表示创建两笔交易之间的间隔时间，单位为秒(s)。需要注意的是如果您的utxo列表过少，同时wait参数过短，将会在节点内存池中产生许多关联交易，如果关联的深度大于25，将会在广播交易的时候失败。建以采用默认配置。\n\n    ```\n    // 创建bitcoin-abc独有共识的交易\n    ./bitcoin-abc --privkey=******* --rpchost=127.0.0.1:8332 --rpcuser=rpc-user --rpcpassword=rpc-password --wait=600\n\n    // 创建bitcoin-sv独有共识的交易\n    ./bitcoin-sv --privkey=******* --rpchost=127.0.0.1:8332 --rpcuser=rpc-user --rpcpassword=rpc-password --wait=600\n    ```\n\n    程序运行的结果会直接在终端输出， 结果类似于以下的输出:\n\n    ```\n    available utxo: 1\n    first transaction:\n    \thash: 09f2e6c95f0fa31f357af90611803e2b35f9cc8256937db21298f7dc7cc8ad28\n        rawtx: 0100000001333fb064838ad7685aee6a8650960c22be6ba59f0bc378b33da99ec889c0f79b010000006b483045022100aea45ac5e37125bb8442e634a8b128aa62636ccb9424a007b1fb897827f34ada02200bf1f4114c69336b1d44b76ea83511c0050c83458ecb861e1f3577176d6fe2c141210315eadd14931b1b41c903a291d63fd6aa50ba9523b5558db2857e18fd6df6a208ffffffff02220200000000000017a914fa8311a7df24c87fb759f3db2d2d763f0af5b071879c5c9800000000001976a9142b494c0b23d7aba3a01469fe265599d35179f8a388ac00000000\n    second transction:\n    \thash: 5b4ec490e265e908ef229f1e0e0caa94a251d105dac6be56d6ab749c9baa9e42\n    \trawtx: 0100000001333fb064838ad7685aee6a8650960c22be6ba59f0bc378b33da99ec889c0f79b010000006b483045022100aea45ac5e37125bb8442e634a8b128aa62636ccb9424a007b1fb897827f34ada02200bf1f4114c69336b1d44b76ea83511c0050c83458ecb861e1f3577176d6fe2c141210315eadd14931b1b41c903a291d63fd6aa50ba9523b5558db2857e18fd6df6a208ffffffff02220200000000000017a914fa8311a7df24c87fb759f3db2d2d763f0af5b071879c5c9800000000001976a9142b494c0b23d7aba3a01469fe265599d35179f8a388ac00000000\n    ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqshuai%2Fhardfork","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqshuai%2Fhardfork","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqshuai%2Fhardfork/lists"}