List transactions from given address in bitcoind
Asked Answered
I

4

7

Is there anyway to list all transactions from given address by using API RPC to bitcoind? Actually, I'm using btcd and most non-wallet functions are the same with bitcoind, but I can't find any methods to do that.

Izzard answered 29/1, 2015 at 1:42 Comment(0)
H
7

Due to the way the transactions are indexed you cannot perform this kind of query with Bitcoind, I'm assuming the case is the same for btcd.

If you would like to get this information, you have a few options:

  • Parse the Blockchain yourself and store the data in a new, more heavily-indexed DB
  • Use a 3rd party service like Chain.com or Blockchain.info
  • Run a different type of node. Toshi is an open source Ruby implementation of Bitcoin by Coinbase. The DB of this node allows for richer queries, but requires an order of magnitude more storage.

Edit: Toshi is no longer maintained and chain.com no longer provides this API afaik.

Heteronym answered 9/2, 2015 at 6:53 Comment(1)
Parsing the blockchain is good in terms of security. Is possible to validate if the output from third party service? Checks like signature and also if the transaction was really accepted (or rejected) in the blockchain.Blaine
O
2

btcd recently merged in a feature that creates an address index that can be used to query for specific address

https://github.com/btcsuite/btcd/issues/190

To enable this feature, run btcd with the addrindex flag, like so -

btcd --addrindex

Transactions can queried over RPC using the new searchrawtransactions rpc call. It takes a while to create the address index, so wait until it has completed indexing to be able to use this index

Occidental answered 24/3, 2015 at 22:54 Comment(1)
The feature was apparently removed at some point, I don't have it in Bitcoin Core version v26.0.0. Related: bitcoin.stackexchange.com/questions/116072/…Adora
I
0

As I know there is no method to list all transaction from given bitcoin address. But you can use account for that.

You can create one bitcoin address per account. And there is method to list all transactions for given account listtransactions.

Read more about account: https://en.bitcoin.it/wiki/Accounts_explained

Bitcoind API calls list: https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_Calls_list

Indraft answered 4/2, 2015 at 16:0 Comment(0)
A
0

Blockchair API

A good API nowadays is Blockchair, e.g. to get all transactions with an output to 1MVpQJA7FtcDrwKC6zATkZvZcxqma4JixS which was the address of cryptograffiti.info by increasing date:

#!/usr/bin/env bash
set -eu
d=data/cryptograffiti-blockchair
i=0
# max allowed
limit=100
rm -rf "$d"
mkdir -p "$d"
while true; do
  f="$d/$i"
  echo curl "https://api.blockchair.com/bitcoin/outputs?offset=$((i * limit))&limit=$limit&s=time(asc)&q=recipient(1MVpQJA7FtcDrwKC6zATkZvZcxqma4JixS)"
  curl "https://api.blockchair.com/bitcoin/outputs?offset=$((i * limit))&limit=$limit&s=time(desc)&q=recipient(1MVpQJA7FtcDrwKC6zATkZvZcxqma4JixS)" | jq -r '.data[].transaction_hash' > "$f"
  if [ "$(wc -l "$f" | cut -f1 -d' ')" -lt "$limit" ]; then
    break
  fi
  i=$((i+1))
done
cat "$d"/* > data/cryptograffiti

You can build this interactively from the UI at: https://blockchair.com/bitcoin/outputs?s=time(desc)&q=recipient(1MVpQJA7FtcDrwKC6zATkZvZcxqma4JixS)

TODO: that was to address, find from address. There's on obvious corresponding "inputs" endpoint.

Tested on Ubuntu 23.10.

Adora answered 16/2 at 20:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.