OSDN Git Service

new repo
[bytom/vapor.git] / vendor / github.com / btcsuite / btcd / docs / using_bootstrap_dat.md
1 ### Table of Contents
2 1. [What is bootstrap.dat?](#What)<br />
3 2. [What are the pros and cons of using bootstrap.dat?](#ProsCons)
4 3. [Where do I get bootstrap.dat?](#Obtaining)
5 4. [How do I know I can trust the bootstrap.dat I downloaded?](#Trust)
6 5. [How do I use bootstrap.dat with btcd?](#Importing)
7
8 <a name="What" />
9
10 ### 1. What is bootstrap.dat?
11
12 It is a flat, binary file containing bitcoin blockchain data starting from the
13 genesis block and continuing through a relatively recent block height depending
14 on the last time it was updated.
15
16 See [this](https://bitcointalk.org/index.php?topic=145386.0) thread on
17 bitcointalk for more details.
18
19 **NOTE:** Using bootstrap.dat is entirely optional.  Btcd will download the
20 block chain from other peers through the Bitcoin protocol with no extra
21 configuration needed.
22
23 <a name="ProsCons" />
24
25 ### 2. What are the pros and cons of using bootstrap.dat?
26
27 Pros:
28 - Typically accelerates the initial process of bringing up a new node as it
29   downloads from public P2P nodes and generally is able to achieve faster
30   download speeds
31 - It is particularly beneficial when bringing up multiple nodes as you only need
32   to download the data once
33
34 Cons:
35 - Requires you to setup and configure a torrent client if you don't already have
36   one available
37 - Requires roughly twice as much disk space since you'll need the flat file as
38   well as the imported database
39
40 <a name="Obtaining" />
41
42 ### 3. Where do I get bootstrap.dat?
43
44 The bootstrap.dat file is made available via a torrent.  See
45 [this](https://bitcointalk.org/index.php?topic=145386.0) thread on bitcointalk
46 for the torrent download details.
47
48 <a name="Trust" />
49
50 ### 4. How do I know I can trust the bootstrap.dat I downloaded?
51
52 You don't need to trust the file as the `addblock` utility verifies every block
53 using the same rules that are used when downloading the block chain normally
54 through the Bitcoin protocol.  Additionally, the chain rules contain hard-coded
55 checkpoints for the known-good block chain at periodic intervals.  This ensures
56 that not only is it a valid chain, but it is the same chain that everyone else
57 is using.
58
59 <a name="Importing" />
60
61 ### 5. How do I use bootstrap.dat with btcd?
62
63 btcd comes with a separate utility named `addblock` which can be used to import
64 `bootstrap.dat`.  This approach is used since the import is a one-time operation
65 and we prefer to keep the daemon itself as lightweight as possible.
66
67 1. Stop btcd if it is already running.  This is required since addblock needs to
68    access the database used by btcd and it will be locked if btcd is using it.
69 2. Note the path to the downloaded bootstrap.dat file.
70 3. Run the addblock utility with the `-i` argument pointing to the location of
71    boostrap.dat:<br /><br />
72 **Windows:**
73 ```bat
74 C:\> "%PROGRAMFILES%\Btcd Suite\Btcd\addblock" -i C:\Path\To\bootstrap.dat
75 ```
76 **Linux/Unix/BSD/POSIX:**
77 ```bash
78 $ $GOPATH/bin/addblock -i /path/to/bootstrap.dat
79 ```