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

1.1. 启动节点

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

1.2 coind help

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

root@26fc3417a8d8:/opt/wicc# coind help
addmulsigaddr num_signatures ["address",...]
addnode "node:port" "add|remove|onetry"
backupwallet "dest_dir"
createmulsig num_signatures ["address",...]
decodemulsigscript "hex"
decodetxraw "hexstring"
disconnectblock "numbers"
dropminerkeys
dropprivkey "address"
dumpprivkey "address"
dumpwallet "filename"
encryptwallet "passphrase"
genmulsigtx "multisigscript" "recvaddress" "amount" "fee" "height"
getaccountinfo "addr"
getaddednodeinfo "dns" ["node"]
getassets
getblock "hash or height" ["verbose"]
getblockcount
getblockfailures "block height"
getcdp "cdp_id"
getchaininfo "num"
getcoinunitinfo
getconnectioncount
getcontractaccountinfo "contract regid" "account address or regid"
getcontractassets "contract_regid"
getcontractdata "contract regid" "key" [hexadecimal]
getcontractinfo "contract regid"
getcontractregid
getdexorder "order_id"
getdexorders ["begin_height"] ["end_height"] ["max_count"] ["last_pos_info"]
getdexsysorders ["height"]
gethash  "str"
getinfo
getminedblocks
getmininginfo
getnettotals
getnetworkinfo
getnewaddr  ["IsMiner"]
getpeerinfo
getrawmempool ( verbose )
getscoininfo
getsignature
gettotalcoins
gettxdetail "txid"
getusercdp "addr"
getwalletinfo
help ( "command" )
importprivkey "privkey"
importwallet "filename"
invalidateblock "hash"
listaddr
listcontractassets regid
listcontracts "show detail"
listdelegates
listtx
listtxcache
ping
reconsiderblock "hash"
reloadtxcache
saveblocktofile "blockhash" "filepath"
setgenerate generate ( genblocklimit )
signmessage "address" "message"
signtxraw "str" "addr"
startcommontpstest "period" "batch_size"
startcontracttpstest "regid" "period" "batch_size"
stop
submitaccountregistertx "addr" ["fee"]
submitassetissuetx "addr" "asset_symbol" "asset_owner_addr" "asset_name" total_supply mintable [symbol:fee:unit]
submitassetupdatetx "addr" "asset_symbol" "update_type" "update_value" [symbol:fee:unit]
submitblock "hexdata" ( "jsonparametersobject" )
submitcdpliquidatetx "addr" "cdp_id" liquidate_amount [symbol:fee:unit]
submitcdpredeemtx "addr" "cdp_id" repay_amount redeem_amount ["symbol:fee:unit"]
submitcdpstaketx "addr" stake_combo_money mint_combo_money ["cdp_id"] [symbol:fee:unit]
submitcoinstaketx "addr" "coin_symbol" "coin_amount" ["symbol:fee:unit"]
submitcontractcalltx "sender_addr" "contract_regid" "arguments" "amount" "fee" ["height"]
submitcontractdeploytx "addr" "filepath" "fee" ["height"] ["contract_memo"]
submitdelegatevotetx "sendaddr" "votes" "fee" ["height"]
submitdexbuylimitordertx "addr" "coin_symbol" "asset_symbol" asset_amount price [symbol:fee:unit]
submitdexbuymarketordertx "addr" "coin_symbol" coin_amount "asset_symbol" [symbol:fee:unit]
submitdexcancelordertx "addr" "txid" [symbol:fee:unit]
submitdexselllimitordertx "addr" "coin_symbol" "asset_symbol" asset_amount price [symbol:fee:unit]
submitdexsellmarketordertx "addr" "coin_symbol" "asset_symbol" asset_amount [symbol:fee:unit]
submitdexsettletx "addr" "deal_items" [symbol:fee:unit]
submitpricefeedtx {price_feeds_json} ["symbol:fee:unit"]
submitsendtx "from" "to" "symbol:coin:unit" "symbol:fee:unit" ["memo"]
submittxraw "rawtx"
submituniversalcontractcalltx "sender_addr" "contract_regid" "arguments" "amount" "fee" ["height"]
submituniversalcontractdeploytx "addr" "filepath" "fee" ["height"] ["contract_memo"]
validateaddr "address"
verifychain ( checklevel numofblocks )
verifymessage "address" "signature" "message"
vmexecutescript "addr" "script_path" ["arguments"] [amount] [symbol:fee:unit]
walletlock
walletpassphrase "passphrase" "timeout"
walletpassphrasechange "oldpassphrase" "newpassphrase"
root@26fc3417a8d8:/opt/wicc#

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

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

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

Send coins to a given address.

Requires wallet passphrase to be set with walletpassphrase call.
Arguments:
1."from":                (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, required) 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@261680edb51c:/opt/wicc#

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

1.4.1. 执行coind getinfo 查看节点信息
root@9a11afcdc991:/opt/wicc# coind getinfo
{
    "version": 2000000,
    "full_version": "v2.0.0.0-1488a88-release-linux (2019-09-04 14:35:04 +0800)",
    "protocol_version": 10001,
    "net_type": "TEST_NET",
    "proxy": "",
    "ext_ip" : "119.123.40.167",
    "conf_dir": "/root/.WaykiChain/WaykiChain.conf",
    "data_dir": "/root/.WaykiChain/testnet",
    "block_interval": 3,
    "genblock": 1,
    "time_offset": 0,
    "connections": 11,
    "errors": "",
    "wallet_version": 0,
    "wallet_balance": 22969999.02019993,
    "miner_fee_perkb": 0.0001,
    "relay_fee_perkb": 0.00001,
    "tipblock_fuel_rate": 1,
    "tipblock_fuel": 0,
    "tipblock_time": 1567675302,
    "tipblock_hash": "05b900627bfcbe660aaa874592ee285d2b4f0d05c6378c4bf0e1c6a2b7cc1e4c",
    "tipblock_height": 38715,
    "syncblock_height": 38715,
    "connections" : 2,
    "errors" : ""
}
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" : "wLKf2NqwtHk3BfzK5wMDfbKYN1SC3weyR4",
        "regid" : "0-1",
        "tokens" : {
            "WICC" : {
                "free_amount" : 19789770027565731,
                "staked_amount" : 210000000000000,
                "frozen_amount" : 0,
                "voted_amount": 0
            }
        },
        "hasminerkey" : false
    },
    {
        "addr" : "wZKn4KZz8HmKZWgiW2mjVH5AFAXVRgrMGU",
        "regid" : "8-3",
        "tokens" : {
            "WGRT" : {
                "free_amount" : 0,
                "staked_amount" : 0,
                "frozen_amount" : 0,
                "voted_amount": 0
            }
        },
        "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 wS49EpX3VyXqc5oc7nSugSSzRoMXwtgvjZ
{
    "address" : "wS49EpX3VyXqc5oc7nSugSSzRoMXwtgvjZ",
    "keyid" : "467d3966f50e28a07d7b6764ec0253cf8cf7e9c9",
    "nickid" : "",
    "regid" : "",
    "regid_mature" : false,
    "owner_pubkey" : "03f1d844b524d6d98ca88fd2b73b3b55654ecc6acfeba4381ae7337f2c73082299",
    "miner_pubkey" : "",
    "tokens" : {
        "WICC" : {
            "free_amount" : 10000000,
            "staked_amount" : 0,
            "frozen_amount" : 0,
            "voted_amount": 0
        }
    },
    "received_votes" : 0,
    "vote_list" : [
    ],
    "position" : "inblock",
    "cdp_list" : [
    ]
}
root@9a11afcdc991:/opt/wicc#

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

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

注意

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

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

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