stratum-mining / sv2-workshop

StratumV2 Reference Implementation Workshop
Creative Commons Zero v1.0 Universal
2 stars 6 forks source link

Need more clarity on setting up the workshop #5

Open rrybarczyk opened 3 months ago

rrybarczyk commented 3 months ago

Background

The README.md currently shows how to setup the block explorer aspect of the workshop (electrs and mempool.space). However there is a bit more to the setup than just these things.

Problem

The README.md does not clearly note that the Blockchain Explorer contents are for workshop setup and does not include useful details like:

I also ran into an issue with the mempool.space docker-compose.yml CORE_RPC_HOST variable.

Solution

Create docs/setup.md to host a complete instruction set to setup the workshop.

rrybarczyk commented 3 months ago

This signet-genesis-node.sh was found in the ~/sv2-workshop on the SRI VM. Would be good to commit this:

#!/bin/bash

# Check if the environment variables are set
if [ -z "$BITCOIND" ] || [ -z "$BITCOIN_CLI" ] || [ -z "$BITCOIN_UTIL" ] || [ -z "$BITCOIN_DATA_DIR" ] || [ -z "$MINER" ]; then
  echo "Please make sure all environment variables (BITCOIND, BITCOIN_CLI, BITCOIN_UTIL, BITCOIN_DATA_DIR, MINER) are properly set. Exiting."
  exit 1
fi

# Check if the specific port is in use
if lsof -i :38332 | grep -q LISTEN; then
  echo "Port 38332 is already being used, which means there's probably a bitcoind already running in signet mode. Exiting."
  exit 1
fi

echo "This script is about to erase some contents of the provided BITCOIN_DATA_DIR. Do you want to continue? (yes/no)"
read -r user_input

if [ "$user_input" != "yes" ]; then
  echo "User did not consent. Exiting."
  exit 1
fi

rm -rf $BITCOIN_DATA_DIR/signet
rm -rf $BITCOIN_DATA_DIR/bitcoin.conf

cat << EOF > $BITCOIN_DATA_DIR/bitcoin.conf
[signet]
prune=0
txindex=1
server=1
rpcallowip=0.0.0.0/0
rpcbind=0.0.0.0
rpcuser=mempool
rpcpassword=mempool
# OP_TRUE
signetchallenge=51
EOF

echo "starting bitcoind in daemon mode..."
$BITCOIND -signet -datadir=$BITCOIN_DATA_DIR -fallbackfee=0.01 -daemon -sv2 -sv2port=38442

sleep 1

echo "creating a genesis wallet"
$BITCOIN_CLI -signet -datadir=$BITCOIN_DATA_DIR createwallet genesis

echo "mining some initial blocks"
for ((i=1; i<=16; i++))
do
  $MINER --cli="$BITCOIN_CLI -signet -datadir=$BITCOIN_DATA_DIR" generate --grind-cmd="$BITCOIN_UTIL grind" --address="tb1qmrv47upgrdd0f8rw62rwdtpd8r6qrn8kh7tj5f" --nbits=1d00ffff
done

echo "script finalized... running getblockchaininfo as the last step"
$BITCOIN_CLI -signet -datadir=$BITCOIN_DATA_DIR getblockchaininfo
rrybarczyk commented 3 months ago

To get the slides up and accessible at http://75.119.150.111:8888/html/sv2-workshop.html:

rrybarczyk commented 1 month ago

In the mempool.space README.md instructions, change:

docker-compose up

to

cd docker/
docker-compose up