1. 操作流程 (以Docker环境、Regtest为例)

1.1. 启动节点

根据不同节点环境启动维基链节点

1.2 coind help

运行coind help 可以查看所有RPC接口

root@0144e839e084:/opt/wicc# coind help
addnode "node:port" "add|remove|onetry"
backupwallet "dest_dir"
createmulsig num_signatures ["address",...]
decodetxraw "hexstring"
disconnectblock "numbers"
dropminermainkeys
dropprivkey "address"
droptxfrommempool "txid"
dumpdb "[key_prefix_type]" "[file_path]"
dumpprivkey "address"
dumpwallet "filename"
encryptwallet "passphrase"
gendexoperatorordertx "sender" "order_type" "order_side" "symbol:coins:unit" "symbol:assets:unit" price dex_id "open_mode" taker_fee_ratio maker_fee_ratio "[symbol:fee:unit]" "[symbol:operator_tx_fee:unit]" "[memo]"
genunsignedtxraw "func" "params"
genutxomultiinputcondhash "n" "m" "pre_utxo_txid" "pre_utxo_tx_vout_index" "signee_uids","spend_txuid"
genutxomultisignaddr "n" "m" "signee_uids"
genutxomultisignature "sender" "utxo_content_hash"
getaccountinfo "addr"
getaddednodeinfo "dns" ["node"]
getassetinfo $asset_symbol
getblock "hash or height"  ["list_txs"] ["verbose"]
getblockcount
getblockfailures "block height"
getblockundo "hash or height"
getcdpinfo $cdp_id
getcdpparam $bcoin_scoin_pair $param_name
getchaininfo "count" [height]
getclosedcdp "[cdp_id | close_txid]"
getcoinunitinfo
getconnectioncount
getcontractaccountinfo "contract_regid" "account address or regid"
getcontractassets "contract_regid"
getcontractdata "contract_regid" "key" [hexadecimal]
getcontractinfo "contract regid"
getcontractregid
getdexbaseandquotecoins
getdexoperator dex_id
getdexoperatorbyowner owner_addr
getdexorder "order_id"
getdexorderfee "account_addr" "tx_type" ["fee_symbol"]
getfeedcoinpairs
getgovernors
gethash  "str"
getinfo
getminedblocks
getminerbyblocktime height time
getmininginfo
getnettotals
getnetworkinfo
getnewaddr  ["IsMiner"]
getpeerinfo
getproposal "proposalid"
getrawmempool ( verbose )
getscoininfo
getsignature
getswapcoin "peer_chain_coin_symbol"
getsysparam $param_name
gettotalbpssize
gettotalcoins
gettxdetail "txid"
getusercdp "cdp_owner_addr"
getwalletinfo
help ( "command" )
importprivkey "privkey"
importwallet "filename"
invalidateblock "hash"
listaddr
listassets
listcontractassets regid
listcontracts "show detail"
listdelegates
listdexorders ["begin_height"] ["end_height"] ["max_count"] ["last_pos_info"]
listdexsysorders ["height"]
listmintxfees
listtx
listtxcache
luavm_executecontract "addr" "app_id" ["arguments"] [symbol:amount:unit]
luavm_executescript "addr" "script_path" ["arguments"] [amount] [symbol:fee:unit]
ping
reconsiderblock "hash" [children]
reloadtxcache
saveblocktofile "blockhash" "filepath"
setgenerate generate ( genblocklimit )
signmessage "signee" "message"
signtxraw "str" "addr"
startcommontpstest "period" "batch_size"
startcontracttpstest "regid" "period" "batch_size"
startwasmtpstest "regid" "period" "batch_size"
stop
submitaccountpermproposal "sender" "account_uid" "proposed_perms_sum" ["fee"]
submitaccountpermscleartx "addr"  ["fee"]
submitaccountregistertx "addr" ["fee"]
submitassetpermproposal "sender" "asset_symbol" "proposed_perms_sum" ["fee"]
submitaxccoinproposal "sender" "peer_coin_symbol" "peer_chain_type" "operate_type" ["fee"]
submitaxcinproposal "sender" "peer_chain_type" "peer_chain_token_symbol" "self_chain_token_symbol" "peer_chain_addr" "peer_chain_txid" "self_chain_uid" "swap_amount" ["fee"]
submitaxcoutproposal "sender" "self_chain_token_symbol" "peer_chain_addr" "swap_amount" ["fee"]
submitblock "hexdata" ( "jsonparametersobject" )
submitcancelorderproposal "sender"  "order_id" ["fee"]
submitcdpliquidatetx "sender" "cdp_id" liquidate_amount [symbol:fee:unit]
submitcdpparamgovernproposal "sender" "param_name" "param_value" "bcoin_symbol" "scoin_symbol" ["fee"]
submitcdpredeemtx "sender" "cdp_id" repay_amount redeem_amount ["symbol:fee:unit"]
submitcdpstaketx "sender" stake_combo_money mint_combo_money ["cdp_id"] [symbol:fee:unit]
submitcoinstaketx "sender" "coins_to_stake" ["action"] ["symbol:fee:unit"]
submitcointransferproposal $sender $from_uid $to_uid $transfer_amount [$fee]
submitdelegatevotetx "sendaddr" "votes" "fee" ["height"]
submitdexbuylimitordertx "sender" "coin_symbol" "symbol:asset_amount:unit"  price [dex_id] [symbol:fee:unit] "[memo]"
submitdexbuymarketordertx "sender" "coin_symbol" coin_amount "asset_symbol"  [dex_id] [symbol:fee:unit] "[memo]"
submitdexcancelordertx "sender" "txid" [symbol:fee:unit]
submitdexoperatorregtx  "sender" "owner_uid" "fee_receiver_uid" "dex_name" "portal_url" "open_mode" maker_fee_ratio taker_fee_ratio ["fees"] ["memo"]
submitdexopupdatetx  "sender" "dex_id" "update_field" "value" "fee"
submitdexselllimitordertx "sender" "coin_symbol" "asset" price [dex_id] [symbol:fee:unit] "[memo]"
submitdexsellmarketordertx "sender" "coin_symbol" "asset_symbol" asset_amount  [dex_id] [symbol:fee:unit] "[memo]"
submitdexsettletx "sender" "deal_items" [symbol:fee:unit]
submitdexswitchproposal "sender" "dexid" "operate_type" ["fee"]
submitdiaissueproposal "sender"  "asset_symbol" "owner_uid" "total_supply" ["fee"]
submitfeedcoinpairproposal "sender" "base_symbol" "quote_symbol" "operate_type" ["fee"]
submitgovernorupdateproposal "sender" "governor_uid" "operate_type" ["fee"]
submitluacontractcalltx "sender_addr" "contract_regid" "arguments" "amount" "fee" ["height"]
submitluacontractdeploytx "addr" "filepath" "fee" ["height"] ["contract_memo"]
submitminerfeeproposal "sender" "tx_type" "fee_info"  ["fee"]
submitparamgovernproposal "sender" "param_name" "param_value" ["fee"]
submitpasswordprooftx "sender" "utxo_txid" "utxo_vout_index" "password" "pre_utxo_tx_uid" ["fee"]
submitpricefeedtx "sender" {price_feeds_json} ["symbol:fee:unit"]
submitproposalapprovaltx "sender" "proposalid" ["fee"] ["axc_out_signature"]
submitsendmultitx "from" "to" "transfer_array" "fee" ["memo"]
submitsendtx "sender" "to" "symbol:coin:unit" ["symbol:fee:unit"] ["memo"]
submitsetcodetx "sender" "wasm_file" "abi_file" ["contract"] [symbol:fee:unit]
submittotalbpssizeupdateproposal "sender" "total_bps_size" "effective_height"  ["fee"]
submittx "sender" "contract" "action" "data" "fee"
submittxraw "rawtx" ["signatures"]
submitucontractcalltx "sender_addr" "contract_regid" "arguments" "symbol:coin:unit" "symbol:fee:unit" ["height"]
submitucontractdeploytx "sender" "filepath" "symbol:fee:unit" ["height"] ["contract_memo"]
submitutxotransfertx "sender" "coin_symbol" "vins" "vouts" "symbol:fee:unit" "memo"
validateaddr "address"
verifychain ( checklevel numofblocks )
verifymessage "address" "signature" "message"
walletlock
walletpassphrase "passphrase" "timeout"
walletpassphrasechange "oldpassphrase" "newpassphrase"
wasm_abidefjson2bin "abijson"
wasm_bin2json "contract" "action" "data"
wasm_getabi "contract"
wasm_getcode "contract"
wasm_getresult "contract" "action" "data"
wasm_getrow "contract" "table" "key"
wasm_gettable "contract" "table" "key_prefix" "max_count" "begin_key"
wasm_gettxtrace "trxid"
wasm_json2bin "contract" "action" "data"
root@0144e839e084:/opt/wicc#

1.3. 使用coind help + 指定RPC方法查看具体操作指南

帮助信息与RPC-JSON接口保持一致,方便指导开发者对节点进行操作。以多币种转账为例

root@261680edb51c:/opt/wicc# coind help submitsendtx
submitsendtx "sender" "to" "symbol:coin:unit" ["symbol:fee:unit"] ["memo"]

Send coins to a given address.

Arguments:
1."sender":              (string, required) The address where coins are sent from
2."to":                  (string, required) The address where coins are received
3."symbol:coin:unit":    (symbol:amount:unit, required) transferred coins
4."symbol:fee:unit":     (symbol:amount:unit, optional) fee paid to miner, default is WICC:10000:sawi
5."memo":                (string, optional)

Result:
"txid"                   (string) The transaction id.

Examples:
> ./coind submitsendtx "wLKf2NqwtHk3BfzK5wMDfbKYN1SC3weyR4" "wNDue1jHcgRSioSDL4o1AzXz3D72gCMkP6" "WICC:1000000:sawi" "WICC:10000:sawi" "Hello, WaykiChain!"

As json rpc call
> curl --user myusername -d '{"jsonrpc": "1.0", "id":"curltest", "method": "submitsendtx", "params": ["wLKf2NqwtHk3BfzK5wMDfbKYN1SC3weyR4", "wNDue1jHcgRSioSDL4o1AzXz3D72gCMkP6", "WICC:1000000:sawi", "WICC:10000:sawi", "Hello, WaykiChain!"] }' -H 'Content-Type: application/json;' http://127.0.0.1:8332/

root@0144e839e084:/opt/wicc#

1.4. 使用coind命令行与节点交互(示例)

1.4.1. 执行coind getinfo 查看节点信息
root@26fc3417a8d8:/opt/wicc# coind getinfo
{
    "version" : "v3.2.0.1-78dc7178-release-linux (2020-08-04 18:52:02 +0800)",
    "protocol_version" : 10001,
    "net_type" : "REGTEST_NET",
    "proxy" : "",
    "public_ip" : "",
    "conf_dir" : "/root/.WaykiChain/WaykiChain.conf",
    "data_dir" : "/root/.WaykiChain/regtest",
    "block_interval" : 10,
    "genblock" : 1,
    "time_offset" : 0,
    "WICC_balance" : 0,
    "WUSD_balance" : 0,
    "WGRT_balance" : 0,
    "relay_fee_perkb" : 1000,
    "tipblock_tx_count" : 3,
    "tipblock_fuel_rate" : 100,
    "tipblock_fuel" : 0,
    "tipblock_time" : 1504305600,
    "tipblock_hash" : "ab8d8b1d11784098108df399b247a0b80049de26af1b9c775d550228351c768d",
    "tipblock_height" : 0,
    "synblock_height" : 0,
    "finblock_height" : 0,
    "finblock_hash" : "0000000000000000000000000000000000000000000000000000000000000000",
    "connections" : 0,
    "errors" : "",
    "state" : "InSync"
}
root@9a11afcdc991:/opt/wicc#
1.4.2. 执行coind getnewaddr 创建新地址

注意 目前新创建地址不需要手动激活(生成regid),主动发起交易即可获得regid

root@9a11afcdc991:/opt/wicc# coind getnewaddr
{
    "addr" : "wS49EpX3VyXqc5oc7nSugSSzRoMXwtgvjZ",
    "minerpubkey" : "null"
}
root@9a11afcdc991:/opt/wicc#
1.4.3. 执行coind listaddr 查看全节点钱包中所有的地址及余额等信息
root@9a11afcdc991:/opt/wicc# coind listaddr
[
    {
        "addr" : "wUuDGJkeMg2ZLkGd5ZM7TyK56DHoPVVDYa",
        "regid" : "0-0",
        "regid_mature" : false,
        "received_votes" : 0,
        "tokens" : {
        },
        "hasminerkey" : false
    },
    {
        "addr" : "wg3MGv5ZY8zA44QSWXatMa3WhpJXu1APMj",
        "regid" : "0-0",
        "regid_mature" : false,
        "received_votes" : 0,
        "tokens" : {
        },
        "hasminerkey" : false
    }
]
1.4.4. 执行coind submitsendtx + 参数命令进行转账,待3s后交易被确认,查看接收者地址余额
root@9a11afcdc991:/opt/wicc# coind submitsendtx 0-1 wS49EpX3VyXqc5oc7nSugSSzRoMXwtgvjZ WICC:10000000:sawi WICC:10000:sawi
{
    "txid" : "091a048eb55ee65cec934d273a68ba3165c2c9a919477bf28b5b7438bea5ad23"
}
root@9a11afcdc991:/opt/wicc#
1.4.5. 执行coind getaccountinfo + 参数命令查看接收者账户余额是否增加

注意 目前新创建地址不需要手动激活(生成regid),主动发起交易即可获得regid

root@9a11afcdc991:/opt/wicc# coind getaccountinfo 0-2
{
    "address" : "wNDue1jHcgRSioSDL4o1AzXz3D72gCMkP6",
    "keyid" : "1c758724cc60db35dd387bcf619a478ec3c065f2",
    "regid" : "0-2",
    "regid_mature" : true,
    "owner_pubkey" : "0376de6a21f63c35a053c849a339598016a0261d6bdc5567adeda0af78b750c4cc",
    "miner_pubkey" : "",
    "perms" : "1111111111",
    "tokens" : {
    },
    "received_votes" : 210000000000000,
    "vote_list" : [
    ],
    "onchain" : true,
    "in_wallet" : false,
    "pubkey_registered" : true,
    "cdp_list" : [
    ]
}
root@9a11afcdc991:/opt/wicc#

2. Linux环境下请使用如下命令

running command meaning
./coind -datadir=. 配置文件在当前路径
./coind -datadir=/opt/wicc 配置文件在路径: /opt/wicc
./coind 配置文件在当前用户路径:~/.WaykiChain

注意

./coind -datadir=.      //正确的命令
./coind -datadir =.     //错误的命令

3. 全节点钱包的各文件介绍:

文件/文件夹 说明
coind 可执行文件
WaykiChain.conf 配置文件
main 正式链数据文件夹
testnet 测试链数据文件夹
peer.dat 位于数据文件夹内, 节点连接信息
wallet.dat 位于数据文件夹内,钱包数据,该文件存放了钱包公私钥,一定要保管好
blocks 位于数据文件夹内,同步的区块数据文件夹
syncdata 位于数据文件夹内,同步情况数据文件夹
database 位于数据文件夹内,节点程序启动时才会有,节点程序停止后自动删除掉。