Skip to content

Achain_Dev_Guide

Achain edited this page Oct 13, 2017 · 3 revisions

1.启动Achain钱包程序
将Achain-c.exe拖入cmd ,输入空格,再把后面的一串字符复制过去 —server —rpcuser a —rpcpassword b —rpcport 12345 —data-dir D:\Achain\test
(注:D:\Achain\test 可替换为任一文件夹,它是Achain钱包的数据路径;rpcuser、password、port亦可自己指定)

Input:
C:\Users\zgx\Desktop>F:\Achain_test\IDE\Achain\Achain-c.exe —server —rpcuser a —rpcpassword b —rpcport 12345 —data-dir D:\Achain\test

Output:
Loading blockchain from: D:\Achain\test\chain
Creating default config file at: D:\Achain\test\config.json
Logging to file: D:\Achain\test\logs\default\default.log
Logging RPC to file: D:\Achain\test\logs\rpc\rpc.log
Logging blockchain to file: D:\Achain\test\logs\blockchain\blockchain.log
Logging P2P to file: D:\Achain\test\logs\p2p\p2p.log
Using blockchain checkpoints from file: D:\Achain\test\checkpoints.json
Initializing state from built-in genesis file
Please be patient, this will take several minutes…
Successfully replayed 0 blocks in 0 seconds.
Blockchain size changed from 0MiB to 0MiB.
Starting JSON RPC server on port 12345 (localhost only)
Starting HTTP JSON RPC server on port 52720 (localhost only)

2.wallet_create:创建钱包

Input:
wallet_create abc 12345678

Output:
OK

释义:
abc:指定一个钱包名,1~63位,小写字母开头,可以包含小写字母和数字
12345678:钱包密码,8位以上任意字符
(注:钱包创建后,自动进入打开并解锁状态)

3.wallet_close:如果钱包是打开状态,就关闭它

Input:
wallet_close

Output:
OK

4.wallet_open:如果钱包是关闭状态,就打开它

Input:
wallet_open abc

Output:
OK

5.wallet_unlock:钱包打开后是锁定状态,需要解锁钱包

Input:
wallet_unlock 9999 12345678

Output:
OK

释义:9999是解锁时间,单位是秒;12345678是钱包密码

6.wallet_lock:锁定钱包

Input:
wallet_lock

Output:
OK

7.wallet_account_create:创建一个账户,调用前提:钱包解锁

Input:
wallet_account_create a1

Output:
ACT2ZD4jfLbt6tMz2ubAaU6BmmcZ5kwVW36x

释义:a1是指定账户名,1~63位,小写字母开头,可以包含小写字母和数字
返回账户地址

8.blockchain_get_info:查询blockchain的信息和设定参数

Input:
blockchain_get_info

Output:
{
“blockchain_id”: “6701c01c6042098645e0ed939fa78649bd10c2877af609fa0cad12da62690f97”,
“name”: “ACT”,
“symbol”: “ACT”,
“address_prefix”: “ACT”,
“db_version”: 201,
“genesis_timestamp”: “2017-09-07T02:08:11”,
“block_interval”: 10,
“delegate_num”: 99,
“max_delegate_pay_issued_per_block”: “5.00005 ACT”,
“max_delegate_reg_fee”: “6,109.09090 ACT”,
“name_size_max”: 63,
“memo_size_max”: 2048,
“data_size_max”: 65536,
“symbol_size_max”: 8,
“symbol_size_min”: 3,
“asset_shares_max”: “1000000000000000”,
“short_symbol_asset_reg_fee”: “500,000.00000 ACT”,
“long_symbol_asset_reg_fee”: “500.00000 ACT”,
“statistics_enabled”: false,
“relay_fee”: “0.01000 ACT”,
“max_pending_queue_size”: 10000,
“max_trx_per_second”: 1000,
“min_block_fee”: “0.00000 ACT
}

释义:
“blockchain_id”: blockchain的id
“name”: blockchain的名称
“symbol”: 资产符号
“address_prefix”: 地址前缀
“db_version”: blockchain的数据版本
“genesis_timestamp”:创世块的创建时间
“block_interval”:出块时间间隔
“delegate_num”: 产块代理数
“max_delegate_pay_issued_per_block”: 代理最大可获得的产块奖励
“max_delegate_reg_fee”: 注册代理的费用
“name_size_max”: 账户名最大长度限制
“memo_size_max”: 备注长度限制
“data_size_max”: 用户公开数据最大长度
“symbol_size_max”:资产符号最大长度
“symbol_size_min”: 资产符号最小长度
“asset_shares_max”: 资产发行数量最大限制
“short_symbol_asset_reg_fee”:最短资产符号注册费用
“long_symbol_asset_reg_fee”: 最长资产符号注册费用
“statistics_enabled”: 是否打开统计模式
“relay_fee”: 交易手续费
“max_pending_queue_size”: pending区队列最大长度
“max_trx_per_second”: 最大每秒交易数
“min_block_fee”: 最小每块手续费

9.disk_usage:显示当前数据占用的磁盘空间

Input:
disk_usage

Output:
{
“blockchain”: “25 MiB”,
“dac_state”: “93 MiB”,
“logs”: “18 MiB”,
“mail_client”: null,
“mail_server”: null,
“network_peers”: “258 KiB”,
“wallets”: {
“.backups”: “3 KiB”,
“abc”: “6 MiB”
},
“total”: “142 MiB”
}

释义:
“blockchain”: chain数据占用空间
“dac_state”: 本地数据占用空间
“logs”: 日志占用空间
“mail_client”: 保留字段
“mail_server”: 保留字段
“network_peers”: 网络连接池占用空间
“wallets”: {
“.backups”: 备份占用空间
“abc”: 钱包abc占用空间
},
“total”: 总计占用空间

10.blockchain_is_synced:本地区块链是否已经和网络同步

Input:
blockchain_is_synced

Output:
true

11.blockchain_get_block_count:查询当前总共有多少块

Input:
blockchain_get_block_count

Output:
103692

12.blockchain_list_active_delegates:以签署区块的顺序传回当前轮的现任受托人信息

Input:
blockchain_list_active_delegates 0 10

Output:
NAME APPROVAL PRODUCED MISSED RELIABILITY PAY RATE PAY BALANCE LAST BLOCK VERSION
===========================
aab68 0.99042841 % 1047 1 99.90 % 100 % 5,235.05793 ACT 103672
aab60 0.99042841 % 1047 1 99.90 % 100 % 5,235.05795 ACT 103673
aab42 0.99042841 % 1047 1 99.90 % 100 % 5,235.05795 ACT 103674
aab17 0.99232034 % 1049 0 100.00 % 100 % 5,245.05802 ACT 103675
aab53 0.99137439 % 1048 1 99.90 % 100 % 5,240.05802 ACT 103676
aab48 0.99137437 % 1048 0 100.00 % 100 % 5,240.05794 ACT 103677
aab87 0.99137439 % 1048 0 100.00 % 100 % 5,240.05802 ACT 103678
aab9 0.99232034 % 1049 0 100.00 % 100 % 5,245.05802 ACT 103679
aab56 0.99232034 % 1049 0 100.00 % 100 % 5,245.05803 ACT 103680
aab10 0.98948246 % 1046 2 99.81 % 100 % 5,230.05795 ACT 103681

释义:
blockchain_list_active_delegates 0 10:0是起始顺序号,10是返回数量

NAME:受托人账户名
APPROVAL:受托人得票率
PRODUCED:产块数量
MISSED:未产块数量
RELIABILITY:出勤率
PAY RATE:支付率
PAY BALANCE:工资
LAST BLOCK:最近一次产块的块号

13.network_get_info:获取当前网络信息

Input:
network_get_info

Output:
{
“listening_on”: “0.0.0.0:61696”,
“node_public_key”: “031077530dbe775e41ed09079f90cb1a1b36860a8054545e0858dc057631495b45”,
“node_id”: “b142af5aff8903ff52c4f69dff0c7e232186e62d1100ee3059e3c7508a5bef022a”,
“firewalled”: “firewalled”
}

释义:
“listening_on”: 客户端监听地址和端口
“node_public_key”: 节点与节点之间加密通讯使用的公钥
“node_id”: 节点id,每次启动客户端都会重新生成一个,为了可以多次连接同一个节点
“firewalled”: 是否在防火墙后面

14.network_get_connection_count:获取当前节点连接数

Input:
network_get_connection_count

Output:
2

15.network_get_peer_info:传回每一个已经连接的节点信息

Input:
network_get_peer_info

Output:
[{
“addr”: “47.91.243.208:61696”,
“addrlocal”: “10.23.0.220:61696”,
“services”: “00000001”,
“lastsend”: 1505799451,
“lastrecv”: 1505799451,
“bytessent”: 53920,
“bytesrecv”: 269760,
“conntime”: “2017-09-19T02:45:08”,
“pingtime”: "",
“pingwait”: "",
“version”: "",
“subver”: “act_client”,
“inbound”: false,
“firewall_status”: “firewalled”,
“startingheight”: "",
“banscore”: "",
“syncnode”: "",
“thinkyoung_git_revision_sha”: “7e7f255f185ffaf53397084f6ca747674088f176 (same as ours)”,
“thinkyoung_git_revision_unix_timestamp”: “2017-03-04T21:45:57”,
“thinkyoung_git_revision_age”: “28 weeks ago (same as ours)”,
“fc_git_revision_sha”: “0 (same as ours)”,
“fc_git_revision_unix_timestamp”: “1970-01-01T00:00:00”,
“fc_git_revision_age”: “47 years ago (same as ours)”,
“platform”: “win32”,
“current_head_block_number”: 104716,
“current_head_block”: “21f300dea1622070cf086cd973a04787a20ca29f”,
“current_head_block_time”: “2017-09-19T05:37:30”
},{
“addr”: “47.91.234.145:61696”,
“addrlocal”: “10.23.0.220:61696”,
“services”: “00000001”,
“lastsend”: 1505799445,
“lastrecv”: 1505799451,
“bytessent”: 25312,
“bytesrecv”: 75488,
“conntime”: “2017-09-19T02:45:08”,
“pingtime”: "",
“pingwait”: "",
“version”: "",
“subver”: “act_client”,
“inbound”: false,
“firewall_status”: “not_firewalled”,
“startingheight”: "",
“banscore”: "",
“syncnode”: "",
“thinkyoung_git_revision_sha”: “7e7f255f185ffaf53397084f6ca747674088f176 (same as ours)”,
“thinkyoung_git_revision_unix_timestamp”: “2017-03-04T21:45:57”,
“thinkyoung_git_revision_age”: “28 weeks ago (same as ours)”,
“fc_git_revision_sha”: “0 (same as ours)”,
“fc_git_revision_unix_timestamp”: “1970-01-01T00:00:00”,
“fc_git_revision_age”: “47 years ago (same as ours)”,
“platform”: “win32”,
“current_head_block_number”: 104716,
“current_head_block”: “21f300dea1622070cf086cd973a04787a20ca29f”,
“current_head_block_time”: “2017-09-19T05:37:30”
}
……
]

释义:
“addr”: 连接的节点ip和端口号
“addrlocal”: 本地ip和端口号
“services”: 保留字段
“lastsend”: 最后一次发送时间
“lastrecv”: 最后一次接收时间
“bytessent”: 发送字节数
“bytesrecv”: 接收字节数
“conntime”: 连接时间
“pingtime”: 保留字段
“pingwait”: 保留字段
“version”: 版本
“subver”: 保留字段
“inbound”: 保留字段
“firewall_status”: 防火墙状态
“startingheight”: 保留字段
“banscore”: 保留字段
“syncnode”: 保留字段
“thinkyoung_git_revision_sha”: git版本
“thinkyoung_git_revision_unix_timestamp”: git时间戳
“thinkyoung_git_revision_age”: git版本时间长度
“fc_git_revision_sha”: fc库的版本
“fc_git_revision_unix_timestamp”: fc库的git时间戳
“fc_git_revision_age”: fc库的git版本时间长度
“platform”: 平台
“current_head_block_number”: 当前块的高度
“current_head_block”: 当前块的hash
“current_head_block_time”: 当前块的时间

16.network_add_node:手动添加连接节点

Input:
network_add_node 47.91.234.145:61696

Output:
OK

17.validate_address:判断输入的公钥是否合法

Input:
validate_address ACT6ova1uPKJY4FFqASGNy5FAdUPqtH5Xo8s4kGTjGmHDNYa3Z4ov

Output:
{
“isvalid”: true
}

18.ntp_update_time:更新NTP时间

Input:
ntp_update_time

Output:
OK

19.blockchain_get_account:获取链上指定帐号的详细信息

Input:
blockchain_get_account j

Output:
Name: j
Registered: 2017-10-13T06:41:20
Last Updated: 4 minutes ago
Owner Key: ACT66ALr6fiAiPV7FTxx4qtB2E1QNhK39kts78Pcu18yxHoPyQJU7
Active Key History:
- ACT6ova1uPKJY4FFqASGNy5FAdUPqtH5Xo8s4kGTjGmHDNYa3Z4ov, last used 4 minutes ago
Not a delegate.

20.blockchain_generate_snapshot:返回当前基础资产分配的快照

Input:
blockchain_generate_snapshot C:\Users\zgx\Desktop\1.txt

Output:
OK

21.blockchain_get_balance:获取指定的balance_id下的余额记录

Input:
blockchain_get_balance ACTLpeEfS8s63FQs8JGPrd4fY5RKA3MHMnJr

Output:
{
“condition”: {
“asset_id”: 0,
“slate_id”: 0,
“type”: “withdraw_signature_type”,
“balance_type”: “withdraw_common_type”,
“data”: {
“owner”: “ACTNpNjVq3DFec93btodYELMtWe5oW3BVryx”
}
},
“balance”: 1192608991,
“deposit_date”: “2017-10-13T01:09:12”,
“last_update”: “2017-10-13T06:34:50”,
“meta_data”: null
}

释义:
“condition”:金额信息结构体
"balance":金额(精度10的5次方)
"deposit_date":余额增加的时间
"last_update":最近balance更新时间
"meta_data":保留字段

22.blockchain_list_key_balances:列出被指定公钥拥有的balance

Input:
blockchain_list_key_balances ACT66ALr6fiAiPV7FTxx4qtB2E1QNhK39kts78Pcu18yxHoPyQJU7

Output:
[[
“ACT2rDYwBT8PiJJRv8fnGJwF77gbhXD4NMN5”,{
“condition”: {
“asset_id”: 0,
“slate_id”: 0,
“type”: “withdraw_signature_type”,
“balance_type”: “withdraw_common_type”,
“data”: {
“owner”: “ACTz7Z7bUHEqrB23NkxGGRAvV6SqpzEitWL”
}
},
“balance”: 16724000,
“deposit_date”: “2017-10-12T04:29:17”,
“last_update”: “2017-10-13T06:41:20”,
“meta_data”: null
}
]
]

释义:
"ACT2rDYwBT8PiJJRv8fnGJwF77gbhXD4NMN5":balance_id
"condition":金额信息结构体
"balance":金额(精度10的5次方)
"deposit_date":余额增加的时间
"last_update":最近balance更新时间
"meta_data":保留字段

23.blockchain_list_accounts:传回已注册的帐号名称, 从指定的帐号名称开始, 直到所提供的数量上限结束

Input:
blockchain_list_accounts ab 5

Output:
NAME (* delegate) KEY REGISTERED VOTES FOR APPROVAL
-——————————————————————————————————————————————————————————————————————————
achain ACT7SzkpEPVRMXFEEWXJurkMmrAPR5hpTCGGa1Ck1nEGBrkQ33Ckv 2017-09-19T08:10:30 N/A N/A
act0 ACT4zXBbRCFYrJkeUMFYUcpyo1CztdVZ39CGTKeEeCLqRMtgaXUQs 2017-09-19T08:09:50 N/A N/A
j ACT6ova1uPKJY4FFqASGNy5FAdUPqtH5Xo8s4kGTjGmHDNYa3Z4ov 2017-10-13T06:41:20 N/A N/A
jiangt ACT68w5hNEJHrbVAfnTtrTowPbnBWT8mLxN69R1gBC1vsjwcYXqMc 2017-09-21T02:24:50 N/A N/A
jiangtao1099140292 ACT8MEPoQjzsMsYD1WsweEzZFTwDkQcBgGsmWc8PmNN8mUggXhfaR 2017-09-21T02:30:30 N/A N/A

24.blockchain_list_pending_transactions:传回尚未收录进区块的交易列表信息发送消息

Input:
blockchain_list_pending_transactions

Output:
No pending transactions

25.blockchain_get_transaction:获取一笔区块链上转帐的详细信息交易

Input:
blockchain_get_transaction 3985e45599eed79adf39dd8bffded6f1d55ab40d

Output:
[
“3985e45599eed79adf39dd8bffded6f1d55ab40d”,{
“trx”: {
“expiration”: “2017-10-13T06:36:52”,
“alp_account”: "",
“alp_inport_asset”: {
“amount”: 0,
“asset_id”: 0
},
“operations”: [{
“type”: “withdraw_op_type”,
“data”: {
“balance_id”: “ACTLpeEfS8s63FQs8JGPrd4fY5RKA3MHMnJr”,
“amount”: 101000,
“claim_input_data”: ""
}
},{
“type”: “deposit_op_type”,
“data”: {
“amount”: 100000,
“condition”: {
“asset_id”: 0,
“slate_id”: 0,
“type”: “withdraw_signature_type”,
“balance_type”: “withdraw_common_type”,
“data”: {
“owner”: “ACTFwaNoEd3c1iKieGHAwSrXMAYbprGn1NJu”
}
}
}
}
],
“result_trx_type”: “origin_transaction”,
“result_trx_id”: “0000000000000000000000000000000000000000”,
“signatures”: [
“1f2b2df7c7a82c722829c495129f20b8c14cff5dabb49c003563887a84ab70a5e404599c7122dc8c109b50015285da017c941c1350d09caf6edfa1749b794a455c”
]
},
“signed_keys”: [],
“deposits”: [[
0,
100000
]
],
“withdraws”: [[
0,
101000
]
],
“yield”: [],
“deltas”: [[
0,[[
0,
-101000
]
]
],[
1,[[
0,
100000
]
]
]
],
“required_fees”: {
“amount”: 0,
“asset_id”: 0
},
“alt_fees_paid”: {
“amount”: 0,
“asset_id”: 0
},
“balance”: [[
0,
1000
]
],
“delegate_vote_deltas”: [],
“imessage_length”: 0,
“skipexec”: true,
“chain_location”: {
“block_num”: 299218,
“trx_num”: 0
}
}
]

26.blockchain_list_delegates:查询指定范围代理的详细信息

Input:
blockchain_list_delegates 0 5

Output:
ID NAME (* next in line) APPROVAL PRODUCED MISSED RELIABILITY PAY RATE PAY BALANCE LAST BLOCK VERSION
==============================
25 aab24 1.01002618 % 3036 130 95.89 % 100 % 15,247.50668 ACT 299884
60 aab59 1.01002576 % 3036 129 95.92 % 100 % 15,247.50038 ACT 299842
10 aab9 1.01002234 % 3036 130 95.89 % 100 % 15,247.44876 ACT 299852
15 aab14 1.01002037 % 3036 130 95.89 % 100 % 15,247.41894 ACT 299849
72 aab71 1.01001905 % 3036 131 95.86 % 100 % 15,247.39907 ACT 299897

27.blockchain_list_blocks:返回指定范围区块的详细信息

Input:
blockchain_list_blocks 50 3

Output:
HEIGHT TIMESTAMP SIGNING DELEGATE # TXS SIZE LATENCY PROCESSING TIME RANDOM SEED
=============================
50 2017-09-07T02:45:40 aab85 0 166 0 0 0000000000000000000000000000000000000000
49 2017-09-07T02:45:30 aab84 0 166 0 0 0000000000000000000000000000000000000000
48 2017-09-07T02:45:20 aab83 0 166 0 0 0000000000000000000000000000000000000000

28.blockchain_get_block_signee:查询指定区块的签名代理是谁

Input:
blockchain_get_block_signee 589

Output:
“aab67”

29.network_list_potential_peers:获取潜在连接点列表

Input:
network_list_potential_peers

Output:
ENDPOINT LAST SEEN LAST CONNECT ATTEMPT SUCCESSFUL CONNECT ATTEMPTS FAILED CONNECT ATTEMPTS LAST CONNECTION DISPOSITION LAST ERROR
47.91.243.208:61696 2017-10-13T08:39:46 2017-10-13T03:01:17 27 14 last_connection_handshaking_failed0 exception: unspecified
Terminating handshaking connection due to inactivity of 10 seconds. Negotiating status: connecting, bytes sent: 0, bytes received: 0
{"peer":“47.91.243.208:61696”,timeout,“status”:“connecting”,sent,received
p2p Node.cpp:1320 thinkyoung::net::detail::NodeImpl::terminate_inactive_connections_loop
47.91.234.145:61696 2017-10-13T08:39:46 2017-10-13T03:00:47 23 12 last_connection_succeeded0 exception: unspecified
Terminating handshaking connection due to inactivity of 10 seconds. Negotiating status: connecting, bytes sent: 0, bytes received: 0
{"peer":“47.91.234.145:61696”,timeout,“status”:“connecting”,sent,received
p2p Node.cpp:1320 thinkyoung::net::detail::NodeImpl::terminate_inactive_connections_loop

30.network_get_upnp_info:查询UPNP基本信息

Input:
network_get_upnp_info

Output:
{
“upnp_enabled”: true,
“external_ip”: “0.0.0.0”,
“mapped_port”: “0”
}

Clone this wiki locally