Author

Topic: Getting tx data from tx hash, and getting all unconfirmd txs (mempool) from API? (Read 707 times)

hero member
Activity: 882
Merit: 1000
Exhausted
If you use bitcoin-qt you can use the command line.
Yes, I understand, but I'm typically using APIs in situations where I don't have (or want to) access one of my full nodes.

Besides, even with running your own Bitcoin-QT, you generally can't retrieve stats for any address, just your own wallet.

Regarding the last line in your post, you can run your bitcoin core with -txindex (you may also need to run it with -reindex but I am not 100% sure) and it will build a tx index for all the transactions.
You will be able to use getrawtransaction on any transactions then.

FYR: https://en.bitcoin.it/wiki/Running_Bitcoin#Command-line_arguments
legendary
Activity: 1176
Merit: 1011
If you use bitcoin-qt you can use the command line.
Yes, I understand, but I'm typically using APIs in situations where I don't have (or want to) access one of my full nodes.

Besides, even with running your own Bitcoin-QT, you generally can't retrieve stats for any address, just your own wallet.
newbie
Activity: 20
Merit: 1
If you use bitcoin-qt you can use the command line.

https://en.bitcoin.it/wiki/Running_Bitcoin#Command-line_arguments

Most clients have a version. With the interface you can find the console under ->Help. You can also launch a server:
bitcoind -server
and then use bitcoin-cli

The commands you want are:

bitcoin-cli getrawtransaction  HASH
(gets hexadecimal byte sequence in hexadecimal)
bitcoin-cli getrawtransaction  HASH 1
(gets the JSON-parsed version)

bitcoin-cli getrawmempool
(gives the mempool at your local node)

If you access the console from bitcoin-qt, drop bitcoin-cli.

You can also find an online mempool explorer in:

http://webbtc.com/mempool
legendary
Activity: 1176
Merit: 1011
Nice, I missed that. Thanks!
hero member
Activity: 882
Merit: 1000
Exhausted
For part 1: You could use Blockr API to get the hex raw transaction.

Check https://btc.blockr.io/documentation/api for the details.

Quote
Raw transaction data

Returns raw transaction data in the bitcoin format.
http://btc.blockr.io/api/v1/tx/raw/60c1f1a3160042152114e2bba45600a5045711c3a8a458016248acec59653471
will return raw data for a given transaction.
legendary
Activity: 1176
Merit: 1011
I'm looking for two functionalities in particular. Is there a Bitcoin web API (like blocktrail, blockcypher, etc) that lets me:

1. Get a tx's complete data (hex) from its hash? Especially for unconfirmed txs, but preferably for any tx.

2. Get a list of all unconfirmed txs currently in mempool? (obviously this would vary somewhat from node to node)

Haven't been able to find these functions in any online API yet, or am I misunderstanding the documentation?
Jump to: