createrawtransaction
The createrawtransaction RPC method creates an unsigned raw transaction that spends a set of previous transaction outputs to a set of new addresses with specific amounts. The method can be used to create custom transactions, which can then be signed and broadcast to the Bitcoin network.
Parameters
parameter | type | description |
|---|---|---|
inputs | array (required) | An array of objects, each specifying a previous transaction output to spend. |
txid | string (required) | The transaction ID of the previous transaction output to spend. |
vout | numeric (required) | The index of the output to spend from the previous transaction. |
sequence | numeric (optional) | The sequence number. Default depends on the value of 'replaceable' and 'locktime' arguments. |
outputs | object (required) | An object with key-value pairs representing the receiving address and the amount to be sent (in BTC). |
locktime | numeric (optional) | The lock time for the transaction. Default=0. Specifies the earliest time or block height the transaction can be included in a block. |
replaceable | boolean (optional) | Marks this transaction as BIP125-replaceable. Default=false. Allows the transaction to be replaced by a transaction with higher fees. Error occurs if explicit sequence numbers are incompatible. |
Return Object
(string) A hex-encoded raw transaction.
Request Example
Request example