Skip to content

Commit 10bcb4d

Browse files
committed
Setup specific instructions
1 parent 778c61a commit 10bcb4d

File tree

1 file changed

+175
-0
lines changed

1 file changed

+175
-0
lines changed

docs/setup.md

+175
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
# Workshop Instruction Manual
2+
3+
These instructions cover the setup required for the instructor running the Stratum V2 workshop.
4+
5+
## Overview
6+
The workshop setup includes:
7+
1. A Genesis node that is publicly accessible for participants to sync their Bitcoin node with.
8+
2. A Signet block explorer to display participants' mined blocks.
9+
3. A containerized environment for participants with `bitcoin-core` fork with Sv2 support, `cpuminer`, and the `stratum` repo with the `workshop` branch checked out and pre-built `stratum/roles` debug binaries.
10+
11+
## Prerequisites
12+
1. Install Rust:
13+
14+
```sh
15+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
16+
```
17+
2. Install [Docker](https://docs.docker.com/engine/install/).
18+
3. Configure Docker with the following minimum resource allocations:
19+
* CPU: 10 cores
20+
* Memory: 8GB
21+
* Swap: 1GB
22+
* Disk: 64GB
23+
24+
## Software Compatibility
25+
* `bitcoin-core`:
26+
* Source: [Sjors's `sv2-tp-0.1.3` tag](https://github.com/Sjors/bitcoin/tree/sv2-tp-0.1.3).
27+
* Release Binary: [Plebhash's fork of Sjors's sv2-tp-0.1.3 tag](https://github.com/plebhash/bitcoin/releases/tag/btc-prague).
28+
* `cpuminer` `v2.5.1`: [GitHub release](https://github.com/pooler/cpuminer/releases/tag/v2.5.1).
29+
* `stratum` - `workshop` branch: [GitHub repo](https://github.com/stratum-mining/stratum/tree/workshop).
30+
31+
## Setup
32+
33+
### `bitcoin-core`
34+
#### Purpose
35+
A Bitcoin node is needed for:
36+
1. Syncing participants' Bitcoin nodes with a Genesis node.
37+
2. Running a block explorer to view mined blocks.
38+
39+
#### Installation
40+
There are two ways to install the required `bitcoin-core` fork:
41+
42+
1. Download and extract the binary from [Plebhash's fork](https://github.com/plebhash/bitcoin/releases/tag/btc-prague).
43+
2. Clone and build from Sjors's source:
44+
45+
```sh
46+
git clone https://github.com/Sjors/bitcoin.git
47+
cd bitcoin
48+
git fetch --all
49+
git checkout sv2-tp-0.1.3
50+
./autogen.sh
51+
./configure --disable-tests --disable-bench --enable-wallet --with-gui=no
52+
make # or `make -j <num cores>`
53+
```
54+
55+
> Note: For mac users, it is highly recommended to build from source.
56+
57+
#### Configuration
58+
59+
##### Genesis Node
60+
A Genesis node that is publicly accessible is needed for participants to sync their Bitcoin nodes. This can be set up by the instructor or use the existing SRI VM node.
61+
62+
Verify the node is running:
63+
64+
```sh
65+
ps -ef | grep -i bitcoind
66+
> sri 3935787 1 0 Jun29 ? 01:19:13 /home/sri/btc_prague_workshop/bitcoin/src/bitcoind -signet -datadir=/home/sri/btc_prague_workshop/bitcoin_data_dir/ -fallbackfee=0.01 -daemon -sv2 -sv2port=38442
67+
```
68+
69+
Ensure the `bitcoin.conf` in the `datadir` contains:
70+
71+
```conf
72+
[signet]
73+
signetchallenge=51 # OP_TRUE
74+
prune=0
75+
txindex=1
76+
server=1
77+
rpcallowip=0.0.0.0/0
78+
rpcbind=0.0.0.0
79+
rpcuser=mempool
80+
rpcpassword=mempool
81+
rpcport=38332
82+
```
83+
84+
##### Block Explorer Node
85+
A `signet` block explorer is needed to display participants' mined blocks.
86+
87+
88+
Ensure the `bitcoin.conf` in the `datadir` contains:
89+
90+
```
91+
[signet]
92+
signetchallenge=51 # OP_TRUE
93+
prune=0
94+
txindex=1
95+
server=1
96+
connect=75.119.150.111 # Genesis Node
97+
rpcallowip=0.0.0.0/0
98+
rpcbind=0.0.0.0
99+
rpcuser=mempool
100+
rpcpassword=mempool
101+
```
102+
103+
Run the Bitcoin node:
104+
105+
```sh
106+
bitcoind -datadir=$HOME/.bitcoin-sv2-workshop -signet -sv2
107+
```
108+
109+
## `electrs`
110+
### Installation
111+
Clone and configure:
112+
113+
```sh
114+
git clone https://github.com/romanz/electrs
115+
cd electrs
116+
git checkout v0.10.5
117+
cat << EOF > electrs.toml
118+
network="signet"
119+
auth="mempool:mempool"
120+
EOF
121+
```
122+
123+
### Running `electrs`
124+
Run the server:
125+
126+
```sh
127+
cargo run -- --signet-magic=54d26fbd
128+
```
129+
130+
## `mempool.space`
131+
### Installation
132+
Clone the repository:
133+
134+
```sh
135+
git clone https://github.com/mempool/mempool
136+
cd mempool
137+
git checkout v2.5.0
138+
```
139+
140+
### Configuration
141+
Update `mempool/docker/docker-compose.yaml`:
142+
143+
```yaml
144+
api:
145+
environment:
146+
MEMPOOL_BACKEND: "electrum"
147+
ELECTRUM_HOST: "host.docker.internal"
148+
ELECTRUM_PORT: "60601"
149+
ELECTRUM_TLS_ENABLED: "false"
150+
CORE_RPC_HOST: "host.docker.internal"
151+
CORE_RPC_PORT: "38332"
152+
CORE_RPC_USERNAME: "mempool"
153+
CORE_RPC_PASSWORD: "mempool"
154+
DATABASE_ENABLED: "true"
155+
```
156+
157+
## Participant Docker Image
158+
The Docker image contains:
159+
* `bitcoin-core` fork with Sv2 support
160+
* `cpuminer`
161+
* `stratum` repo with the `workshop` branch and pre-built `stratum/roles` debug binaries
162+
163+
Build the Docker image:
164+
165+
```sh
166+
cd sv2-workshop
167+
cp materials/setup_tmux.sh /usr/local/bin/setup_tmux.sh
168+
docker build -t sv2-workshop:latest .
169+
```
170+
171+
Participants connect to the Docker image:
172+
173+
```sh
174+
docker run -it --rm sv2-workshop:latest
175+
```

0 commit comments

Comments
 (0)