Syntax: createtransaction {"address":amount,...} ({ "option": value,...})
This call is very similar to sendmany
but it also allows to:
- use unspent transaction outputs of watch only addresses;
- specify the change address;
- optionally not commit the transaction;
- optionally not sign the transaction;
- include the
scriptPubKey
of transaction inputs.
Optional arguments are specified in a JSON object. The output similar is to decoderawtransaction
.
This is very useful for merchants that doesn’t want a wallet with private keys but wishes to use the algorithm used in the unspent output selection and fee calculation. Then it can sign the inputs and send the raw transaction.
Example:
0bitcoin-cli -regtest createtransaction '{ "mpi744Kz6uDEDeTLDj8BwXbwfanjoVSPch": "20" }' '{ "allowWatchOnly": true, "changeAddress" : "mnBfCwG7Dc4HeJob681kRLSueUzQ7XMKQf", "commit": false, "includeSpentOutputs": true, "sign": false }'
TODO: optionally lock unspents when commit
is false.