GithubHelp home page GithubHelp logo

flypsmashin1 / bitcoincore-indexd Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jonasschnelli/bitcoincore-indexd

0.0 0.0 0.0 1.4 MB

p2p based txindex for Bitcoin

Shell 0.40% C++ 30.47% Python 5.77% C 50.40% Objective-C 5.61% Java 0.86% Assembly 0.75% Makefile 1.16% HTML 0.56% M4 4.02%

bitcoincore-indexd's Introduction

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)

bitcoincore-indexd's People

Contributors

jonasschnelli avatar laanwj avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.