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
Copy file name to clipboardexpand all lines: src/pages/understand-stacks/running-mainnet-node.md
+68-34
Original file line number
Diff line number
Diff line change
@@ -13,26 +13,27 @@ images:
13
13
14
14
## Introduction
15
15
16
-
This procedure demonstrates how to run a local mainnet node using Docker images.
16
+
This guide shows how to run a Stacks mainnet node using Docker images.
17
17
18
-
-> This procedure focuses on Unix-like operating systems (Linux and MacOS). This procedure has not been tested on
19
-
Windows.
18
+
It uses [Hiro's implementation](https://github.com/blockstack/stacks-blockchain) of a Stacks node, along with [Bitcoin Core](https://github.com/bitcoin/bitcoin).
19
+
20
+
-> This procedure focuses on Unix-like operating systems (Linux and MacOS). This procedure has not been tested on Windows.
20
21
21
22
## Prerequisites
22
23
23
-
Running a node has no specialized hardware requirements. Users have been successful in running nodes on Raspberry Pi
24
-
boards and other system-on-chip architectures. In order to complete this procedure, you must have the following software
25
-
installed on the node host machine:
24
+
Running a node has no specialized hardware requirements. Users have been successful in running nodes on Raspberry Pi boards and other system-on-chip architectures. In order to complete this procedure, you must have the following software installed on the node host machine:
26
25
27
26
-[Docker](https://docs.docker.com/get-docker/)
28
27
-[curl](https://curl.se/download.html)
29
28
-[jq](https://stedolan.github.io/jq/download/)
30
29
30
+
You can use `brew install docker curl jq` for MacOS and usually `sudo apt-get install docker curl jq` for Linux. But this might not work for every system.
31
+
32
+
You'll need at minimum 500GB for the Bitcoin Core node and somewhere around 20GB (as of block `704197`). This will grow in size, so a 1TB or more drive is usually recommended for future-proofing.
33
+
31
34
### Firewall configuration
32
35
33
-
In order for the API node services to work correctly, you must configure any network firewall rules to allow traffic on
34
-
the ports discussed in this section. The details of network and firewall configuration are highly specific to your
35
-
machine and network, so a detailed example isn't provided.
36
+
In order for the API node services to work correctly, you must configure any network firewall rules to allow traffic on the ports discussed in this section. The details of network and firewall configuration are specific to your setup and network, so we won't provide a detailed example.
36
37
37
38
The following ports must open on the host machine:
38
39
@@ -59,53 +60,82 @@ persistent data from the services. Download and configure the Docker images with
59
60
docker pull blockstack/stacks-blockchain
60
61
```
61
62
62
-
Create a directory structure for the service data with the following command:
63
+
Create some directories for the Stacks data with the following command:
Stacks finds its blocks by looking through the Bitcoin chain for anchor transactions that store the hashes of Stacks blocks. This is one of the things that makes Stacks so secure.
72
+
73
+
You'll need to be running an **unpruned** Bitcoin Core node for your Stacks node to sync from.
74
+
75
+
You'll want your Bitcoin node config to look something like this...
76
+
77
+
```toml
78
+
# remove if you like, this lets the node use more threads
79
+
par=512
80
+
server=1
81
+
txindex=1
82
+
# comment this back in after the initial block download if you want to use TOR.
83
+
# you'll need to add TOR and the config separately.
84
+
# there are guides for this elsewhere :)
85
+
# onlynet=onion
86
+
daemon=1
87
+
# hiro's implementation uses rpc v0
88
+
rpcserialversion=0
89
+
maxorphantx=1
90
+
banscore=1
91
+
bind=0.0.0.0:8333
92
+
rpcbind=0.0.0.0:8332
93
+
rpcport=8332
94
+
```
95
+
96
+
There are plenty of guides on how to run a Bitcoin Core node. Do a search and you'll find more indepth info.
97
+
98
+
If you're on Linux, Bitcoin Core will load the config from `~/.bitcoin/bitcoin.conf` by default.
99
+
100
+
On MacOS, it loads from `~/Library/Application Support/Bitcoin/bitcoin.conf`.
101
+
102
+
-> Wait 'til your Bitcoin Core node is fully synced to the rest of the chain before proceeding to connect your Stacks node to it
103
+
104
+
## Step 3: running the Stacks node
69
105
70
-
First, create the `./config/Config.toml` file and add the following content to the
71
-
file using a text editor:
106
+
After Bitcoin Core has synced, create the `./config/Config.toml` file and add the following content to the file using a text editor:
72
107
73
108
```toml
109
+
# stacks node config
74
110
[node]
75
-
working_dir = "/root/stacks-node/data"
111
+
# where the node stores stacks chain data
112
+
working_dir = "~/stacks-node/data"
76
113
rpc_bind = "0.0.0.0:20443"
77
114
p2p_bind = "0.0.0.0:20444"
115
+
# the nodes used to bootstrap your node
116
+
# these are hiro's nodes, but you can use any other nodes too
0 commit comments