All Projects → jonasschnelli → bitcoincore-indexd

jonasschnelli / bitcoincore-indexd

Licence: other
p2p based txindex for Bitcoin

Programming Languages

c
50402 projects - #5 most used programming language
C++
36643 projects - #6 most used programming language
python
139335 projects - #7 most used programming language
objective c
16641 projects - #2 most used programming language
M4
1887 projects
Makefile
30231 projects

Projects that are alternatives of or similar to bitcoincore-indexd

core-review
Scripts, tools & info for doing Bitcoin Core development and code review
Stars: ✭ 78 (+95%)
Mutual labels:  bitcoin-core
ethereumd-proxy
Proxy client-server for Ethereum node using bitcoin JSON-RPC interface.
Stars: ✭ 21 (-47.5%)
Mutual labels:  bitcoin-core
bitcoin-kit-android
Comprehensive Bitcoin development library for iOS, implemented on Swift. SPV wallet implementation for Bitcoin, Bitcoin Cash, Litecoin and Dash blockchains. Fully compliant with existing standards and BIPs.
Stars: ✭ 102 (+155%)
Mutual labels:  bitcoin-core

External transaction index for Bitcoin Core

Build Status

Status

This project is still experimental, use at your own risk!

How does it work

The indexer connects to a fullnode over the p2p protocol (at the moment 127.0.0.1:8333 mainnet) and performs the following actions:

  • opens database
  • connect to the peer
  • sync all headers, find unindexed blocks
  • requests blocks that are not yet indexed
  • index all found transactions txid->blockhash
  • once all blocks (found via header) has been requested, idle for new inv/block messaged

Be aware!

The indexer trusts the remote peer! Only connect to a trusted peer, ideally via localhost. If you connect via the public internet, make sure you connect through a secure channel.

Database

  • The indexer currently works only with leveldb (there was a LMDB implementation, check git history).
  • In order to save space, each block will get an internal blockmap-key (uint32 / 4bytes). That internal blockmap-key must not be confused with the block-height. The blockmap-key may be different on other systems/instances.

Space requirements

  • ~14.3GB up to block 522081 (May 10th 2018)
  • complete index up to 522081 takes about ~60min on a fast CPU with SSD

REST interface

  • Lookup can be done via HTTP 18445
  • Two endpoints ** /blockhash/<txhash> will return the blockhash of the requested transaction id ** /tx/<txhash> will return the transaction of the requested txid (will fetch the relevant block via p2p and return the tx)

TODO:

  • Reduce memory usage with internal header maps
  • Lookup should also respect the non-flushed cache
  • Make sure that incoming block invs during sync-via-headers do not confuse the indexer
  • Add file based logging
  • Add runtime option to switch network (testnet, regtest) and the IP to connect to

Build

./autogen.sh
./configure
make -j

run

./src/bitcoincore-indexd

Options

  • ./src/bitcoincore-indexd --datadir=/tmp (change datadir, default is ~/.bitcoincore-indexd)
  • ./src/bitcoincore-indexd --dbcache=xxx (change the leveldb dbcache)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].