Import/Export
These are helpers that take a file of blocks generated by using linearlize or downloaded from the web. These files have the best version of the blockchain (no forks) serialized block after block.
Import
To import, update the configuration section related to import:
# Import
blockFiles {
path=""
start = 0
checkpoints=[]
}
path
points to a directory where the file or files are located. They must be named bootstrap-XYZ.dat
where XYZ is
a number that you put in the list of checkpoints. The import will process all of them in sequence. start
is the
height of the first block in the file.
Then you run with org.bitcoinakka.BlockchainFileRead
as the main class.
Export
To export, update the configuration section related to export:
# Export
saveBlocks {
file = ""
startHeight = 0
endHash = "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f"
}
It creates a single output file with blocks from the chain start after the given startHeight
and ends at the block that
has the given hash
. The block of given height is not included. Exporting is the equivalent of lineralize.
In the next milestone, we will check the validity of the data we receive and reject incorrect blocks and transactions.