Skip to content

How to Initialize

Eric Voskuil edited this page Mar 14, 2017 · 19 revisions

Execute the following command initialize the blockchain directory structure.

$ bs --initchain

The chain initializes with a genesis block for the chain indicated by the network.identifier configuration setting, but is currently limited to Bitcoin mainnet and Bitcoin testnet.

The following files will be created in the blockchain directory.

  • block_index
  • block_table
  • history_rows
  • history_table
  • spend_table
  • stealth_rows
  • transaction_table

The file exclusive_lock will appear in the directory after server startup. When a node or server starts it gains cooperative exclusive access to the database by using this file as a inter-process mutex. The presence of this file does not indicate an active lock or a failure. The file may be deleted when the database is closed, without consequence.

The file flush_lock will appear in the directory when database writes have not been flushed to disk. Locking granularity can be controlled via the database.flush_writes configuration setting. If this file is left behind at process stop it indicates store corruption and the store must be deleted and resynchronized. Do not delete the flush lock and restart the process with a corrupted store as behavior is undefined.

Use the database.directory setting to specify the blockchain location.

The --initchain command will fail if the blockchain directory already exists.

To replace the blockchain either delete the directory or move the configured location.

Clone this wiki locally