<p>You will want to use the listunspent call from the blockchain.info API</p>

<p><a href="http://blockchain.info/unspent?active=" rel="nofollow">http://blockchain.info/unspent?active=</a>$address</p>

<p>This will give you a list of all unspent outputs at that address which are available to be used in a transaction.</p>

<p>You will then need to build a raw transaction to spend those outputs.</p>

<p><a href="https://en.bitcoin.it/wiki/Raw_Transactions" rel="nofollow">https://en.bitcoin.it/wiki/Raw_Transactions</a></p>

CC BY-SA 3.0
2014-11-25T17:08:05.690Z
2014-11-25T17:08:05.690Z
Mullick
<p>I'd like to write a simple Bitcoin client that broadcast transactions. The model is pretty simple:</p>

<blockquote>
  <p>Alice wants to send 10 BTC to Bob. We <strong>only</strong> know Alice's private key and Bob's address.</p>
</blockquote>

<p>For making the transaction, I need to collect enough Alice's previous transactions up to 10 BTC.</p>

<p>I've found the <a href="https://blockchain.info/api/blockchain_api" rel="nofollow">Blockchain Data API</a>, that can be queried using Alice's address (which I can derive from Alice's private key, which is known by the client).</p>

<p>If I <code>GET</code> the API above using</p>

<pre><code>$ curl -L http://blockchain.info/address/&lt;Alice's address&gt;?format=json&amp;sort=&lt;[01]&gt;
</code></pre>

<p>I'll be returned with a JSON containing the whole list of transactions.</p>

<p>How should  I use this result for collecting all the Alice's transactions that can be used in a newer transaction?</p>

CC BY-SA 3.0
2014-11-25T11:15:42.317Z
What is the question? You should write a program, which parses the result, creates transaction from Alice to Bob, signs it with Alice's private key and broadcasts it to a network.
amaclin
CC BY-SA 3.0
2014-11-25T13:12:16.387Z
I'm not sure this is a question or a request to do the development for them. You need to be much more specific about what it is you are having problems with. "A bitcoin client" is not the problem you are having.
T9b
<blockchain.info>
Get a list of txs that can be used for a newer tx
Giuseppe Crinò
# Get a list of txs that can be used for a newer tx

(Asked by: username_0 on 2014-11-25)

I'd like to write a simple Bitcoin client that broadcast transactions. The model is pretty simple:

> Alice wants to send 10 BTC to Bob. We **only** know Alice's private key and Bob's address.

For making the transaction, I need to collect enough Alice's previous transactions up to 10 BTC.

I've found the [Blockchain Data API](https://blockchain.info/api/blockchain_api), that can be queried using Alice's address (which I can derive from Alice's private key, which is known by the client).

If I `GET` the API above using

```
$ curl -L http://blockchain.info/address/<Alice's address>?format=json&sort=<[01]>

```

I'll be returned with a JSON containing the whole list of transactions.

How should I use this result for collecting all the Alice's transactions that can be used in a newer transaction?

**Tags:** blockchain.info

> **Comments:**
> **username_1**: What is the question? You should write a program, which parses the result, creates transaction from Alice to Bob, signs it with Alice's private key and broadcasts it to a network.  
> **username_2**: I'm not sure this is a question or a request to do the development for them. You need to be much more specific about what it is you are having problems with. "A bitcoin client" is not the problem you are having.  

---

## 1 answers

### Answer by username_3 on 2014-11-25. Score: 1

You will want to use the listunspent call from the blockchain.info API

<http://blockchain.info/unspent?active=>$address

This will give you a list of all unspent outputs at that address which are available to be used in a transaction.

You will then need to build a raw transaction to spend those outputs.

<https://en.bitcoin.it/wiki/Raw_Transactions>


---

