簡體   English   中英

使用隨機對等點發現模擬私有比特幣網絡

[英]Simulate private bitcoin network with random peer discovery

我正在尋找一種在我的專用LAN / Wifi網絡上模擬1000節點比特幣網絡的方法。

我閱讀了開發人員指南: httpsregtest ,它提到了主要用於單個節點或指定節點的regtest模式,而不是像實際網絡那樣的隨機節點。

有些人可能會建議使用testnet模式,但這對我testnet ,因為我想檢查一個新的協議,因為比特幣不會被testnet網絡上的未知節點支持。

簡單來說,我希望在我的LAN / Wifi網絡中模擬一個完整的比特幣網絡。

如果您嘗試在LAN上連接,那么訣竅是沙箱。

  • 為每個節點指定一個唯一的端口(如果正在偵聽)和rpcport(如果使用rpc)
  • 為每個節點指定唯一的數據目錄

使用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之間的區別

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM