区块链侧链应用开发平台Asch节点安装及区块生产教程

1 系统要求

  • 必须是linux系统
  • 必须有公网ip
  • 建议使用ubuntu 14.04 64位
  • 建议内存1G以上
  • 建议带宽2Mb以上
2 安装 2.1 下载
wget https://www.asch.so/downloads/asch-linux-0.9.5-testnet.tar.gz tar zxvf asch-linux-0.9.5-testnet.tar.gz

2.2 初始化 这一步会自动帮您做以下几件事情
  1. 安装sqlite3等依赖软件
  2. 安装和配置ntp服务,保证您的时间与其他节点同步
这一步只需要运行一次即可
cd asch-linux-0.9.5-testnet ./aschd configure

3 运行
cd asch-linux-0.9.5-testnet# 启动 ./aschd start# 停止 ./aschd stop# 查看运行状态 ./aschd status# 重启 ./aschd restart# 升级 ./aschd upgrade# 重新同步区块 ./aschd rebuild# 重建索引 ./aschd reindex# 查看版本 ./aschd version# 查看log tail -f logs/debug.log

4 受托人配置 4.1 受托人密码 使用文本编辑工具打开config.json, 找到secret字段,将你的受托人密钥填进去即可,该字段为json字符串数组,一台机器可以配置多个,但不能重复

注意 不管是一台机器还是多台机器,不要配置重复的受托人密钥
4.2 公网IP 默认情况下,系统会自动检测公网ip,但在某些云主机中,公网ip无法检测到,这时需要手动在config.json修改或添加如下字段
"publicIp": "此处填写你的公网ip",

配置完之后需要重启程序
./aschd restart

5 升级
./aschd upgrade

6 命令行工具 命令行工具可以完成所有钱包的功能,包括账户登录及查询、区块链和交易查询、受托人查询,还可以创建、签署并广播任意的交易数据
6.1 安装方法
npm install -g asch-cli

6.2 使用示例 随机生成新账户
asch-cli crypto -g

使用公钥登录账户
asch-cli openaccountbypublickey 8a601534d1638884e523bc0f4fc29eaa4c0f7d2fdc8ca3a9b03d3fa8e4abd04c

使用密码登录账户
asch-cli openaccount "your secret"

转账
asch-cli sendmoney -e "your secret" -t 9519461517002147305 -a 38.38

有二级密码后的转账
asch-cli sendmoney -e "your secret" -s "your second secret" -t 9519461517002147305 -a 38.38

查看某个区块信息
asch-cli getblockbyid 16006382490436415348 asch-cli getblockbyheight 1

批量查询区块
asch-cli getblocks --offset 10 --limit 3 --sort height:asc

批量查询交易
asch-cli gettransactions --type 2 --limit 2

投票
asch-cli upvote --secret "your secret" --publicKeys 45cbab2f997766925398e1b6eb7784a0bd3fbeff9bdda74d8da9bc645f974a5e,2cd541cf50a4a8641b9e6e2613aeeaa1614dc43f6756829fb45c990e5b6ff873# 一次投多个,公钥列表用逗号分隔

更多命令行功能请使用help选项查看
asch-cli --help Usage: asch-cli [options] [command] Commands: getheightget block height getblockstatusget block status openaccount [secret]open your account and get the infomation by secret openaccountbypublickey [publickey]open your account and get the infomation by publickey getbalance [address]get balance by address getaccount [address]get account by address getvoteddelegates [options] [address]get delegates voted by address getdelegatescountget delegates count getdelegates [options]get delegates getvoters [publicKey]get voters of a delegate by public key getdelegatebypublickey [publicKey]get delegate by public key getdelegatebyusername [username]get delegate by username getblocks [options]get blocks getblockbyid [id]get block by id getblockbyheight [height]get block by height getpeers [options]get peers getunconfirmedtransactions [options]get unconfirmed transactions gettransactions [options]get transactions gettransaction [id]get transactions sendmoney [options]send money to some address registerdelegate [options]register delegate upvote [options]vote for delegates downvote [options]cancel vote for delegates setsecondsecret [options]set second secret contract [options]contract operations crypto [options]crypto operations dapps [options]manage your dapps creategenesiscreate genesis block Options: -h, --helpoutput usage information -V, --versionoutput the version number -H, --hostSpecify the hostname or ip of the node, default: 127.0.0.1 -p, --port Specify the port of the node, default: 4096

【区块链侧链应用开发平台Asch节点安装及区块生产教程】 子命令帮助查询
asch-cli-h

    推荐阅读