From 52fb5b4c393ec8bc866eabeb27d4c46ab7dad90b Mon Sep 17 00:00:00 2001 From: LORDBABUINO Date: Mon, 11 May 2026 20:22:10 -0300 Subject: [PATCH] docs: use scripts/setup.sh in readme quickstart MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace the giant inline bootstrap-and-scan bash block with the setup.sh script that already does the same thing (and is maintained alongside the regtest harness). The reader sees four short steps — setup, start API, scan, CLI alternative — instead of 40 lines of shell to copy-paste correctly. --- README.md | 61 ++++++++----------------------------------------------- 1 file changed, 9 insertions(+), 52 deletions(-) diff --git a/README.md b/README.md index 42dd850..f91c581 100644 --- a/README.md +++ b/README.md @@ -174,76 +174,33 @@ Copy `bitcoin.conf.example` to `bitcoin.conf` and edit the credentials if needed cp bitcoin.conf.example bitcoin.conf ``` -### 3. Start Bitcoin Core - -Regtest example: +### 3. Set up regtest (starts node, creates wallet, mines blocks) ```bash -mkdir -p "$PWD/.bitcoin-regtest" -bitcoind -datadir="$PWD/.bitcoin-regtest" -conf="$PWD/bitcoin.conf" -daemon +./scripts/setup.sh ``` -Mainnet example: - -```bash -bitcoind -daemon -``` +Use `./scripts/setup.sh --fresh` to wipe the chain and start from genesis. ### 4. Start the API ```bash -STEALTH_RPC_URL=http://127.0.0.1:18443 \ -STEALTH_RPC_USER=localuser \ -STEALTH_RPC_PASS=localpass \ - cargo run --bin stealth-api +cargo run --bin stealth-api ``` `stealth-api` auto-detects common local RPC ports and can use credentials from `bitcoin.conf`, cookie file, or env vars. -### 5. Run a usable scan request +### 5. Scan (in another terminal) ```bash -DATADIR="$PWD/.bitcoin-regtest" -CONF="$PWD/bitcoin.conf" -RPC="bitcoin-cli -datadir=$DATADIR -conf=$CONF -regtest -rpcport=18443" -API_PORT=20899 - -mkdir -p "$DATADIR" -if ! $RPC getblockchaininfo >/dev/null 2>&1; then - bitcoind -datadir="$DATADIR" -conf="$CONF" -daemon -fi - -for _ in $(seq 1 100); do - if $RPC getblockchaininfo >/dev/null 2>&1; then - break - fi - sleep 0.2 -done - -STEALTH_RPC_URL=http://127.0.0.1:18443 \ -STEALTH_RPC_USER=localuser \ -STEALTH_RPC_PASS=localpass \ -STEALTH_API_BIND=127.0.0.1:$API_PORT \ - cargo run --bin stealth-api >/tmp/stealth-api.log 2>&1 & -API_PID=$! -trap 'kill $API_PID >/dev/null 2>&1 || true' EXIT - -WALLET="scanwallet_$(date +%s)" -$RPC createwallet "$WALLET" >/dev/null -TARGET_ADDR="$($RPC -rpcwallet="$WALLET" getnewaddress)" -$RPC generatetoaddress 101 "$TARGET_ADDR" >/dev/null - -DESC="$($RPC -rpcwallet="$WALLET" getaddressinfo "$TARGET_ADDR" | jq -r '.desc')" - -curl -s "http://127.0.0.1:$API_PORT/api/wallet/scan" -H 'content-type: application/json' -d "{\"descriptor\":\"$DESC\"}" | jq - -$RPC stop +curl -s 'http://localhost:20899/api/wallet/scan' \ + -H 'content-type: application/json' \ + -d '{"descriptor":""}' | jq ``` ### 6. Alternative: CLI scan ```bash -./scripts/setup.sh cargo run --bin stealth-cli -- scan \ --descriptor '' \ --rpc-url http://127.0.0.1:18443 \ @@ -251,7 +208,7 @@ cargo run --bin stealth-cli -- scan \ --format text ``` -### 5. Start frontend +### 7. Start frontend ```bash cd frontend