2014-08-24 03:46:12 +02:00
|
|
|
# Linearize
|
2016-12-21 04:27:01 +01:00
|
|
|
Construct a linear, no-fork, best version of the Bitcoin blockchain. The scripts
|
|
|
|
run using Python 3 but are compatible with Python 2.
|
2014-08-24 03:46:12 +02:00
|
|
|
|
|
|
|
## Step 1: Download hash list
|
|
|
|
|
2015-07-10 18:21:21 +02:00
|
|
|
$ ./linearize-hashes.py linearize.cfg > hashlist.txt
|
2014-08-24 03:46:12 +02:00
|
|
|
|
|
|
|
Required configuration file settings for linearize-hashes:
|
2017-03-28 06:05:25 +02:00
|
|
|
* RPC: `datadir` (Required if `rpcuser` and `rpcpassword` are not specified)
|
|
|
|
* RPC: `rpcuser`, `rpcpassword` (Required if `datadir` is not specified)
|
2014-08-24 03:46:12 +02:00
|
|
|
|
|
|
|
Optional config file setting for linearize-hashes:
|
2016-12-21 04:27:01 +01:00
|
|
|
* RPC: `host` (Default: `127.0.0.1`)
|
|
|
|
* RPC: `port` (Default: `8332`)
|
2016-12-21 04:25:24 +01:00
|
|
|
* Blockchain: `min_height`, `max_height`
|
|
|
|
* `rev_hash_bytes`: If true, the written block hash list will be
|
|
|
|
byte-reversed. (In other words, the hash returned by getblockhash will have its
|
|
|
|
bytes reversed.) False by default. Intended for generation of
|
|
|
|
standalone hash lists but safe to use with linearize-data.py, which will output
|
|
|
|
the same data no matter which byte format is chosen.
|
2014-08-24 03:46:12 +02:00
|
|
|
|
2016-12-21 04:27:01 +01:00
|
|
|
The `linearize-hashes` script requires a connection, local or remote, to a
|
|
|
|
JSON-RPC server. Running `bitcoind` or `bitcoin-qt -server` will be sufficient.
|
|
|
|
|
2014-08-24 03:46:12 +02:00
|
|
|
## Step 2: Copy local block data
|
|
|
|
|
2015-07-10 18:21:21 +02:00
|
|
|
$ ./linearize-data.py linearize.cfg
|
2014-08-24 03:46:12 +02:00
|
|
|
|
|
|
|
Required configuration file settings:
|
2016-12-21 04:25:24 +01:00
|
|
|
* `output_file`: The file that will contain the final blockchain.
|
2014-08-24 03:46:12 +02:00
|
|
|
or
|
2016-12-21 04:27:01 +01:00
|
|
|
* `output`: Output directory for linearized `blocks/blkNNNNN.dat` output.
|
2014-08-24 03:46:12 +02:00
|
|
|
|
|
|
|
Optional config file setting for linearize-data:
|
2017-01-19 07:22:46 +01:00
|
|
|
* `debug_output`: Some printouts may not always be desired. If true, such output
|
|
|
|
will be printed.
|
|
|
|
* `file_timestamp`: Set each file's last-accessed and last-modified times,
|
|
|
|
respectively, to the current time and to the timestamp of the most recent block
|
|
|
|
written to the script's blockchain.
|
2016-12-21 04:25:24 +01:00
|
|
|
* `genesis`: The hash of the genesis block in the blockchain.
|
2016-12-21 04:27:01 +01:00
|
|
|
* `input`: bitcoind blocks/ directory containing blkNNNNN.dat
|
2016-12-21 04:25:24 +01:00
|
|
|
* `hashlist`: text file containing list of block hashes created by
|
|
|
|
linearize-hashes.py.
|
|
|
|
* `max_out_sz`: Maximum size for files created by the `output_file` option.
|
|
|
|
(Default: `1000*1000*1000 bytes`)
|
|
|
|
* `netmagic`: Network magic number.
|
2017-01-19 07:22:46 +01:00
|
|
|
* `out_of_order_cache_sz`: If out-of-order blocks are being read, the block can
|
|
|
|
be written to a cache so that the blockchain doesn't have to be seeked again.
|
|
|
|
This option specifies the cache size. (Default: `100*1000*1000 bytes`)
|
2016-12-21 04:25:24 +01:00
|
|
|
* `rev_hash_bytes`: If true, the block hash list written by linearize-hashes.py
|
|
|
|
will be byte-reversed when read by linearize-data.py. See the linearize-hashes
|
|
|
|
entry for more information.
|
|
|
|
* `split_timestamp`: Split blockchain files when a new month is first seen, in
|
|
|
|
addition to reaching a maximum file size (`max_out_sz`).
|