Skip to content

Database Settings

Eric Voskuil edited this page Mar 22, 2017 · 16 revisions

The following database settings are implemented in the libbitcoin-database and exposed in both Bitcoin Node (BN) and Bitcoin Server (BS).

[database]
# The blockchain database directory, defaults to 'blockchain'.
directory = blockchain
# Flush each write to disk, defaults to true.
flush_writes = true
# Full database files increase by this percentage, defaults to 50.
file_growth_rate = 50
# Block hash table size, defaults to 650000.
block_table_buckets = 650000
# Transaction hash table size, defaults to 110000000.
transaction_table_buckets = 110000000
# Spend hash table size, defaults to 250000000.
spend_table_buckets = 250000000
# History hash table size, defaults to 107000000.
history_table_buckets = 107000000
# The maximum number of entries in the unspent outputs cache, defaults to 0.
cache_capacity = 0

directory

This should be an SSD. There must be sufficient space to hold the database, including operating expansion. The node files are block_index, block_table and transaction_table. The additional server index files are history_rows, history_table, spend_table, and stealth_rows. The (zero byte) lock files are flush_lock and exclusive_lock.

flush_writes

This defaults to true for server and false for node. The store signals the start of a transactional commit using an empty file named flush_lock. The file is cleared when the write is flushed to disk. Therefore if the process is running the presence of the file indicates an unflushed write. If the node detects the file at startup it assumes that the preceding write was not flushed and fails to start the blockchain. In this case the blockchain must be deleted and a new one initialized before starting the node. Deleting the flush_lock file and starting with a corrupt store will produce undefined behavior (including seemingly proper operation for some arbitrary period of time). See also withstanding hard shutdowns. Enabling this setting significantly slows initial block download and transaction processing.

file_growth_rate

Full database files increase by this percentage, defaults to 50.

block_table_buckets

Block hash table size, defaults to 650000.

transaction_table_buckets

Transaction hash table size, defaults to 110000000.

spend_table_buckets

Spend hash table size, defaults to 250000000.

history_table_buckets

History hash table size, defaults to 107000000.

cache_capacity

The maximum number of entries in the unspent outputs cache, defaults to 0.

Clone this wiki locally