bitcoin - 使用随机对等点发现模拟私有(private)比特币网络

标签 bitcoin blockchain bitcoind bitcoin-testnet

我正在寻找一种在我的私有(private) LAN/Wifi 网络上模拟 1000 节点比特币网络的方法。

我阅读了开发者指南:https://bitcoin.org/en/developer-examples#regtest-mode其中提到 regtest模式主要适用于单个节点或指定节点,而不是像实际网络这样的随机节点。

有些人可能会建议使用 testnet模式,但这对我没有用,因为我想通过 testnet 检查未知节点不支持的比特币新协议(protocol)网络。

简而言之,我希望在我的 LAN/Wifi 网络中模拟一个完整的比特币网络。

最佳答案

如果您尝试在 LAN 上连接,诀窍是对它们进行沙箱处理。


  • 每个节点
  • 为每个节点指定唯一的数据目录

  • 第一次使用 mkdir 创建目录
    mkdir $HOME/regtest/A/
    mkdir $HOME/regtest/B/
    mkdir $HOME/regtest/C/
    

    修改并运行这个 bash 脚本(注意端口号,本例中有 9 个)以循环方式相互连接。
    #!/bin/bash
    bitcoind -server -listen -port=17590 -rpcuser=<user> -rpcpassword=<pass> -rpcport=16590 -datadir=$HOME/regtest/A/ -addnode=localhost:17591 -regtest -pid=$HOME/regtest/A/ -daemon -debug
    bitcoind -server -listen -port=17591 -rpcuser=<user> -rpcpassword=<pass> -rpcport=16591 -datadir=$HOME/regtest/B/ -addnode=localhost:17592 -regtest -pid=$HOME/regtest/B/ -daemon -debug
    bitcoind -server -listen -port=17592 -rpcuser=<user> -rpcpassword=<pass> -rpcport=16592 -datadir=$HOME/regtest/C/ -addnode=localhost:17590 -regtest -pid=$HOME/regtest/A/ -daemon -debug
    

    由于您想研究对等发现,您可能想看看尝试 -connect 之间的区别。而不是 -addnode

    关于bitcoin - 使用随机对等点发现模拟私有(private)比特币网络,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33272364/

    相关文章:

    ubuntu - 如何在 Ubuntu 20 上安装 bitcoind?

    Javascript Websocket 订阅 channel

    bitcoin - 两个比特币客户端如何发现对方?

    bitcoin - 在 bitcoind 中列出来自给定地址的交易

    blockchain - 每个 Assets 都应该在 Fabric 中有自己的链码吗?

    node.js - 403 Forbidden from bitcoind - 在 docker 上运行的服务器

    javascript - d3.js 比特币图表形状错误

    bitcoin - 编译智能合约而不删除换行符

    go - Chaincode 未构建 - Go 程序错误 - 无法引用未导出的名称

    php - Bitcoind rpc AddLocal(ip :port) and Disover: IPv4 eth0: ip missing Amazon AWS CentOS