You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*[Verify the UTXO Set State](#verify-the-utxo-set-state)
9
9
10
10
<!-- /clap-markdown-toc -->
11
11
12
-
This page only describes a subnet of features supported in subcoin with details, check out`subcoin --help` for the full usage.
12
+
This page covers some specific features supported in Subcoin. For full usage details, refer to`subcoin --help`.
13
13
14
-
## Import bitcoin blocks from `bitcoind`database
14
+
## Import Bitcoin Blocks from `bitcoind`Database
15
15
16
-
### Run `bitcoind`
16
+
### Get the `bitcoind` Binary
17
17
18
-
Firstly, we need to install the `bitcoind` binary which can be downloaded directly from [https://bitcoincore.org/en/download](https://bitcoincore.org/en/download/).
19
-
And then we need to spin up a `bitcoind` node with `txindex` and `coinstatsindex` enabled. `txindex` is required to import the blocks in subcoin, `coinstatsindex` is required
20
-
to query the UTXO set of specific block later.
18
+
To have flexible control over `bitcoind` behavior, it’s recommended to compile the `bitcoind` binary from source rather than downloading it directly from [Bitcoin releases](https://github.com/bitcoin/bitcoin/releases) which do not conveniently expose developer-oriented options. You can find the build instructions for your operating system under `build-*.md` in the [Bitcoin repository](https://github.com/bitcoin/bitcoin/tree/master/doc). For Linux, refer to [build-unix.md](https://github.com/bitcoin/bitcoin/blob/master/doc/build-unix.md).
21
19
22
-
For instance, we use `/tmp/btc-data` as the data dir:
20
+
```bash
21
+
# Ensure these two commands exist after successfully compiling the Bitcoin Core source code.
22
+
./src/bitcoind --help
23
+
./src/bitcoin-cli --help
24
+
```
23
25
24
-
<!-- TODO: specify the exact version of bitcoind we are using here. -->
26
+
Next, start a `bitcoind` node with `txindex` and `coinstatsindex` enabled. `txindex` is necessary for importing blocks into Subcoin, and `coinstatsindex` is required to query and verify the UTXO set of a specific block later. For example, use `/tmp/btc-data` as the data directory:
Keep the `bitcoind` process running for a while and ensure it has synced a number of blocks.
32
+
Keep the `bitcoind` process running for a while to ensure it has synchronized a number of blocks. Note that `bitcoind` will first synchronize the block headers and only start downloading blocks after the headers are synced. This step might take some time depending on the peer connections (10+ minutes on my machine).
# Specify `subcoin-data` as the data directory for Subcoin and import the blocks from `/tmp/btc-data` which is the `bitcoind` database we set up earlier.
48
+
# `--state-pruning archive` is necessary for querying the state of the Subcoin UTXO set later.
By default, Subcoin will import all blocks up to the latest indexed Bitcoin block in the `bitcoind` database. You can specify the total number of blocks to import or the target number of blocks to import:
68
+
69
+
```bash
70
+
# Import 20000 blocks from the best block of Subcoin.
`bitcoind` offers an interface to inspect the state of UTXO set, we can use it to check the the correctness of subcoin's the UTXO set after the blocks
82
-
imported to the subcoin node successfully. For instance, export the UTXO set information at height 10000:
89
+
`bitcoind` provides an interface to inspect the UTXO set state. This can be used to check the correctness of Subcoin’s UTXO set after importing blocks. For example, to export the UTXO set of `bitcoind` at height 10000:
83
90
84
91
```bash
92
+
# Note that running this command requires the bitcoind process running in the background.
93
+
# If it was stopped, now restart it. You can stop it again after this command finishes.
0 commit comments