<p>1) Yes. See <a href="https://bitcoin.stackexchange.com/questions/1077/what-is-the-coin-selection-algorithm">this question</a> for more detail.</p>

<p>2) The from address will be an array of address that hold the unspent outputs. If you want to select which outputs are sent and from what address, you can use coin control in the QT wallet, or you can create a raw transaction using <code>createrawtransaction</code>, <code>signrawtransaction</code>, and <code>sendrawtransaction</code>.</p>

<p>3) Fee is computed by the number of bytes your transaction has, not necessarily the amount of the bitcoins you send. If you have a lot of small unspent outputs that go into your transaction it will make the transaction larger and thus a larger fee. </p>

<p>The code for the fee calculations </p>

<ul>
<li><a href="https://github.com/bitcoin/bitcoin/blob/0.9/src/main.cpp#L53" rel="nofollow noreferrer">https://github.com/bitcoin/bitcoin/blob/0.9/src/main.cpp#L53</a></li>
<li><a href="https://github.com/bitcoin/bitcoin/blob/0.9/src/main.cpp#L811" rel="nofollow noreferrer">https://github.com/bitcoin/bitcoin/blob/0.9/src/main.cpp#L811</a> </li>
</ul>

<p>As of right now it looks like the tx fee per 1,000 bytes is 10,000 satoshis (0.00010000) to create a transaction.</p>

CC BY-SA 3.0
2015-04-02T17:45:25.740Z
2015-04-03T15:47:56.217Z
2017-04-13T12:47:33.743Z
presstab
<ol>
<li>Does sendtoaddress automatically collect as many unspent outputs as needed?</li>
<li>Is there any way to specify the from address?</li>
<li>How is the fee computed? I just tested with two transactions:
a) 0.0001 xbt, fee 0.00017519
b) 0.001 xbt, fee 0.00017441.</li>
</ol>

<bitcoin-core><sendtoaddress>
sendtoaddress questions
Giulio Prisco
# sendtoaddress questions

(Asked by: username_0 on 2015-04-02)

1. Does sendtoaddress automatically collect as many unspent outputs as needed?
2. Is there any way to specify the from address?
3. How is the fee computed? I just tested with two transactions:
   a) 0.0001 xbt, fee 0.00017519
   b) 0.001 xbt, fee 0.00017441.

**Tags:** bitcoin-core, sendtoaddress


---

## 1 answers

### Answer by username_1 on 2015-04-02. Score: 3 | Accepted answer

1) Yes. See [this question](https://bitcoin.stackexchange.com/questions/1077/what-is-the-coin-selection-algorithm) for more detail.

2) The from address will be an array of address that hold the unspent outputs. If you want to select which outputs are sent and from what address, you can use coin control in the QT wallet, or you can create a raw transaction using `createrawtransaction`, `signrawtransaction`, and `sendrawtransaction`.

3) Fee is computed by the number of bytes your transaction has, not necessarily the amount of the bitcoins you send. If you have a lot of small unspent outputs that go into your transaction it will make the transaction larger and thus a larger fee.

The code for the fee calculations

* <https://github.com/bitcoin/bitcoin/blob/0.9/src/main.cpp#L53>
* <https://github.com/bitcoin/bitcoin/blob/0.9/src/main.cpp#L811>

As of right now it looks like the tx fee per 1,000 bytes is 10,000 satoshis (0.00010000) to create a transaction.


---

