Language

Choose a language

/build/rpc / model

splitutxo

splitutxo "txid" vout count ( target_amount_sat ) Split a wallet-controlled UTXO into multiple outputs belonging to this wallet. Arguments: 1. txid (string, required) Transaction id of the UTXO to split 2. vout (numeric, required) Output index 3. count (numeric, required) Number of outputs to create (minimum 2) 4. target_amount_sat (numeric, optional) Optional fixed amount (in satoshis) for outputs 1..count-1. Output 0 receives the remainder. Result: { (json object) Details about the split transaction "txid" : "hex", (string) Transaction id of the split transaction "outputs" : [ (json array) Newly created outputs belonging to the wallet { (json object) "vout" : n, (numeric) Output index in the split transaction "amount" : n, (numeric) Amount assigned to this output "address" : "str" (string) Address that received the output }, ... ] } Examples: > bitcoin-cli splitutxo "<txid>" 0 5 > bitcoin-cli splitutxo "<txid>" 0 5 20000

Signature

splitutxo(txid: string, vout: number, count: number, target_amount_sat?: number) → any

Code samples

curl --user "$RPC_USER:$RPC_PASS" \
  --data-binary '{"jsonrpc":"1.0","id":"docs","method":"splitutxo","params":["\"<txid>\"",0,0,0]}' \
  -H 'content-type: text/plain;' \
  http://127.0.0.1:8332/

Parameters

NameTypeReq.Description
txidstringyesTransaction id of the UTXO to split
voutnumberyesOutput index
countnumberyesNumber of outputs to create (minimum 2)
target_amount_satnumberOptional fixed amount (in satoshis) for outputs 1..count-1. Output 0 receives the remainder.

Result

Type:  any

{ (json object) Details about the split transaction "txid" : "hex", (string) Transaction id of the split transaction "outputs" : [ (json array) Newly created outputs belonging to the wallet { (json object) "vout" : n, (numeric) Output index in the split transaction "amount" : n, (numeric) Amount assigned to this output "address" : "str" (string) Address that received the output }, ... ] }

Source: services/core-node/bcore/src/wallet/rpc/transactions.cpp:1882

C++ symbol: splitutxo