From 4c3e0b618a1837b9387964ad66167e04fe8f02de Mon Sep 17 00:00:00 2001 From: "myarbrough@oreilly.com" Date: Tue, 4 Nov 2014 10:04:07 -0800 Subject: [PATCH] Made changes to ch02.asciidoc --- ch02.asciidoc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ch02.asciidoc b/ch02.asciidoc index 9467086a..66c0b65b 100644 --- a/ch02.asciidoc +++ b/ch02.asciidoc @@ -129,12 +129,16 @@ Alice's wallet application will first have to find inputs that can pay for the a If the wallet application does not maintain a copy of unspent transaction outputs, it can query the bitcoin network to retrieve this information, using a variety of APIs available by different providers or by asking a full-index node using the bitcoin JSON RPC API. Example 2-1 shows a RESTful API request, constructed as an HTTP GET command to a specific URL. This URL will return all the unspent transaction outputs for an address, giving any application the information it needs to construct transaction inputs for spending. We use the simple command-line HTTP client _cURL_ to retrieve the response. - +[[example_2-1]] .Look up all the unspent outputs for Alice's bitcoin address +==== [source,bash] ---- $ curl https://blockchain.info/unspent?active=1Cdid9KFAaatwczBwBttQcwXYCpvK8h7FK ---- +==== + +==== [source,json] ---- { @@ -154,6 +158,7 @@ $ curl https://blockchain.info/unspent?active=1Cdid9KFAaatwczBwBttQcwXYCpvK8h7FK ] } ---- +==== The response shows one unspent output (one that has not been redeemed yet) under the ownership of Alice's address +1Cdid9KFAaatwczBwBttQcwXYCpvK8h7FK+. The response includes the reference to the transaction in which this unspent output is contained (the payment from Joe) and its value in satoshis, at 10 million, equivalent to 0.10 bitcoin. With this information, Alice's wallet application can construct a transaction to transfer that value to new owner addresses.