6

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?

3
  • this question was asked previously in stackoverflow but didn't get any answer stackoverflow.com/q/41092857/2205297
    – muimota
    Commented Dec 19, 2016 at 9:34
  • By an external driver do you mean one connected via USB? Commented Dec 21, 2016 at 16:31
  • @shabahat-m-ayubi yes a WD Passport ultra.
    – muimota
    Commented Dec 26, 2016 at 17:03

2 Answers 2

1

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 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.

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 at the same time to satisfy your needs while not getting blocked for abuse. Also, services such as blockr.io 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.

5
  • Using a API service could be a option but the it wouldn't be a solution since it depends on external company limitations.
    – muimota
    Commented Dec 25, 2016 at 12:53
  • VPS would need 200Gb to store the blockchain it would be much more than 10$ month
    – muimota
    Commented Dec 25, 2016 at 12:55
  • @muimota Will this visualization be real-time and require data on new transactions or will this be a one-time thing?
    – MrFregg
    Commented Dec 26, 2016 at 10:19
  • A one-time thing. Just checking previous transactions in time, not realtime.
    – muimota
    Commented Dec 26, 2016 at 17:02
  • @muimota Try increasing rpcthread.
    – MrFregg
    Commented Dec 26, 2016 at 17:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.