节点RPC接口操作命令大全
别名:alias tcli="amcli -u https://chain.amaxtest.com"
测试钱包相关
功能操作
命令格式
备注
创建新的钱包
tcli create wallet -n $wallet_name
加载钱包
tcli open wallet -n $wallet_name
解锁钱包
tcli wallet unlock -n $wallet_name --password $password
可以用 ut 别名命令来快速解锁环境内测试钱包
列举钱包
tcli wallet list
返回钱包列表
列举钱包所有公钥
tcli wallet keys
列举钱包所有公私钥对
tcli wallet private_keys -n test --password $password
返回公私钥对列表
创建公私钥对
tcli create key --to-console
返回公私钥对信息
导入私钥
tcli wallet import -n $wallet_name --private-key $priv_key
返回公私信息
测试账户相关
功能操作
命令格式
备注
获取账户信息
tcli get account $account_name
E.g. tcli get account amax
注册账号
tcli system newaccount $creator --transfer $acct $pubkey \ --stake-net "0.1 AMAX" --stake-cpu "0.1 AMAX" --buy-ram-kbytes 10240 \ -p ${creator}@active
质押币的数量:NET和CPU,可以根据实际情况调节;
购买的RAM数量:可以根据实际情况调节;
为目标账户购买RAM
tcli system buyram $buyer $receiver -k 40960
E.g. tcli system buyram armoniaadmin aplinknewbie -k 40960
获取账户余额信息
tcli get currency balance $token_contract $account $symbol
E.g. tcli get currency balance amax.token usera AMAX
测试交易相关
功能操作
命令格式
备注
转账AMAX
tcli transfer $from $to $quantity $memo tcli push action amax.token transfer '["$from","$to","$quantity","$memo"]' -p $from
tcli transfer amax armoniaadmin "100 AMAX" "test" tcli transfer armoniaadmin usera "10.08 AMAX" "" tcli push action amax.token transfer '["amax","armoniaadmin","100 AMAX","test"]' -p amax tcli push action amax.token transfer '["armoniaadmin","usera","10.08 AMAX",""]' -p armoniaadmin
转账其它合约币
tcli transfer -c amax.mtoken $from $to $quantity $memo tcli push action amax.mtoken transfer '["$from","$to","$quantity","$memo"]' -p $from
tcli transfer -c amax.mtoken armoniaadmin usera "10 MUSDT" "test" tcli transfer -c amax.mtoken usera userb "1.08 USDT" "" tcli push action amax.mtoken transfer '["armoniaadmin","usera","10 MUSDT","test"]' -p armoniaadmin tcli push action amax.mtoken transfer '["usera","userb","1.08 AMAX",""]' -p userb
创建新的代币
tcli push action $token_contract create '[ "$symbol", "$total_supply" ]' -p $token_contract@active
tcli push action amax.token create '[ "amax", "1000000000.00000000 XYZ" ]' -p amax.token@active
发行新的代币
tcli push action $token_contract issue '[ "$symbol", "$total_supply", "" ]' -p $token_contract@active
tcli push action amax.token issue '[ "amax", "900000000.00000000 AMAX", "" ]' -p amax@active
测试合约相关
功能操作
命令格式
备注
部署合约
tcli set contract $con ./build/contracts/$contract_dir -p ${con}@active
必须事先创建好合约账户 $con
更新合约
ditto
调用合约
tcli push action $contract_name $action_name $params -p $issuer
E.g. tcli push action currencyview view '["armoniaadmin"]' -p usera
查询数据相关
功能操作
命令格式
备注
功能操作
命令格式
备注
查询币的统计信息
tcli get currency stats $token_contract $symbol
tcli get currency stats amax.token AMAX tcli get currency stats aplink.token APL
查看合约ABI结构信息
amcli get abi $contract
mcli get abi amax.xchain
查看表数据 - 主键索引
amcli get table $code $scope $table $options
mcli get table amax.xchain amax.xchain global mcli get table amax.xchain amax.xchain xinaddrmap mcli get table amax.xchain amax.xchain coins -l 1 -r mcli get table amax.xchain amax.xchain xinorders -l1 mcli get table amax.xchain amax.xchain xinorders -l1 -r
查看表数据 - 从键索引
amcli get table $code $scope $table --index $indexNum --key-type $keyType $options
mcli get table amax.xchain amax.xchain xinorders --index 2 --key-type i64 -r -l1
最后更新于