<p>Since there is nothing special about a change output that distinguishes it from other output I would try multiple <code>--to</code> options, one for main recipient and one sending a change amount to an address of yours?</p>
<p>Actually you can probably specify multiple addresses after a single <code>--to</code> as suggested by the ellipsis after <code>--to &lt;ADDRESS:SAT&gt;...</code> in the help text you quoted. That seems more likely to work.</p>

CC BY-SA 4.0
2022-04-16T08:31:16.400Z
2022-04-16T08:31:16.400Z
RedGrittyBrick
<p>I'm using BDK to create a transaction using <code>bdk-cli</code> interface, researching how to send a Tx I pulled the help for the <code>create_tx</code> command. It's not clear how to create a Tx when you want to send less than the total <code>(-a, --send_all option)</code> of funds from the selected UTXO, it is also not clear how to deal with the change. Does anyone know how to do it, if possible? Thanks for the help.</p>
<pre><code>&gt; bdk-cli wallet create_tx -h
bdk-cli-wallet-create_tx 0.4.0
Creates a new unsigned transaction

USAGE:
    bdk-cli wallet --descriptor &lt;DESCRIPTOR&gt; create_tx [FLAGS] [OPTIONS] --to &lt;ADDRESS:SAT&gt;...

FLAGS:
    -r, --enable_rbf        Enables Replace-By-Fee (BIP125)
    -h, --help              Prints help information
        --offline_signer    Make a PSBT that can be signed by offline signers and hardware wallets. Forces the addition
                            of `non_witness_utxo` and more details to let the signer identify the change output
    -a, --send_all          Sends all the funds (or all the selected utxos). Requires only one recipients of value 0
    -V, --version           Prints version information

OPTIONS:
        --to &lt;ADDRESS:SAT&gt;...                      Adds a recipient to the transaction
        --unspendable &lt;CANT_SPEND_TXID:VOUT&gt;...    Marks a utxo as unspendable
        --external_policy &lt;EXT_POLICY&gt;
            Selects which policy should be used to satisfy the external descriptor

        --internal_policy &lt;INT_POLICY&gt;
            Selects which policy should be used to satisfy the internal descriptor

        --utxos &lt;MUST_SPEND_TXID:VOUT&gt;...          Selects which utxos *must* be spent
    -f, --fee_rate &lt;SATS_VBYTE&gt;                    Fee rate to use in sat/vbyte
</code></pre>

<bitcoin-development-kit>
Sending non-all UTXO amount when creating a Tx in BDK (Bitcoin Development Kit)
Bitcoin_1o1
# Sending non-all UTXO amount when creating a Tx in BDK (Bitcoin Development Kit)

(Asked by: username_0 on 2022-04-15)

I'm using BDK to create a transaction using `bdk-cli` interface, researching how to send a Tx I pulled the help for the `create_tx` command. It's not clear how to create a Tx when you want to send less than the total `(-a, --send_all option)` of funds from the selected UTXO, it is also not clear how to deal with the change. Does anyone know how to do it, if possible? Thanks for the help.

```
> bdk-cli wallet create_tx -h
bdk-cli-wallet-create_tx 0.4.0
Creates a new unsigned transaction

USAGE:
    bdk-cli wallet --descriptor <DESCRIPTOR> create_tx [FLAGS] [OPTIONS] --to <ADDRESS:SAT>...

FLAGS:
    -r, --enable_rbf        Enables Replace-By-Fee (BIP125)
    -h, --help              Prints help information
        --offline_signer    Make a PSBT that can be signed by offline signers and hardware wallets. Forces the addition
                            of `non_witness_utxo` and more details to let the signer identify the change output
    -a, --send_all          Sends all the funds (or all the selected utxos). Requires only one recipients of value 0
    -V, --version           Prints version information

OPTIONS:
        --to <ADDRESS:SAT>...                      Adds a recipient to the transaction
        --unspendable <CANT_SPEND_TXID:VOUT>...    Marks a utxo as unspendable
        --external_policy <EXT_POLICY>
            Selects which policy should be used to satisfy the external descriptor

        --internal_policy <INT_POLICY>
            Selects which policy should be used to satisfy the internal descriptor

        --utxos <MUST_SPEND_TXID:VOUT>...          Selects which utxos *must* be spent
    -f, --fee_rate <SATS_VBYTE>                    Fee rate to use in sat/vbyte

```

**Tags:** bitcoin-development-kit


---

## 1 answers

### Answer by username_1 on 2022-04-16. Score: 0 | Accepted answer

Since there is nothing special about a change output that distinguishes it from other output I would try multiple `--to` options, one for main recipient and one sending a change amount to an address of yours?

Actually you can probably specify multiple addresses after a single `--to` as suggested by the ellipsis after `--to <ADDRESS:SAT>...` in the help text you quoted. That seems more likely to work.


---

