比特股搭建多节点私链+水龙头+网页钱包总结

in bitshares •  6 years ago 

##比特股搭建私链(多节点)+钱包+网页钱包+水龙头##

[官方文档](http://docs.bitshares.org/testnet/index.html)基本说明了如何安装,但有些地方比较简洁,以下内容经过本人亲自实验,亲测可行。配置环境:ubuntu16.04桌面版和server版,注意boost和openssl版本;18.04配置失败,尝试过降低boost版本和openssl版本,以及gcc/g++版本,均未成功。

###注意事项###

由于是多个节点,首先得保证多台机器互相能ping通,在后续的配置文件中多处为127.0.0.1,都设置为相应的机器IP地址。仔细检查各个端口,避免端口配置错误,导致链接失败。启动顺序:先启动网络,再启动钱包,然后启动水龙头,最后启动网页钱包。

##part1:编译bitshares-core

ubuntu16.04按照[官网](https://github.com/bitshares/bitshares-core/wiki/BUILD_UBUNTU)流程即可

###1.安装依赖,ubuntu16.04的boost版本为1.58,不需要更新

sudo apt-get install libboost-all-dev

###2.下载编译

1.    git clone https://github.com/bitshares/bitshares-core.git

2.      cd bitshares-core

3.      git submodule update --init --recursive

4.    cmake -DBOOST_ROOT="$BOOST_ROOT" -DCMAKE_BUILD_TYPE=Release .

5.      make 

可能遇到的问题:第4步失败,查看错误输出,检查依赖版本;第5步失败,有教程使用make -j4,多线程编译,可能报错,申请不到足够的内存,解决方法,设置swap交换空间,可设大一下,有博客提够了解决方案,可参考。编译时间较长,干点其他事情,耐心等待。


编译后生成的文件在programs下,为方便使用,可设置软链接:


ln -s programs/witness_node/witness_node /usr/local/bin/witness_node

ln -s programs/cli_wallet/cli_wallet  /usr/local/bin/cli_wallet

之后但节点私链搭建已经钱包的使用可参考[比特股私有链环境搭建](https://www.jianshu.com/p/024ee9fcf8fc),2018.6月搭建,依然可行。PS:增加节点witness-id时,猜测需要相应的增加config.ini文件中的private-key和debug-private-key,这样多个节点不报错。

##part 2:多节点私链搭建

参考:[搭建你自己的比特股测试网(上篇) - How to build your own bitshares testnet (part I)](https://www.jianshu.com/p/0bd20134e9a2)和[搭建你自己的比特股测试网(下篇) - How to build your own bitshares testnet (part II)](https://www.jianshu.com/p/f84010835764)  

config.ini文件中需要修改的位置有:  


---

×1

 

    # Endpoint for P2P node to listen on  

    # p2p-endpoint =   

    p2p-endpoint = 0.0.0.0:8095  ##端口可以自定义

---

×2


    # JSON array of P2P nodes to connect to on startup

    # seed-nodes = 

    seed-nodes = []     ######### seed-nodes设置为空,否则会使用默认设置 ########

---

×3


    # Endpoint for websocket RPC to listen on

    # rpc-endpoint = 

    rpc-endpoint = 0.0.0.0:8090 ############# rpc的ip和端口 #########

---

×4


    # File to read Genesis State from

    # genesis-json = 

    genesis-json = test-net.json ######### 配置文件 #########

---

×5

 

    # Enable block production, even if the chain is stale.

     #enable-stale-production = false

    enable-stale-production = true ########## 设置改false为true ##############

---

×6增加了见证节点时,witness-id需要修改为对应的id和key


    # ID of witness controlled by this node (e.g. "1.6.5", quotes are required, may specify multiple times)

    # witness-id = 

    witness-id = "1.6.1"  ########### 添加见证节点#########

    # Tuple of [PublicKey, WIF private key] (may specify multiple times)

    private-key =        ["xxxxxxxxxxxxxxxxxxxxxxxxxxxxx","xxxxxxxxxxxxxxxxxxxxxxxxxxx"]

    # Tuple of [PublicKey, WIF private key] (may specify multiple times)

    debug-private-key = ["xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","xxxxxxxxxxxxxxxxxxxxxxx"]


##part3:搭建比特股的水龙头注册服务###

参考[官方文档](http://docs.bitshares.org/testnet/7-faucet.html),注意:


sudo rbenv install 2.2.3

sudo rbenv global 2.2.3

sudo gem install bundler

我在实验中加sudo会报错,找不到sudo rbenv 命令,不加sudo最终也配置成功。rbenv的安装可能会出问题,参考[rbenv](https://github.com/rbenv/rbenv#readme).配置参考[简书:搭建比特股的水龙头注册服务](https://www.jianshu.com/p/a89b3835d4e8)和[steemit:搭建比特股的水龙头注册服务 ](https://steemit.com/bitshares/@baidang/66din5).rail命令可能会报错,不要气馁,搜一搜解决方案。  

水龙头访问配置faucet.yml中的127.0.0.1都改为对应的ip地址,这样其他机器也能访问。  

rake secret会生成一个密钥,将这个密钥copy到config/secrets.yml中进行替换


###问题###

####问题1  

注册时,水龙头后台服务报异常Failed to create account: tes2 - Assert Exception: base58str.substr( 0, prefix_len ) == prefix。修改方法参见[steemit:搭建比特股的水龙头注册服务 ](https://steemit.com/bitshares/@baidang/66din5),作者测试了第二种方法,本人测试了第一种方法,可行,不需要重新编译,比较方便,ChainConfig.js文件在bitshares-ui/node_modules/bitsharesjs-ws/cjs/src/下,修改所有“GPH”为“BTS”,重新启动网页钱包。

####问题2

钱包只有在导入admin(nathan)帐号时才能create帐号,其他终身会员的帐号无法创建帐号,没找到解决方法。猜测为权限控制,需要获取某种权限。



Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Congratulations @joe-lee! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 1 year!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Vote for @Steemitboard as a witness to get one more award and increased upvotes!