<p>To find the transaction outputs you can spend</p>

<pre><code>listunspent 0 99999999999 "[\"addressYouWantToSpend\"]"
</code></pre>

<p>Then create the tx</p>

<pre><code>createrawtransaction "[{\"txid\":\"txIdToSpend\",\"vout\":n}]" "{\"destinationAddress\":amountToSend, \"changeAddress\":changeAmount}"
</code></pre>

<p>Then sign the tx</p>

<pre><code>signrawtransaction &lt;hexStringProvidedBycreaterawtransaction&gt;
</code></pre>

<p>Then publish the tx</p>

<pre><code>sendrawtransaction &lt;hexStringProvidedBysignrawtransaction&gt;
</code></pre>

CC BY-SA 3.0
2015-02-25T15:41:47.787Z
Wouldn't I know the fees after making the transaction? This won't allow me to check if the account has enough funds for paying the fees of how much he wants to send.
Cornezuelo del Centeno
CC BY-SA 3.0
2015-02-25T16:06:35.720Z
fee = utxo value - amountToSend - changeAmount.
So you are implicitly deciding the fee when you specify changeAmount. Not after making the transaction but before.
Oscar Guindzberg
CC BY-SA 3.0
2015-02-25T16:12:46.827Z
Just to be clear, some other options to create transactions automatically set a reasonable fee. Here you have to choose the fee yourself.
Oscar Guindzberg
CC BY-SA 3.0
2015-02-25T15:15:57.180Z
2015-02-25T15:15:57.180Z
Oscar Guindzberg
<p>You have a few options here. You can create a raw transaction as discussed in another answer, but this is probably the most difficult and easiest to do wrong (make sure your inputs and outputs match!) </p>

<p>Another option would be to create a one-to-one mapping from addresses to accounts. </p>

<p>You can also play games with the <code>move</code> command moving coins from one account to another and then sending, from that account, but this is complex also. </p>

CC BY-SA 3.0
2015-02-25T15:38:42.100Z
I would love to avoid raw transactions as well. I was thinking about using an account named `CASHOUT` and with `move` move the bitcoins from the order address to any of the `CASHOUT` addresses as soon as I ship the product. Then, I would add `paytxfee=<amt>` on `bitcoin.conf` so I'll know in advance how many BTCs I'm going to pay, and counting with those fees when cashing out to an address outside the server, but I'm not sure if that would work...
Cornezuelo del Centeno
CC BY-SA 3.0
2015-02-25T15:20:53.367Z
2015-02-25T15:20:53.367Z
Loourr
<p>I'm programming the back-end for an ecommerce solution, Bitcoind API gives me one way of sending money to a bitcoin address: <code>sendfrom &lt;fromaccount&gt; &lt;tobitcoinaddress&gt; &lt;amount&gt;</code></p>

<p>If I understood well, this will transfer money from one account to an address, but I don't see any way of sending from address to address. I didn't implemented accounts on my backend system, and don't want to do it as it's an aditional layer of complexity that I don't want to deal with right now.</p>

<p>So, I supose this will grab money from whatever address/addresses asociated to the account and send them to the bitcoin address provided. Any way of doing what I want to do?</p>

<bitcoind><address><php><sending>
Sending from address to address in bitcoind
Cornezuelo del Centeno
# Sending from address to address in bitcoind

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

I'm programming the back-end for an ecommerce solution, Bitcoind API gives me one way of sending money to a bitcoin address: `sendfrom <fromaccount> <tobitcoinaddress> <amount>`

If I understood well, this will transfer money from one account to an address, but I don't see any way of sending from address to address. I didn't implemented accounts on my backend system, and don't want to do it as it's an aditional layer of complexity that I don't want to deal with right now.

So, I supose this will grab money from whatever address/addresses asociated to the account and send them to the bitcoin address provided. Any way of doing what I want to do?

**Tags:** bitcoind, address, php, sending


---

## 2 answers

### Answer by username_1 on 2015-02-25. Score: 1 | Accepted answer

To find the transaction outputs you can spend

```
listunspent 0 99999999999 "[\"addressYouWantToSpend\"]"

```

Then create the tx

```
createrawtransaction "[{\"txid\":\"txIdToSpend\",\"vout\":n}]" "{\"destinationAddress\":amountToSend, \"changeAddress\":changeAmount}"

```

Then sign the tx

```
signrawtransaction <hexStringProvidedBycreaterawtransaction>

```

Then publish the tx

```
sendrawtransaction <hexStringProvidedBysignrawtransaction>

```

> **Comments:**
> **username_0**: Wouldn't I know the fees after making the transaction? This won't allow me to check if the account has enough funds for paying the fees of how much he wants to send.  
> **username_1**: fee = utxo value - amountToSend - changeAmount. So you are implicitly deciding the fee when you specify changeAmount. Not after making the transaction but before.  
> **username_1**: Just to be clear, some other options to create transactions automatically set a reasonable fee. Here you have to choose the fee yourself.  

---

### Answer by username_2 on 2015-02-25. Score: 0

You have a few options here. You can create a raw transaction as discussed in another answer, but this is probably the most difficult and easiest to do wrong (make sure your inputs and outputs match!)

Another option would be to create a one-to-one mapping from addresses to accounts.

You can also play games with the `move` command moving coins from one account to another and then sending, from that account, but this is complex also.

> **Comments:**
> **username_0**: I would love to avoid raw transactions as well. I was thinking about using an account named `CASHOUT` and with `move` move the bitcoins from the order address to any of the `CASHOUT` addresses as soon as I ship the product. Then, I would add `paytxfee=<amt>` on `bitcoin.conf` so I'll know in advance how many BTCs I'm going to pay, and counting with those fees when cashing out to an address outside the server, but I'm not sure if that would work...  

---

