Author

Topic: getTxOut by address (Read 1339 times)

full member
Activity: 203
Merit: 168
March 16, 2016, 07:45:28 PM
#8
Here is the btcd help for searchrawtransactions so you can see if it does what you need.  Personally I have found it very useful and speedy.

Code:
$ ./btcctl help searchrawtransactions
searchrawtransactions "address" (verbose=1 skip=0 count=100 vinextra=0 reverse=false ["filteraddr",...])

Returns raw data for transactions involving the passed address.
Returned transactions are pulled from both the database, and transactions currently in the mempool.
Transactions pulled from the mempool will have the 'confirmations' field set to 0.
Usage of this RPC requires the optional --addrindex flag to be activated, otherwise all responses will simply return with an error stating the address index has not yet been built.
Similarly, until the address index has caught up with the current best height, all requests will return an error response in order to avoid serving stale data.

Arguments:
1. address     (string, required)                 The Bitcoin address to search for
2. verbose     (numeric, optional, default=1)     Specifies the transaction is returned as a JSON object instead of hex-encoded string
3. skip        (numeric, optional, default=0)     The number of leading transactions to leave out of the final response
4. count       (numeric, optional, default=100)   The maximum number of transactions to return
5. vinextra    (numeric, optional, default=0)     Specify that extra data from previous output will be returned in vin
6. reverse     (boolean, optional, default=false) Specifies that the transactions should be returned in reverse chronological order
7. filteraddrs (array of string, optional)        Address list.  Only inputs or outputs with matching address will be returned

Result (verbose=0):
"value" (string) Hex-encoded serialized transaction

Result (verbose=1):
[{
 "hex": "value",               (string)          Hex-encoded transaction
 "txid": "value",              (string)          The hash of the transaction
 "version": n,                 (numeric)         The transaction version
 "locktime": n,                (numeric)         The transaction lock time
 "vin": [{                     (array of object) The transaction inputs as JSON objects
  "coinbase": "value",         (string)          The hex-encoded bytes of the signature script (coinbase txns only)
  "txid": "value",             (string)          The hash of the origin transaction (non-coinbase txns only)
  "vout": n,                   (numeric)         The index of the output being redeemed from the origin transaction (non-coinbase txns only)
  "scriptSig": {               (object)          The signature script used to redeem the origin transaction as a JSON object (non-coinbase txns only)
   "asm": "value",             (string)          Disassembly of the script
   "hex": "value",             (string)          Hex-encoded bytes of the script
  },
  "prevOut": {                 (object)          Data from the origin transaction output with index vout.
   "addresses": ["value",...], (array of string) previous output addresses
   "value": n.nnn,             (numeric)         previous output value
  },
  "sequence": n,               (numeric)         The script sequence number
 },...],
 "vout": [{                    (array of object) The transaction outputs as JSON objects
  "value": n.nnn,              (numeric)         The amount in BTC
  "n": n,                      (numeric)         The index of this transaction output
  "scriptPubKey": {            (object)          The public key script used to pay coins as a JSON object
   "asm": "value",             (string)          Disassembly of the script
   "hex": "value",             (string)          Hex-encoded bytes of the script
   "reqSigs": n,               (numeric)         The number of required signatures
   "type": "value",            (string)          The type of the script (e.g. 'pubkeyhash')
   "addresses": ["value",...], (array of string) The bitcoin addresses associated with this script
  },
 },...],
 "blockhash": "value",         (string)          Hash of the block the transaction is part of
 "confirmations": n,           (numeric)         Number of confirmations of the block
 "time": n,                    (numeric)         Transaction time in seconds since 1 Jan 1970 GMT
 "blocktime": n,               (numeric)         Block time in seconds since the 1 Jan 1970 GMT
},...]
newbie
Activity: 15
Merit: 1
March 16, 2016, 01:15:13 PM
#6
Can I subscribe some address with bitc?
I mean if get incoming transaction for the my address bitd will send notification
or need to ping bitd each 5 seconds for example ?
Can I check bitd like online service ? I mean online API for testing

Thank you for recommendation!
newbie
Activity: 15
Merit: 1
March 16, 2016, 12:52:19 PM
#5
> For local lookups of arbitrary addresses you could use btcd instead of bitcoind.
> btcd has an address index.  It needs to be enabled in your config with the addrindex flag.  See the searchrawtransactions API.

Do you mean https://opensource.conformal.com/wiki/btcd ?
hero member
Activity: 692
Merit: 569
March 14, 2016, 08:29:24 AM
#4
There is code to enable addrindex in bitcoin https://github.com/bitcoin/bitcoin/pull/6835/commits . Its not merged yet,  but should work. You can try it out
full member
Activity: 203
Merit: 168
March 12, 2016, 03:43:57 PM
#3
For local lookups of arbitrary addresses you could use btcd instead of bitcoind.

btcd has an address index.  It needs to be enabled in your config with the addrindex flag.  See the searchrawtransactions API.
staff
Activity: 3458
Merit: 6793
Just writing some code
March 12, 2016, 10:27:35 AM
#2
You could import the address into the wallet as watching-only with importaddress
. Otherwise, Bitcoin Core doesn't do address checking stuff, so you can use online apis from blockchain.info, blocktrail.com, blockcypher.com, and many other places.
newbie
Activity: 15
Merit: 1
March 12, 2016, 08:43:42 AM
#1
Hello!
I'm trying to get transaction tx out by address with bitcoind. Current address does not contains in the bitcoin wallet.

Current solution

1. getblockhash
2. getblock
3. gettxout "a070c999b594d7b0922adebf00c74c69db5b2c1b6da08a83dad99c11f57c03d1" 0

Quote
{
"bestblock" : "000000000000000000ca1b3c58c26c016a1cf6331675bd4b7e303a2522a6f4ce",
"confirmations" : 231,
"value" : 0.17800000,
"scriptPubKey" : {
"asm" : "OP_DUP OP_HASH160 0596a9bc158e13ba4a75c800d317b748bfe3577a OP_EQUALVERIFY OP_CHECKSIG",
"hex" : "76a9140596a9bc158e13ba4a75c800d317b748bfe3577a88ac",
"reqSigs" : 1,
"type" : "pubkeyhash",
"addresses" : [
"1WYsDAYJBiLxLQKeSR8eLfpTumUYmuxgW"
]
},
"version" : 1,
"coinbase" : false
}

4. compare address from JSON with my address.

As you can see this is like brute force. O(n) complexity...

Do you know how to subscribe address for checking incoming tx_outs by address "address does not exist in the bitcoind wallet" 

Any Java libraries for this aims ?
Any free API ?
Any recommendations ?

Thanks!
Jump to: