Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 36 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,38 @@
# Bitcoin P2P indexer

This project is an indexer for Bitcoin and Bitcoin forks. It takes advantage of the P2P protocol in Bitcoin to fetch blocks and transactions
This project is an indexer for Bitcoin and Bitcoin forks. It takes advantage of the P2P protocol in Bitcoin to fetch blocks and transactions.

## Run

### Config

The indexer need a couple of information to be specified in a `config.toml` file : database info and one peer to the network. To create a config file copy `config.example.toml` into `config.toml`.

`config.toml` example
```
[database]
host = "localhost"
user = "postgres"
password = "wow"
dbname = "blockchains"

[peer]
ip = "127.0.0.1"
port = 8333
```

To find a peer we can do a `nslookup` on the dns seed of the network we wnat to index. For the port it is the p2p port used by this specific network (e.g bitcoin mainnet is `8333` and fordogecoin testnet it is `44556`).

### Docker compose

In the `contrib/` folder there is a `docker-compose.yml` file to start any indexer. First we need to create a config file matching the network we want to index (e.g `config.dogecoin-mainnet.toml`).

Then run the docker compose command.
```
$ docker compose up postgres indexer_dogecoin_mainnet
```

or to start them all
```
$ docker compose up
```
31 changes: 23 additions & 8 deletions contrib/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
version: "3.9"
# Docker-compose.yml file to index all the blockchains
# The config.*.yml files mathing the network has to be created first

services:
# Bitcoin Mainnet
indexer_bitcoin_mainnet:
build: ../.
image: rllola/prototype
build: https://github.com/cyber-coop/prototype.git
container_name: indexer-bitcoin-mainnet
depends_on:
- postgres
environment:
Expand All @@ -17,7 +20,9 @@ services:

# Bitcoin testnet
indexer_bitcoin_testnet:
build: ../.
image: rllola/prototype
build: https://github.com/cyber-coop/prototype.git
container_name: indexer-bitcoin-testnet
depends_on:
- postgres
environment:
Expand All @@ -31,7 +36,9 @@ services:

# Dogecoin Mainnet
indexer_dogecoin_mainnet:
build: ../.
image: rllola/prototype
build: https://github.com/cyber-coop/prototype.git
container_name: indexer-dogecoin-mainnet
depends_on:
- postgres
environment:
Expand All @@ -45,7 +52,9 @@ services:

# Dogecoin testnet
indexer_dogecoin_testnet:
build: ../.
image: rllola/prototype
build: https://github.com/cyber-coop/prototype.git
container_name: indexer-dogecoin-testnet
depends_on:
- postgres
environment:
Expand All @@ -59,7 +68,9 @@ services:

# Litecoin Mainnet
indexer_litecoin_mainnet:
build: ../.
image: rllola/prototype
build: https://github.com/cyber-coop/prototype.git
container_name: indexer-litecoin-mainnet
depends_on:
- postgres
environment:
Expand All @@ -73,7 +84,9 @@ services:

# Litecoin Testnet
indexer_litecoin_testnet:
build: ../.
image: rllola/prototype
build: https://github.com/cyber-coop/prototype.git
container_name: indexer-litecoin-testnet
depends_on:
- postgres
environment:
Expand All @@ -87,7 +100,9 @@ services:

# Namecoin Mainnet
indexer_namecoin_mainnet:
build: ../.
image: rllola/prototype
build: https://github.com/cyber-coop/prototype.git
container_name: indexer-namecoin-mainnet
depends_on:
- postgres
environment:
Expand Down