Raw Transactions
Construct and send raw transactions.
Provide transaction decoding, transaction construction, and transaction broadcasting functions.
You can use mvc-cli help command to view the usage of specific commands. The JsonRpc call method is in the example.
Commands
== Rawtransactions ==
createrawtransaction [{"txid":"id","vout":n},...] {"address":amount,"data":"hex",...} ( locktime )
decoderawtransaction "hexstring"
decodescript "hexstring"
fundrawtransaction "hexstring" ( options )
getrawtransaction "txid" ( verbose )
sendrawtransaction "hexstring" ( allowhighfees dontcheckfee )
sendrawtransactions [{"hex": "hexstring", "allowhighfees": true|false, "dontcheckfee": true|false, "listunconfirmedancestors": true|false, "config: " <json string> }, ...]
signrawtransaction "hexstring" ( [{"txid":"id","vout":n,"scriptPubKey":"hex","redeemScript":"hex"},...] ["privatekey1",...] sighashtype )createrawtransaction
Create a transaction spending the given inputs and creating new outputs.
createrawtransaction [{"txid":"id","vout":n},...] {"address":amount,"data":"hex",...} ( locktime )
Create a transaction spending the given inputs and creating new outputs.
Outputs can be addresses or data.
Returns hex-encoded raw transaction.
Note that the transaction's inputs are not signed, and
it is not stored in the wallet or transmitted to the network.
Arguments:
1. "inputs" (array, required) A json array of json objects
[
{
"txid":"id", (string, required) The transaction id
"vout":n, (numeric, required) The output number
"sequence":n (numeric, optional) The sequence number
}
,...
]
2. "outputs" (object, required) a json object with outputs
{
"address": x.xxx, (numeric or string, required) The key is the mvc address, the numeric value (can be string) is the SPACE amount
"data": "hex" (string, required) The key is "data", the value is hex encoded data
,...
}
3. locktime (numeric, optional, default=0) Raw locktime. Non-0 value also locktime-activates inputs
Result:
"transaction" (string) hex string of the transaction
Examples:
> mvc-cli createrawtransaction "[{\"txid\":\"myid\",\"vout\":0}]" "{\"address\":0.01}"
> mvc-cli createrawtransaction "[{\"txid\":\"myid\",\"vout\":0}]" "{\"data\":\"00010203\"}"
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "createrawtransaction", "params": [[{"txid":"myid","vout":0}], {"address":0.01}] }' -H 'content-type: text/plain;' http://127.0.0.1:9882/
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "createrawtransaction", "params": [[{"txid":"myid","vout":0}], {"data":"00010203"}] }' -H 'content-type: text/plain;' http://127.0.0.1:9882/decoderawtransaction
Return a JSON object representing the serialized, hex-encoded transaction.
Param๏ผ
hexstring(string, required)
decodescript
Decode a hex-encoded script.
Param๏ผ
hexstring(string, required) ่ๆฌ็ๅๅ ญ่ฟๅถๅญ็ฌฆไธฒใ
fundrawtransaction
Add inputs to a transaction until it has enough in value to meet its out value.
Param๏ผ
hexstring(string, required)options(object, optional)
getrawtransaction
Return the raw transaction data.
Param๏ผ
txid(string, required)verbose(bool, optional, default=false)
sendrawtransaction
Submits raw transaction (serialized, hex-encoded) to local node and network.
Param๏ผ
hexstring(string, required)allowhighfees(bool, optional, default=false)dontcheckfee(bool, optional, default=false)
sendrawtransactions
Submits raw transactions (serialized, hex-encoded) to local node and network.
Param๏ผ
hex(string, required)allowhighfees(bool, optional, default=false)dontcheckfee(bool, optional, default=false)listunconfirmedancestors(bool, optional, default=false)config(string, optional)
signrawtransaction
Sign inputs for raw transaction (serialized, hex-encoded).
Param๏ผ
hexstring(string, required)prevtxs(array, optional)privatekeys(array, optional)sighashtype(string, optional)