Skip to content

Bookkeeping Node Deployment

DavidthePangwaer edited this page Feb 8, 2017 · 13 revisions

###Antshares Blockchain Bookkeeping Node Deployment on Windows Server

  1. System
  • CPU: Dual-Core+
  • RAM: 4G+
  • Bandwidth: 5M+
  • OS:
AntSharesUI AntSharesDaemon Miner
Windows 7 SP1 x64
Windows Server 2008 R2
  1. Environment
  1. Installation
  • Compile [Miner], or download it from our official website.
  • Copy [Miner] to the target server
  • Enable Firewall Port: 10332,10333,20332,20333
  • Run Miner.exe to initiate
    Miner.exe activates one bookkeeping node Miner.exe /rpc activates one bookkeeping node with RPC server

###Antshares Blockchain Bookkeeping Node Deployment in Linux

  1. System
  • CPU: Dual-Core+
  • RAM: 4G+
  • Bandwidth: 5M+
  • OS:
AntSharesUI AntSharesDaemon Miner
Ubuntu 14.04
Ubuntu 16.04
CentOS 7.1
Red Hat 7.1
  1. Linux Deployment Explained

The bookkeeping program is currently written in C#, thus an appropriate running environment is required to successfully run in Linux. The deployment comprises 2 steps.

  • Complete .Net Core running environment
  • Bookkeeping Node Deployment
  1. For .Net Core environment, check: .Net Core
  • Ubuntu 14.04
    • sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ trusty main" > /etc/apt/sources.list.d/dotnetdev.list'
    • sudo apt-key adv --keyserver apt-mo.trafficmanager.net --recv-keys 417A0893
    • sudo apt-get update
    • sudo apt-get install dotnet-dev-1.0.0-preview2-003131
  • Ubuntu 16.04
    • sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ trusty main" > /etc/apt/sources.list.d/dotnetdev.list'
    • sudo apt-key adv --keyserver apt-mo.trafficmanager.net --recv-keys 417A0893
    • sudo apt-get update
    • sudo apt-get install dotnet-dev-1.0.0-preview2-003131
  • CentOS 7.1
    • sudo yum install libunwind libicu
    • curl -sSL -o dotnet.tar.gz https://go.microsoft.com/fwlink/?LinkID=827529
    • sudo mkdir -p /opt/dotnet && sudo tar zxf dotnet.tar.gz -C /opt/dotnet
    • sudo ln -s /opt/dotnet/dotnet /usr/local/bin
  • RedHat Enterprise Linux 7 Server
    • subscription-manager repos --enable=rhel-7-server-dotnet-rpms
    • yum install scl-utils
    • yum install rh-dotnetcore10
    • scl enable rh-dotnetcore10 bash
  • If the installation is successful, check if the dotnet core environment is successfully installed with the following command:
    • mkdir hwapp
    • cd hwapp
    • dotnet new
    • dotnet restore
    • dotnet run
      image
  1. Bookkeeping Node Deployment
  • Compile [Miner], or download it from our official website.
  • Copy [Miner] to the target server
  • Enable Firewall Port: 10332,10333,20332,20333
  • Run AntSharesDaemon.dll to initiate
    dotnet AntSharesDaemon.dll activates one bookkeeping node
    dotnet AntSharesDaemon.dll /rpc activates one bookkeeping node with rpc server

###小蚁区块链记账结点Docker部署

  • docker 安装请参考网页:

https://www.docker.com/products/overview

  • 下载docker二进制程序安装包

curl -fsSLO https://get.daocloud.io/docker/builds/Linux/x86_64/docker-1.12.1.tgz

  • 安装docker

sudo tar --strip-components=1 -xvzf docker-1.12.1.tgz -C /usr/local/bin

  • 用daemon模式启动docker

/usr/local/bin/dockerd

如果报错:"Your kernel does not support cgroup memory limit",是因为cgroup没有在宿主机上挂载,编辑 /etc/fstab,增加一行"none /sys/fs/cgroup cgroup defaults 0 0"

sudo docker load < docker_image_antsharesdaemon.tar

  • 运行 antshares/antsharesdaemon 镜像

sudo docker run -it -p 10332:10332 -p 10333:10333 antshares/antsharesdaemon

其中-p为端口映射指令,10333为记账节点端口,10332为RPC服务端口,可在镜像中config.json与protocol.json文件里对端口进行修改。可在系统中使用指令"sudo docker port $CONTAINERID"查看端口映射情况。

  • 进入目录 /home/antshares/AntSharesDaemon

  • 编辑配置文件 config.json,DataDirectoryPath表示区块数据存储目录,NodePort表示客户端端口号

  • 编辑配置文件 protocol.json,Magic表示协议标识,CoinVersion用于控制地址的第一个字母,StandbyMiners表示默认记账人公钥列表,SeedList代表种子结点列表

  • 通过 dotnet 开启记账结点,并打开 rpc 服务

dotnet AntSharesDaemon.dll /rpc

(如果报错 KeyNotFoundException,很有可能是修改配置前已经运行过一次Miner结点了,解决的方法是将/Miner目录下的/Chain目录删除后再运行)

Clone this wiki locally