API about transaction
submitsendtx
Transfer, support WICC, WUSD, WGRT and other multi-currency transfers
Parameters
from
Sender address
to
Receiver address
symbol:coin:unit
Sending currency: Sending amount: the amount of the unit is at least 10000 sawi
symbol:fee:unit
Fee currency: handling fee amount: handling fee unit at least 10000 sawi
memo
(string, optional) Remarks, the comment information will be included on the chain
Returns
hash
Transaction hash
Example
// Request
curl -u Waykichain:admin -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:6967
// Response
{
"result": {
"txid": "0ec855aeec4b06c660fd6e1ec2b2302061f22c3fe9986c2d54b7b9b137fc594c"
},
"error": null,
"id": "curltest"
}
submittxraw
Broadcast transaction signature data to blockchain
Parameters
rawtx
An offline signed transaction.
signatures
(array, optional) json 数组的签名信息
[
{
"addr": "address" (string, required) 签名的地址
"signature": "hex str" (string, required) 哈希格式的签名
}
,...
]
Returns
hash
Transaction hash
Example
// Request
curl -u Waykichain:admin -d '{"jsonrpc":"2.0","id":"curltext","method":"submittxraw","params":["030192af0f020008146902285df4bba1d69952f3f9e5b071ed3e4e8df4cd10aed6c1000046304402204d3ac6de164f4bdfa65075e54bcd32161fa0ae3745d7b0e3e5da7f79ec17b45802206dd239adbbe5b3cc66adbb138505327036e111283c15e046b1b5fce5d52aa295"]}' -H 'content-type:application/json;' http://127.0.0.1:6967
// Response
{
"txid" : "d9389e760d477c80e32739fda67c1cb79a306c6ef6ec234f4cafb5f956e0e423",
"tx_trace" : null
}
gettxdetail
Transaction details based on transaction hashes, including confirmed and unconfirmed transactions
Parameters
txhash
Transaction hash
Returns
txid
Transaction hash, unique identifier of the transaction
tx_type
Transaction type, exchange and wallet can be scanned according to the list of transaction types on the right
ver
Block version number
tx_uid
Transaction originator's regid /nickid/ public key
from_addr
Transaction originator's address
fee_symbol
Transaction fee currency
fees
Handling fee, the unit is the minimum precision
valid_height
Effective height when creating a transaction
signature
Signature field
transfers
Transaction receiver list
`to_uid` transaction recipient's regid /nickid/ public key
`to_addr` transaction recipient's address
`coin_symbol` The currency of the transaction, supporting multiple currencies
`coin_amount` The amount of the transaction, the unit is `sawi`
memo
Remarks
confirmed_height
The block height at which the transaction was confirmed. This field is not available when the transaction is not confirmed.
confirmed_time
The timestamp of the transaction being confirmed. This field is not available when the transaction is not confirmed.
block_hash
The hash value of the block where the transaction is confirmed. This field is not available when the transaction is not confirmed.
receipt
Related receipts generated by the transaction, this field is not available when the transaction is not confirmed
tx_code
the position of transaction
rawtx
Original transaction information
confirmations
Transaction confirmation number, = current chain height - block height at which the transaction is confirmed
Example
// Request
curl -u Waykichain:admin -d '{"jsonrpc":"2.0","id":"curltext","method":"gettxdetail","params":["3946f8a88e2cfbee016761251237e2e19c6b6fa58a3b380ba5d6b0d480d0c6e7"]}' -H 'content-type:application/json;' http://127.0.0.1:6967
// Response
{
"result": {
"txid" : "86d86270cb82acc426f9a7b7b7c6374a5289ff53384085b850aefa15a8adad3a",
"tx_type" : "UCOIN_TRANSFER_TX",
"ver" : 1,
"tx_uid" : "0-1",
"from_addr" : "wLKf2NqwtHk3BfzK5wMDfbKYN1SC3weyR4",
"fee_symbol" : "WICC",
"fees" : 1000000,
"valid_height" : 86668,
"signature" : "304402205a56a3f9e3e3cf9bd49f1a991ea141fe2fa006cd41ae684a403b686d5baf5e38022078d442174868cd6b464caaaaefa6f017023da8059c4051edde32258bf64e0ea9",
"transfers" : [
{
"to_uid" : "0-2",
"to_addr" : "wNDue1jHcgRSioSDL4o1AzXz3D72gCMkP6",
"coin_symbol" : "WICC",
"coin_amount" : 100000000
}
],
"memo" : "",
"confirmations" : 3,
"confirmed_height" : 86670,
"confirmed_time" : 1568857718,
"block_hash" : "9faa48a2e4711aebdefb04b5a72649fa7907610b2f784e6b652e463315099647",
"receipt" : [
],
"rawtx" : "0b0184a40c0200010457494343cd10010200020457494343aed6c1000046304402205a56a3f9e3e3cf9bd49f1a991ea141fe2fa006cd41ae684a403b686d5baf5e38022078d442174868cd6b464caaaaefa6f017023da8059c4051edde32258bf64e0ea9"
},
"error": null,
"id": "curltest"
}
listtx
Get current node transaction list: contains confirmed and unconfirmed transactions
Parameters
none
Returns
confirmed_tx
Confirmed transaction hash list
unconfirmed_tx
Unconfirmed transaction hash list
Example
// Request
curl -u Waykichain:admin -d '{"jsonrpc":"2.0","id":"curltext","method":"listtx","params":[]}' -H 'content-type:application/json;' http://127.0.0.1:6967
// Response
{
"result": {
"confirmed_tx": [
"25751af37271979faba87fbcbb773ee15ce55978a8f99de395161fa7659972c4",
"0ec855aeec4b06c660fd6e1ec2b2302061f22c3fe9986c2d54b7b9b137fc594c",
"dc3ef43ea4e7808914be324a9a7f694965af3039af5640ccda8ddee3726d01e9",
"1b42f7e31d25c4c6848edec7569667789dbfd5e03b50ae540dde8466a91663a7",
"fb63f24b14c4a94d656d1a66fd147f9e3b504c4f597cd60d88aa3ebc059d0c6e",
"af29ddcb14a85b62d2dfbbc43da5b92670ee17b790092be9cef07c5821add646",
"eaf495ede5742cf4b1bf4f579f923cf5e348e5998766938d56efc8509df76fa9",
"3946f8a88e2cfbee016761251237e2e19c6b6fa58a3b380ba5d6b0d480d0c6e7",
"fc0815e250da533110f0c1b4a339855f38cee8ac1c467c68d01c248d8b716776",
"2feb411e819ca3d93600a1a5dba45a7881fbb4c1a669921fd47d97bc1ab4fe02"
],
"unconfirmed_tx": []
},
"error": null,
"id": "curltext"
}
decodetxraw
Parse the original transaction order based on the signature field
Parameters
rawtx
Signed original order
Returns
txid
Transaction hash
tx_type
Transaction Type
ver
version number
tx_uid
Transaction originator's regid /nickid/ public key
from_addr
Transaction originator's address
fee_symbol
Fee currency
fees
Fee amount unitsawi
valid_height
effective height
signature
Signature content
transfers
The transaction list of receiver
`to_uid` Transaction recipient's regid /nickid/ public key
`to_addr` Transaction recipient's address
`coin_symbol` Currency of transfer
`coin_amount` Amount of transfer
memo
(hex) Remarks
Example
// Request
curl -u Waykichain:admin -d '{"jsonrpc": "1.0", "id":"curltest", "method": "decodetxraw", "params": ["0301a5bb2a03801e01144abc43807e950927431390c3cf9a0d3f20c8c5c3cd10cd100d74657374207472616e73666572463044022074d9d80231eeacb637c908f831a560ef002e6237701841e1840d3982fa1b16c7022057544d39597683b266605c140fa6215dff2bef2eb3da6d8dc7eb101128fb880e"] }' -H 'content-type:application/json;' http://127.0.0.1:6967
// Response
{
"result": {
"txid" : "86d86270cb82acc426f9a7b7b7c6374a5289ff53384085b850aefa15a8adad3a",
"tx_type" : "UCOIN_TRANSFER_TX",
"ver" : 1,
"tx_uid" : "0-1",
"from_addr" : "wLKf2NqwtHk3BfzK5wMDfbKYN1SC3weyR4",
"fee_symbol" : "WICC",
"fees" : 1000000,
"valid_height" : 86668,
"signature" : "304402205a56a3f9e3e3cf9bd49f1a991ea141fe2fa006cd41ae684a403b686d5baf5e38022078d442174868cd6b464caaaaefa6f017023da8059c4051edde32258bf64e0ea9",
"transfers" : [
{
"to_uid" : "0-2",
"to_addr" : "wNDue1jHcgRSioSDL4o1AzXz3D72gCMkP6",
"coin_symbol" : "WICC",
"coin_amount" : 100000000
}
],
"memo" : ""
},
"error": null,
"id": "curltest"
}
submitsendmultitx
transfer: support transfer to multiple users in the same Time
Parameters
from
the address where coins are sent from
transfer_array
(Array(string), required) the transfer info array
"[{
"to_uid": (string,required) The address where coins are received
"symbol_amount_unit": (comboMoney, required) transferred coins;
Sending currency: Sending amount: the amount of the unit is at least 10000 sawi
}]"
fee
: (symbol:amount:unit, required) fee paid to miner, the min fee is trasfer_array.size * (default fee of UCOIN_TRANSFER_TX)
Fee currency: handling fee amount: handling fee
memo
: (string, optional) Remarks, the comment information will be included on the chain
Return
txid
: (string) Transaction hash
Example
There have two Types of input
1、docker:
root@0e7612ac5bc5:/opt/wicc# coind submitsendmultitx 0-1 "[{\"to_uid\":\"wPpfX5W1AHdCPwBF2orNQfw3zcX8izF6EV\",\"symbol_amount_unit\":\"WICC:100000:WI\"},{\"to_uid\":\"8-3\",\"symbol_amount_unit\":\"WICC:2000:WI\"}]" 100000 "helo"
2、json:
> curl --user myusername -d '{"jsonrpc": "1.0", "id":"curltest", "method": "submitsendmultitx", "params": ["wLKf2NqwtHk3BfzK5wMDfbKYN1SC3weyR4", "[{"to_uid":"0-1", "symbol_amount_unit":"WICC:100:WI"}]", "Hello, WaykiChain!"] }' -H 'Content-Type: application/json;' http://127.0.0.1:8332/
Result
// Response
{
"txid" : "167d9b4ecaf4c881059f3778708ebd7e226cdd833d5bbdf4401dc997fbd74ad7"
}