• Stars
    star
    585
  • Rank 73,969 (Top 2 %)
  • Language
    Go
  • License
    GNU Affero Genera...
  • Created over 6 years ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

📘 Trezor address/account balance backend

Go Report Card

Blockbook

Blockbook is back-end service for Trezor wallet. Main features of Blockbook are:

  • index of addresses and address balances of the connected block chain
  • fast index search
  • simple blockchain explorer
  • websocket, API and legacy Bitcore Insight compatible socket.io interfaces
  • support of multiple coins (Bitcoin and Ethereum type) with easy extensibility to other coins
  • scripts for easy creation of debian packages for backend and blockbook

Build and installation instructions

Officially supported platform is Debian Linux and AMD64 architecture.

Memory and disk requirements for initial synchronization of Bitcoin mainnet are around 32 GB RAM and over 180 GB of disk space. After initial synchronization, fully synchronized instance uses about 10 GB RAM. Other coins should have lower requirements, depending on the size of their block chain. Note that fast SSD disks are highly recommended.

User installation guide is here.

Developer build guide is here.

Contribution guide is here.

Implemented coins

Blockbook currently supports over 30 coins. The Trezor team implemented

  • Bitcoin, Bitcoin Cash, Zcash, Dash, Litecoin, Bitcoin Gold, Ethereum, Ethereum Classic, Dogecoin, Namecoin, Vertcoin, DigiByte, Liquid

the rest of coins were implemented by the community.

Testnets for some coins are also supported, for example:

  • Bitcoin Testnet, Bitcoin Cash Testnet, ZCash Testnet, Ethereum Testnet Ropsten

List of all implemented coins is in the registry of ports.

Common issues when running Blockbook or implementing additional coins

Out of memory when doing initial synchronization

How to reduce memory footprint of the initial sync:

  • disable rocksdb cache by parameter -dbcache=0, the default size is 500MB
  • run blockbook with parameter -workers=1. This disables bulk import mode, which caches a lot of data in memory (not in rocksdb cache). It will run about twice as slowly but especially for smaller blockchains it is no problem at all.

Please add your experience to this issue.

Error internalState: database is in inconsistent state and cannot be used

Blockbook was killed during the initial import, most commonly by OOM killer. By default, Blockbook performs the initial import in bulk import mode, which for performance reasons does not store all data immediately to the database. If Blockbook is killed during this phase, the database is left in an inconsistent state.

See above how to reduce the memory footprint, delete the database files and run the import again.

Check this or this issue for more info.

Running on Ubuntu

This issue discusses how to run Blockbook on Ubuntu. If you have some additional experience with Blockbook on Ubuntu, please add it to this issue.

My coin implementation is reporting parse errors when importing blockchain

Your coin's block/transaction data may not be compatible with BitcoinParser ParseBlock/ParseTx, which is used by default. In that case, implement your coin in a similar way we used in case of zcash and some other coins. The principle is not to parse the block/transaction data in Blockbook but instead to get parsed transactions as json from the backend.

Data storage in RocksDB

Blockbook stores data the key-value store RocksDB. Database format is described here.

API

Blockbook API is described here.

More Repositories

1

trezor-firmware

🔒 Trezor Firmware Monorepo
C
1,242
star
2

python-mnemonic

🐍 Mnemonic code for generating deterministic keys, BIP39
Python
762
star
3

trezor-suite

🍬 Trezor Suite Monorepo
TypeScript
619
star
4

trezor-crypto

🔒 Don't use this repo, use the new monorepo instead:
C
493
star
5

trezor-core

🔒 Don't use this repo, use the new monorepo instead:
Python
353
star
6

connect

🔗 A platform for easy integration of Trezor into 3rd party services
JavaScript
350
star
7

trezor-mcu

🔒 Don't use this repo, use the new monorepo instead:
C
318
star
8

cython-hidapi

🐍 Python wrapper for the HIDAPI
Cython
255
star
9

trezord-go

😈 Trezor Communication Daemon (written in Go)
C
226
star
10

python-trezor

🐍 Don't use this repo, use the new monorepo instead:
Python
203
star
11

trezor-hardware

🔧 Hardware design of Trezor
171
star
12

python-shamir-mnemonic

Python
155
star
13

trezor.js

⚠️ OBSOLETE. DO NOT USE! Use https://github.com/trezor/connect instead
JavaScript
95
star
14

trezor-common

🔒 Don't post issues/PRs to here, use the new monorepo:
Python
89
star
15

trezor-android

📱 TREZOR Communication Library for Android
Java
78
star
16

hd-wallet

💰 High-performance Bitcoin HD Wallet in Javascript
JavaScript
56
star
17

trezor-password-manager

Password Management via TREZOR
SCSS
42
star
18

data

📦 Data files for Trezor
HTML
39
star
19

trezor-wallet

⚠️ OBSOLETE. DO NOT USE! Use https://github.com/trezor/trezor-suite instead
JavaScript
29
star
20

trezor-user-env

Development tool for Trezor developers
Python
24
star
21

trezor-link

Javascript module for integrating TREZOR into Node.js and web applications.
TypeScript
18
star
22

connect-explorer

Connect Examples
JavaScript
12
star
23

trezor-suite-guide

User Guide present in Trezor Suite
11
star
24

rng-test

🎲 Random Number Generator (RNG) tests
C
10
star
25

community

👫 TREZOR Developer Community Discussion
9
star
26

trezor-storage

🔒 Don't use this repo, use the new monorepo instead:
C
9
star
27

trezor-ui-components

⚠️ OBSOLETE. DO NOT USE! Use https://github.com/trezor/trezor-suite instead
JavaScript
9
star
28

coinjoin-backend

Python
6
star
29

omni-trezor

OMNI Wallet for Trezor
JavaScript
6
star
30

ui

🍺 User Interface Mockups and Experiments
HTML
6
star
31

trezor-rollout

⚠️ OBSOLETE. DO NOT USE! Use https://github.com/trezor/trezor-suite instead
JavaScript
5
star
32

trezor-test-scenarios

Python
5
star
33

trezor-core-ui

HTML
5
star
34

trezor-onboarding

⚠️ OBSOLETE. DO NOT USE! Use https://github.com/trezor/trezor-suite instead
TypeScript
4
star
35

.github

4
star
36

trezor-flags

JavaScript
4
star
37

trezor-storage-test

🔒 Don't use this repo, use the new monorepo instead:
Python
4
star
38

trezor-translations-manager

⚠️ OBSOLETE. DO NOT USE! Use https://github.com/trezor/trezor-suite instead
JavaScript
3
star
39

trezor-blockchain-link

⚠️ OBSOLETE. DO NOT USE! Use https://github.com/trezor/trezor-suite instead
TypeScript
3
star
40

upysize

Tool for decreasing the size of compiled micropython code
Python
3
star
41

trezor-docker-images

Collection of docker images and configurations used across various trezor projects.
Dockerfile
2
star
42

binsize

Tool to analyze the size of a binary from .elf file
Python
2
star
43

definitions

Python
1
star