<p>A quick and relatively fast way (probably much faster then Bitcore) is using a recent version of <strong>Bitcoin Core</strong> and run it with <code>-txindex</code> and <code>-rest</code>.</p>

<p>Then use the <a href="https://github.com/bitcoin/bitcoin/blob/master/doc/REST-interface.md" rel="nofollow noreferrer">REST interface</a> to query for a txid.</p>

<p>Example:
<code>curl localhost:18332/rest/tx/0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098.json</code></p>

<p>You can even bypass the JSON encoding/decoding if you look for faster processing by using <code>.bin</code> instead of <code>.json</code> in your request URI.</p>

<p>Internally, Bitcoin Core uses levelDB for the txindex which tends to be blazing fast and once the file &amp; disk position has been loaded from the levelDB, the according block file will be opened, then the file pointer seeks to the tx-position and deserialises only the requested tx.</p>

<p>Also don't forget, that Bitcore uses Bitcoin Core under the hood (very likely an outdated version since Bitcore is AFAIK no longer maintained).</p>

<p>Using a blockexplorer (or say web API) will make you trust a third party and will pretty sure be much slower.</p>

CC BY-SA 4.0
2019-01-08T07:10:49.237Z
2019-01-08T07:10:49.237Z
Jonas Schnelli
<p>Since hardware is acting as a bottleneck, how about using APIs offered by services or using a fast VPS to run bitcore?</p>

<ol>
<li><p>API services</p>

<p>Websites such as Blockchain.info offer free developer APIs. Since they have limits to the number of queries per given time, you can use <a href="https://bitcointalk.org/index.php?topic=636463.0" rel="nofollow noreferrer">multiple services</a> at the same time to satisfy your needs while not getting blocked for abuse. Also, services such as <a href="https://blockr.io/documentation/api" rel="nofollow noreferrer">blockr.io</a> recommend contacting them if you have a large number of queries to make. </p></li>
<li><p>VPS</p>

<p>You can also spend on a VPS  which uses SSDs and run bitcore on them to attempt to get more queries per second.</p></li>
</ol>

CC BY-SA 3.0
2016-12-25T12:53:01.683Z
Using a API service could be a option but the it wouldn't be a solution since it depends on external company limitations.
muimota
CC BY-SA 3.0
2016-12-25T12:55:15.350Z
VPS would need 200Gb to store the blockchain it would be much more than 10$ month
muimota
CC BY-SA 3.0
2016-12-26T10:19:10.297Z
@muimota Will this visualization be real-time and require data on new transactions or will this be a one-time thing?
MrFregg
CC BY-SA 3.0
2016-12-26T17:02:06.683Z
A one-time thing. Just checking previous transactions in time, not realtime.
muimota
CC BY-SA 3.0
2016-12-26T17:42:27.103Z
@muimota Try increasing `rpcthread`.
MrFregg
CC BY-SA 3.0
2016-12-19T11:33:47.800Z
2016-12-26T08:43:48.947Z
2016-12-26T08:43:48.947Z
MrFregg
<p>I am working in an artistic/visualization project that analyses Bitcoin transactions. I have a <code>Bitcore</code> instance with insight API and from a Python script I query through the REST API so the queries are returned in json format. For the project I use a macbook pro and with its internal ssd drive I get around 70 queries per second, using an external NTFS (fuse drivers) driver I get as little as 5 per second.</p>

<p>I would like to know if there is a faster way to query transactions by transaction's hash even if it is more complex to code.</p>

<p>What would be the fastest way to query for a certain txid to get its inputs?</p>

CC BY-SA 3.0
2016-12-19T09:34:27.003Z
this question was asked previously in stackoverflow but didn't get any answer http://stackoverflow.com/q/41092857/2205297
muimota
CC BY-SA 3.0
2016-12-21T16:31:24.843Z
By an external driver do you mean one connected via USB?
Shabahat M. Ayubi
CC BY-SA 3.0
2016-12-26T17:03:37.740Z
@shabahat-m-ayubi yes a WD Passport ultra.
muimota
<bitcoind><bitcore><transaction-id>
What would be the fastest way to query for a certain txid to get its inputs?
muimota
# What would be the fastest way to query for a certain txid to get its inputs?

(Asked by: username_0 on 2016-12-19)

I am working in an artistic/visualization project that analyses Bitcoin transactions. I have a `Bitcore` instance with insight API and from a Python script I query through the REST API so the queries are returned in json format. For the project I use a macbook pro and with its internal ssd drive I get around 70 queries per second, using an external NTFS (fuse drivers) driver I get as little as 5 per second.

I would like to know if there is a faster way to query transactions by transaction's hash even if it is more complex to code.

What would be the fastest way to query for a certain txid to get its inputs?

**Tags:** bitcoind, bitcore, transaction-id

> **Comments:**
> **username_0**: this question was asked previously in stackoverflow but didn't get any answer http://stackoverflow.com/q/41092857/2205297  
> **username_1**: By an external driver do you mean one connected via USB?  
> **username_0**: @shabahat-m-ayubi yes a WD Passport ultra.  

---

## 2 answers

### Answer by username_2 on 2019-01-08. Score: 1 | Accepted answer

A quick and relatively fast way (probably much faster then Bitcore) is using a recent version of **Bitcoin Core** and run it with `-txindex` and `-rest`.

Then use the [REST interface](https://github.com/bitcoin/bitcoin/blob/master/doc/REST-interface.md) to query for a txid.

Example:
`curl localhost:18332/rest/tx/0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098.json`

You can even bypass the JSON encoding/decoding if you look for faster processing by using `.bin` instead of `.json` in your request URI.

Internally, Bitcoin Core uses levelDB for the txindex which tends to be blazing fast and once the file & disk position has been loaded from the levelDB, the according block file will be opened, then the file pointer seeks to the tx-position and deserialises only the requested tx.

Also don't forget, that Bitcore uses Bitcoin Core under the hood (very likely an outdated version since Bitcore is AFAIK no longer maintained).

Using a blockexplorer (or say web API) will make you trust a third party and will pretty sure be much slower.


---

### Answer by username_3 on 2016-12-19. Score: 0

Since hardware is acting as a bottleneck, how about using APIs offered by services or using a fast VPS to run bitcore?

1. API services

   Websites such as Blockchain.info offer free developer APIs. Since they have limits to the number of queries per given time, you can use [multiple services](https://bitcointalk.org/index.php?topic=636463.0) at the same time to satisfy your needs while not getting blocked for abuse. Also, services such as [blockr.io](https://blockr.io/documentation/api) recommend contacting them if you have a large number of queries to make.
2. VPS

   You can also spend on a VPS which uses SSDs and run bitcore on them to attempt to get more queries per second.

> **Comments:**
> **username_0**: Using a API service could be a option but the it wouldn't be a solution since it depends on external company limitations.  
> **username_0**: VPS would need 200Gb to store the blockchain it would be much more than 10$ month  
> **username_3**: @username_0 Will this visualization be real-time and require data on new transactions or will this be a one-time thing?  
> **username_0**: A one-time thing. Just checking previous transactions in time, not realtime.  
> **username_3**: @username_0 Try increasing `rpcthread`.  

---

