1. Home
  2. Docs
  3. Paralism节点CLI操作指引
  4. 附录

附录

安装Paralism节点

下载

访问 https://www.paralism.com,点击首页的节点下载链接,选择下载Paralism节点专业版。根据自己的主机系统选择Windows版还是Linux版。

Windows 环境安装

运行已下载的安装文件,进入安装向导界面,点击“下一步”按钮。

选择节点程序安装目录,默认安装路径在系统C盘,建议使用其他磁盘分区安装,并与节点的数据存放目录分离,避免误操作删除节点数据和钱包数据。设置安装目录后,点击“下一步”。

选择节点系统软件要安装的组件,选择默认配置,点击“下一步”。

确认程序安装所在分区具有空间的存储空间,点击“下一步”。

查看安装进度,完成时点击“下一步”。

安装完成,点击“完成”按钮。

进入Paralism节点程序安装路径的bin目录参考informal.cfg编辑用户自定义的启动配置文件保存,例如自定义formal.cfg配置本机ip和程序监听端口,引导服务器,区块链数据存放目录。如下图。

启动windows终端cmd命令行,cd命令进入bin目录,输入hc.exe -conf=formal.cfg可启动节点程序。

CentOS下安装

将下载的节点rpm包安cp拷贝到预备的安装目录。

安装需要root权限,sudo进入root状态,输入rpm –ivh <rpm包名>启动节点软件安装。

安装完成,输入命令ll后出现bin文件夹,为节点软件存放执行文件的目录。

在bin目录之下,hyperchain为节点启动可执行文件,test.cfg为启动配置参考文件,用户可gedit或vim编写自定义的启动配置文件。

编辑完配置文件后,输入./hyperchain -conf=<配置文件名>.cfg启动节点运行。

如果配置文件with字段指定了加载paracoin模块,节点启动后终端显示“…paracoin is started”,表明节点可正常启动,且paracoin应用正常加载。

节点程序启动参数

节点程序windows版为hc.exe,Linux版为hyperchain,程序的启动参数相同。启动参数如下

  • -me           配置本节点IP地址和UDP通信端口,默认为20000。
  • -seedserver       配置加密货币链引导节点IP地址和UDP通信端口。
  • -daemon        执行后台运行,目前在linux下开放
  • -model         配置接入Paralism基础网络的网络类型,informal代表测试网,sandbox代表沙盒网。
  • -with          选择加载运行挖矿加密货币组件,ledger代表分布式账本货币,paracoin代表可挖矿加密货币。
  • -datadir         配置挖矿节点数据存储位置。
  • -rpcledgeport    设置分布式账本组件的RPC访问端口,默认值为8119。
  • -rpcparaport      设置加密货币组件RPC访问端口,默认值为8118。
  • -rpcallowip       配置RPC访问的IP地址白名单,默认IP为127.0.0.1。
  • -rpcuser        设置通过RPC端口访问节点的用户名。
  • -rpcpassword    设置通过RPC端口访问节点的密码。
  • -conf           设置节点启动加载配置文件,配置文件中为启动参数。

组建私有链指引

准备两台主机,Windows或linux不限,seedserver互相指定对方为引导服务器。先启动一个节点,例如:

hc.exe -me=192.168.1.23:8999 -model=sanbox  -with=ledger -with=paracoin -rpcpassword=a -rpcallowip=*.*.*.* -gen -datadir=.\2 -server=78999  -pangu

节点启动后进入hc$命令行界面即表示启动成功。

在Linux主机启动另一个节点,启动时设置为daemon守护进程方便远程监控管理,例如:

./hc -me=192.168.1.195: 8999 –seedserver=192.168.1.23:8999 -pangu -with=paracoin -rpcpassword=a -rpcallowip=*.*.*.* –server=12000 -gen -daemon

节点启动成功将连接第一个节点进行组网。

Windows下远程连接查看linux节点运行状态命令如下:

hc.exe –connect=192.168.1.195:12000

节点连接后进入hc$命令行界面即表示连接成功。

节点操作命令参考

  1. help(?): show all available commands

  2. /h : show history of commands 。
  3. node(n): show neighbor node information

  4. space(sp): show HyperChain-Space information

  5. spacemore(spm): show a specified hyper block from Hyperchain Space more information

  6. local(l): show local data information

  7. down(d): download a specified hyper block from HyperChain-Space to local

  8. search(se): search detail information for a number of specified hyper blocks, show child chains with ‘v’

  9. submit(sm):submit data to the chain

  10. query(qr):query status of the submitted data on the chain

  11. inner(i): show inner information

  12. debug: set debug application log output destination.

  13. resolve(rs): resolve the specified data into a kind of application

  14. token(t):control or show tokens
    1. token ls:list all local imported tokens

    2. token ll :display the default/specified token details

    3. token df:query or set the default token, after restarting ledger it will take effect

    4. token iss: issue a token, ‘token iss’ for help

    5. token imp:import a token

    6. token acc: query account balances

    7.  token addr: query account addresses
      输入token addr + [account],获取token账户的地址。

    8. token sendtoaddr: transfer

    9. token e: enable to generate blocks
    10. token d: disable to generate blocks
    11. token gkp: generate a public-private key pair

    12. token ikp: import a public-private key pair
  15. coin(c):control or show coins
    1. coin ls: list all local imported coins

    2.  coin ll : display the default/specified coin details

    3. coin df: query or set the default coin, after restarting paracoin, it takes effect

    4.  coin iss: issue a coin

    5.  coin imp: import a coin

    6.  coin acc: query account balances

    7. coin addr : query account addresses

    8.  coin sendtoaddr: transfer

    9. coin e: enable mining

    10. coin d: disable mining

  16. start: load and start the specified application:
    start ledger/paracoin [options]
    start paracoin -debug –gen

  17. stop: stop and unload the specified application:
    stop ledger/paracoin

  18. app:list the loaded applications and their status

  19. loggerlevel(ll): set logger level [trace=0,debug=1,info=2,warn=3,err=4,critical=5,off=6]
  20. consensusloggerlevel(llcss):
    set consensus logger level
    [trace=0,debug=1,info=2,warn=3,err=4,critical=5,off=6]
  21. vm: run a javascript script or add a javascript script block to chain
    vm run -f Debug the. js contract code file
    vm run + contract code snippet, debugging contract code snippets
    vm + add/addmodule+Deploy contract to the chain
    vm + call + [hyperblockid chainid localblockid] calls the smart contract deployed on the chain.
    For example, store the following smart contract code in the hcvmtest.js file and place it in the bin directory:
    ——————————————————————————————————————————————————
    class Student {
    constructor(name,sex, age) {
    this.name = name;
    this.sex = sex;
    this.age = age;
    }
    toString() {
    return 'The Student is ' + this.name + ', and sex is ' + this.sex + ', age is ' + this.age;
    }
    }
    var s=new Student("bob", "male", 18);
    s.toString();
    ——————————————————————————————————————————————————
    Enter vm run – f hcvmtest.js after hc $to run the contract code:

    After hc $, enter vm add – f hcvmtest.js to deploy the contract on the chain, obtain a query handle, and successfully deploy. Obtain the parallel chain triple address of the contract on the chain through the query handle, and then use the vm call command to call:
  22. exit(quit/q): exit the program

Articles

Was this article helpful to you? Yes No 1