From 9321951fa83f754d036629874de9db099c18e28d Mon Sep 17 00:00:00 2001 From: jvsena42 Date: Tue, 24 Nov 2026 09:44:23 -0300 Subject: [PATCH 1/9] docs: add spark-regtest skill Co-Authored-By: Claude Opus 5.5 --- .agents/skills/spark-regtest/SKILL.md | 63 +++++++++++++++++++++++++++ .claude/skills | 1 + AGENTS.md | 2 + 3 files changed, 66 insertions(+) create mode 100644 .agents/skills/spark-regtest/SKILL.md create mode 120000 .claude/skills diff --git a/.agents/skills/spark-regtest/SKILL.md b/.agents/skills/spark-regtest/SKILL.md new file mode 100644 index 0000000000..2b5ab6ecdd --- /dev/null +++ b/.agents/skills/spark-regtest/SKILL.md @@ -0,0 +1,63 @@ +--- +name: spark-regtest +description: > + This skill should be used when running a Bitkit iOS dev build on Spark's regtest: building it for + Spark, funding Savings or the Spark (Spending) balance, paying between dev builds, Move to Spark, + or Spark emergency exit tests. Triggers: "spark regtest", "local spark", "fund spark", + "spark faucet", "spark deposit address", "Transfer Unavailable", "SPARK_LOCAL_CONFIG_B64", + "./spark", "Lightspark regtest". +--- + +# Spark regtest + +Dev builds run Spark through the Breez SDK. Two Spark regtest networks exist, and neither shares a chain with Blocktank's +staging regtest (`stag0.blocktank.to`). Coins and Lightning payments never cross between them. + +| | Lightspark hosted (default) | Local `./spark` (bitkit-docker) | +| --- | --- | --- | +| Use for | Quick checks, physical phones, two-device Spark payments | Lightning to or from a node you control, Move to Spark with a channel, emergency exits, offline E2E | +| Lightning | Only through Lightspark's provider; no node you control | Alice, a Lightning node with a channel to the provider | +| Chain | Lightspark's own | bitkit-docker's local regtest (`spark-bitcoind` peers with `bitcoind`) | +| Funding | Faucet | `./spark pay`, `./spark send` | +| Docs | bitkit-android `scripts/spark-regtest-fund.py` (header) | `bitkit-docker/docs/spark-regtest.md` | + +Sibling checkouts are assumed next to this repo (`../bitkit-android`, `../bitkit-docker`, `../bitkit-e2e-tests`). Read +the named docs and script headers for details. The steps below are what is not obvious from them. + +## Lightspark hosted regtest + +1. A Debug regtest build connects with no key. +2. iOS has no `ESPLORA_URL` setting like Android's, so Savings stays on Blocktank's staging chain and Transfer to + Spending shows the Transfer Unavailable sheet. Fund Spark's deposit address directly. It is on Settings › Advanced › + Lightning Connections › Spark. +3. Fund: + - Web faucet: https://app.lightspark.com/regtest-faucet, up to 50,000 sats per deposit. The user submits it in a + browser. + - Script: `SPARK_REGTEST_MNEMONIC=… uv run ../bitkit-android/scripts/spark-regtest-fund.py [sats]`. + The mnemonic is a GitHub secret; ask the user, never print it. +4. Lightspark mines about once a minute. Spark claims a deposit after 3 confirmations. + +## Local `./spark` stack + +Run `./spark up` from a bitkit-docker checkout on `main`. The app reads `SPARK_LOCAL_CONFIG_B64` and +`SPARK_LOCAL_CHAIN_URL` only in a Debug regtest build that runs as E2E (`E2E_BUILD`, or launch env `E2E=true`) with +`E2E_BACKEND=local` (`Env.localSparkSettings`). Otherwise it silently stays on the hosted regtest. bitkit-e2e-tests' +build script sets all of that: + +```bash +../bitkit-docker/spark up +cd ../bitkit-e2e-tests +SPARK_LOCAL_CONFIG_B64="$(../bitkit-docker/spark config --base64)" \ +SPARK_LOCAL_CHAIN_URL=http://127.0.0.1:23090/api BACKEND=local ./scripts/build-ios-sim.sh +``` + +- The two settings are `Info.plist` build settings, baked in at build time. `SIMCTL_CHILD_` launch variables don't set + them, despite what `docs/spark-regtest.md` says. +- The simulator shares the Mac's loopback, so the `127.0.0.1` URLs work as they are. Savings uses bitkit-docker's + Electrum, the same chain, so Transfer to Spending and Savings-paid exit fees work (`Env.sharesLocalSparkChain`). +- A deposit is claimed after 1 block here. +- Mine with `./spark mine`, not `./bitcoin-cli mine`: only `spark-bitcoind` relays Spark's v3 packages. +- bitkit-e2e-tests' `README.md` (Spark tests on local regtest) runs the same stack from its pinned + `BITKIT_DOCKER_REVISION`, not your checkout. + +Regtest needs no `BREEZ_API_KEY`. For mainnet builds see `README.md`. diff --git a/.claude/skills b/.claude/skills new file mode 120000 index 0000000000..2b7a412b8f --- /dev/null +++ b/.claude/skills @@ -0,0 +1 @@ +../.agents/skills \ No newline at end of file diff --git a/AGENTS.md b/AGENTS.md index 5c9bdb5b1b..b12a67b833 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -9,6 +9,8 @@ This file is symlinked for cross-agents compatibility to the following paths: Durable shared agent command specs live in `.agents/commands/`. For PR creation, follow `.agents/commands/pr.md`; `.claude/commands` is a compatibility symlink and Cursor command entries under `.cursor/commands/` resolve to the same files. +Agent skills live in `.agents/skills/`, with `.claude/skills` as a compatibility symlink. For running a dev build on Spark's regtest, follow `.agents/skills/spark-regtest/SKILL.md`. + ## Agent workflow ### Verification From f020d7b5693c0325c640784f32c252edfae008ca Mon Sep 17 00:00:00 2001 From: jvsena42 Date: Tue, 24 Nov 2026 11:45:57 -0300 Subject: [PATCH 2/9] docs: add two-device payment step to hosted spark regtest Co-Authored-By: Claude Opus 5.5 --- .agents/skills/spark-regtest/SKILL.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.agents/skills/spark-regtest/SKILL.md b/.agents/skills/spark-regtest/SKILL.md index 2b5ab6ecdd..966559ccbe 100644 --- a/.agents/skills/spark-regtest/SKILL.md +++ b/.agents/skills/spark-regtest/SKILL.md @@ -36,6 +36,8 @@ the named docs and script headers for details. The steps below are what is not o - Script: `SPARK_REGTEST_MNEMONIC=… uv run ../bitkit-android/scripts/spark-regtest-fund.py [sats]`. The mnemonic is a GitHub secret; ask the user, never print it. 4. Lightspark mines about once a minute. Spark claims a deposit after 3 confirmations. +5. Two-device payment: fund the payer's Spark balance, copy the invoice from Receive › Spending on the other dev build, + and pay it from the payer. It goes over Lightning through Lightspark's provider. ## Local `./spark` stack From c0dbb033454f7195f6ed6ed1db21a98af9b5d982 Mon Sep 17 00:00:00 2001 From: jvsena42 Date: Tue, 24 Nov 2026 11:45:57 -0300 Subject: [PATCH 3/9] docs: build this checkout in local spark recipe Co-Authored-By: Claude Opus 5.5 --- .agents/skills/spark-regtest/SKILL.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.agents/skills/spark-regtest/SKILL.md b/.agents/skills/spark-regtest/SKILL.md index 966559ccbe..a6b83b279c 100644 --- a/.agents/skills/spark-regtest/SKILL.md +++ b/.agents/skills/spark-regtest/SKILL.md @@ -48,8 +48,8 @@ build script sets all of that: ```bash ../bitkit-docker/spark up -cd ../bitkit-e2e-tests -SPARK_LOCAL_CONFIG_B64="$(../bitkit-docker/spark config --base64)" \ +IOS_ROOT="$PWD"; cd ../bitkit-e2e-tests +IOS_ROOT="$IOS_ROOT" SPARK_LOCAL_CONFIG_B64="$(../bitkit-docker/spark config --base64)" \ SPARK_LOCAL_CHAIN_URL=http://127.0.0.1:23090/api BACKEND=local ./scripts/build-ios-sim.sh ``` @@ -57,6 +57,7 @@ SPARK_LOCAL_CHAIN_URL=http://127.0.0.1:23090/api BACKEND=local ./scripts/build-i them, despite what `docs/spark-regtest.md` says. - The simulator shares the Mac's loopback, so the `127.0.0.1` URLs work as they are. Savings uses bitkit-docker's Electrum, the same chain, so Transfer to Spending and Savings-paid exit fees work (`Env.sharesLocalSparkChain`). +- `IOS_ROOT` keeps the script on this checkout; it defaults to `../bitkit-ios`, which in a worktree is another commit. - A deposit is claimed after 1 block here. - Mine with `./spark mine`, not `./bitcoin-cli mine`: only `spark-bitcoind` relays Spark's v3 packages. - bitkit-e2e-tests' `README.md` (Spark tests on local regtest) runs the same stack from its pinned From 17055eb7ff06a0c787d7bef2e6572dc8bf2861e4 Mon Sep 17 00:00:00 2001 From: jvsena42 Date: Tue, 24 Nov 2026 11:45:57 -0300 Subject: [PATCH 4/9] docs: reset saved electrum server for local spark stack Co-Authored-By: Claude Opus 5.5 --- .agents/skills/spark-regtest/SKILL.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.agents/skills/spark-regtest/SKILL.md b/.agents/skills/spark-regtest/SKILL.md index a6b83b279c..bff11f45fd 100644 --- a/.agents/skills/spark-regtest/SKILL.md +++ b/.agents/skills/spark-regtest/SKILL.md @@ -58,6 +58,8 @@ SPARK_LOCAL_CHAIN_URL=http://127.0.0.1:23090/api BACKEND=local ./scripts/build-i - The simulator shares the Mac's loopback, so the `127.0.0.1` URLs work as they are. Savings uses bitkit-docker's Electrum, the same chain, so Transfer to Spending and Savings-paid exit fees work (`Env.sharesLocalSparkChain`). - `IOS_ROOT` keeps the script on this checkout; it defaults to `../bitkit-ios`, which in a worktree is another commit. +- A simulator that already chose an Electrum server keeps it, and Savings then misses the fixture chain. Use a fresh + simulator, or Settings › Advanced › Electrum Server › Reset To Default. - A deposit is claimed after 1 block here. - Mine with `./spark mine`, not `./bitcoin-cli mine`: only `spark-bitcoind` relays Spark's v3 packages. - bitkit-e2e-tests' `README.md` (Spark tests on local regtest) runs the same stack from its pinned From 2270f87150c7a654b23c254f6c3052703090c966 Mon Sep 17 00:00:00 2001 From: jvsena42 Date: Tue, 24 Nov 2026 11:45:57 -0300 Subject: [PATCH 5/9] docs: name the argument each spark funding command takes Co-Authored-By: Claude Opus 5.5 --- .agents/skills/spark-regtest/SKILL.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.agents/skills/spark-regtest/SKILL.md b/.agents/skills/spark-regtest/SKILL.md index bff11f45fd..bc25c16c27 100644 --- a/.agents/skills/spark-regtest/SKILL.md +++ b/.agents/skills/spark-regtest/SKILL.md @@ -60,6 +60,7 @@ SPARK_LOCAL_CHAIN_URL=http://127.0.0.1:23090/api BACKEND=local ./scripts/build-i - `IOS_ROOT` keeps the script on this checkout; it defaults to `../bitkit-ios`, which in a worktree is another commit. - A simulator that already chose an Electrum server keeps it, and Savings then misses the fixture chain. Use a fresh simulator, or Settings › Advanced › Electrum Server › Reset To Default. +- Fund Spark with `./spark send ` or `./spark pay [sats]`. - A deposit is claimed after 1 block here. - Mine with `./spark mine`, not `./bitcoin-cli mine`: only `spark-bitcoind` relays Spark's v3 packages. - bitkit-e2e-tests' `README.md` (Spark tests on local regtest) runs the same stack from its pinned From e2d7e1d0d3d00bd4ef18a8ff6d1bfdadd45c3c51 Mon Sep 17 00:00:00 2001 From: jvsena42 Date: Tue, 24 Nov 2026 11:49:29 -0300 Subject: [PATCH 6/9] docs: clarify worktree paths and install in local spark recipe Co-Authored-By: Claude Opus 5.5 --- .agents/skills/spark-regtest/SKILL.md | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.agents/skills/spark-regtest/SKILL.md b/.agents/skills/spark-regtest/SKILL.md index bc25c16c27..b8dc799f73 100644 --- a/.agents/skills/spark-regtest/SKILL.md +++ b/.agents/skills/spark-regtest/SKILL.md @@ -21,8 +21,9 @@ staging regtest (`stag0.blocktank.to`). Coins and Lightning payments never cross | Funding | Faucet | `./spark pay`, `./spark send` | | Docs | bitkit-android `scripts/spark-regtest-fund.py` (header) | `bitkit-docker/docs/spark-regtest.md` | -Sibling checkouts are assumed next to this repo (`../bitkit-android`, `../bitkit-docker`, `../bitkit-e2e-tests`). Read -the named docs and script headers for details. The steps below are what is not obvious from them. +Sibling checkouts are assumed next to this repo (`../bitkit-android`, `../bitkit-docker`, `../bitkit-e2e-tests`); from a +worktree, use the main checkout's siblings. Run `./spark` commands from bitkit-docker. Read the named docs and script +headers for details. The steps below are what is not obvious from them. ## Lightspark hosted regtest @@ -35,7 +36,8 @@ the named docs and script headers for details. The steps below are what is not o browser. - Script: `SPARK_REGTEST_MNEMONIC=… uv run ../bitkit-android/scripts/spark-regtest-fund.py [sats]`. The mnemonic is a GitHub secret; ask the user, never print it. -4. Lightspark mines about once a minute. Spark claims a deposit after 3 confirmations. +4. Lightspark mines about once a minute. Spark claims a deposit after 3 confirmations unless an Instant transfer claims + it early. 5. Two-device payment: fund the payer's Spark balance, copy the invoice from Receive › Spending on the other dev build, and pay it from the payer. It goes over Lightning through Lightspark's provider. @@ -51,15 +53,16 @@ build script sets all of that: IOS_ROOT="$PWD"; cd ../bitkit-e2e-tests IOS_ROOT="$IOS_ROOT" SPARK_LOCAL_CONFIG_B64="$(../bitkit-docker/spark config --base64)" \ SPARK_LOCAL_CHAIN_URL=http://127.0.0.1:23090/api BACKEND=local ./scripts/build-ios-sim.sh +xcrun simctl install booted aut/Bitkit.app ``` - The two settings are `Info.plist` build settings, baked in at build time. `SIMCTL_CHILD_` launch variables don't set them, despite what `docs/spark-regtest.md` says. - The simulator shares the Mac's loopback, so the `127.0.0.1` URLs work as they are. Savings uses bitkit-docker's Electrum, the same chain, so Transfer to Spending and Savings-paid exit fees work (`Env.sharesLocalSparkChain`). -- `IOS_ROOT` keeps the script on this checkout; it defaults to `../bitkit-ios`, which in a worktree is another commit. -- A simulator that already chose an Electrum server keeps it, and Savings then misses the fixture chain. Use a fresh - simulator, or Settings › Advanced › Electrum Server › Reset To Default. +- `IOS_ROOT` keeps the script on this checkout; it defaults to the `bitkit-ios` checkout next to bitkit-e2e-tests. +- A simulator that already chose an Electrum server keeps it, and Savings then misses the fixture chain. Uninstall the + app first, or use Settings › Advanced › Electrum Server › Reset To Default. - Fund Spark with `./spark send ` or `./spark pay [sats]`. - A deposit is claimed after 1 block here. - Mine with `./spark mine`, not `./bitcoin-cli mine`: only `spark-bitcoind` relays Spark's v3 packages. From 39466ad3a36122428910d7622bba87ee6eda8326 Mon Sep 17 00:00:00 2001 From: jvsena42 Date: Tue, 24 Nov 2026 14:12:17 -0300 Subject: [PATCH 7/9] docs: stop the local spark build when spark config fails Co-Authored-By: Claude Opus 5.5 --- .agents/skills/spark-regtest/SKILL.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.agents/skills/spark-regtest/SKILL.md b/.agents/skills/spark-regtest/SKILL.md index b8dc799f73..e5298f3380 100644 --- a/.agents/skills/spark-regtest/SKILL.md +++ b/.agents/skills/spark-regtest/SKILL.md @@ -51,11 +51,14 @@ build script sets all of that: ```bash ../bitkit-docker/spark up IOS_ROOT="$PWD"; cd ../bitkit-e2e-tests -IOS_ROOT="$IOS_ROOT" SPARK_LOCAL_CONFIG_B64="$(../bitkit-docker/spark config --base64)" \ -SPARK_LOCAL_CHAIN_URL=http://127.0.0.1:23090/api BACKEND=local ./scripts/build-ios-sim.sh +CFG="$(../bitkit-docker/spark config --base64)" && \ +IOS_ROOT="$IOS_ROOT" SPARK_LOCAL_CONFIG_B64="$CFG" \ +SPARK_LOCAL_CHAIN_URL=http://127.0.0.1:23090/api BACKEND=local ./scripts/build-ios-sim.sh && \ xcrun simctl install booted aut/Bitkit.app ``` +- `CFG=… &&` stops the build when `spark config` fails (stack not up, or the wrong `bitkit-docker` path). Inline, the + build would still run with an empty config. - The two settings are `Info.plist` build settings, baked in at build time. `SIMCTL_CHILD_` launch variables don't set them, despite what `docs/spark-regtest.md` says. - The simulator shares the Mac's loopback, so the `127.0.0.1` URLs work as they are. Savings uses bitkit-docker's From a2bf63e9d88ac5dfcd296d6b6abb3d5d502d2600 Mon Sep 17 00:00:00 2001 From: jvsena42 Date: Wed, 25 Nov 2026 05:34:15 -0300 Subject: [PATCH 8/9] docs: stop the local spark recipe when spark up fails Co-Authored-By: Claude Opus 5.5 --- .agents/skills/spark-regtest/SKILL.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.agents/skills/spark-regtest/SKILL.md b/.agents/skills/spark-regtest/SKILL.md index e5298f3380..f8153a51f8 100644 --- a/.agents/skills/spark-regtest/SKILL.md +++ b/.agents/skills/spark-regtest/SKILL.md @@ -49,16 +49,16 @@ Run `./spark up` from a bitkit-docker checkout on `main`. The app reads `SPARK_L build script sets all of that: ```bash -../bitkit-docker/spark up -IOS_ROOT="$PWD"; cd ../bitkit-e2e-tests +../bitkit-docker/spark up && \ +IOS_ROOT="$PWD" && cd ../bitkit-e2e-tests && \ CFG="$(../bitkit-docker/spark config --base64)" && \ IOS_ROOT="$IOS_ROOT" SPARK_LOCAL_CONFIG_B64="$CFG" \ SPARK_LOCAL_CHAIN_URL=http://127.0.0.1:23090/api BACKEND=local ./scripts/build-ios-sim.sh && \ xcrun simctl install booted aut/Bitkit.app ``` -- `CFG=… &&` stops the build when `spark config` fails (stack not up, or the wrong `bitkit-docker` path). Inline, the - build would still run with an empty config. +- The `&&` chain stops at the first failure. `spark up` can fail while a config from an earlier run survives, and + `spark config` fails when the stack is not up or the `bitkit-docker` path is wrong; inline, the build would still run. - The two settings are `Info.plist` build settings, baked in at build time. `SIMCTL_CHILD_` launch variables don't set them, despite what `docs/spark-regtest.md` says. - The simulator shares the Mac's loopback, so the `127.0.0.1` URLs work as they are. Savings uses bitkit-docker's From 34011269aa126927eef5c2eaffaa039f1156edcf Mon Sep 17 00:00:00 2001 From: jvsena42 Date: Wed, 25 Nov 2026 05:34:21 -0300 Subject: [PATCH 9/9] docs: keep the spark faucet mnemonic out of chat Co-Authored-By: Claude Opus 5.5 --- .agents/skills/spark-regtest/SKILL.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.agents/skills/spark-regtest/SKILL.md b/.agents/skills/spark-regtest/SKILL.md index f8153a51f8..46fdc20f2c 100644 --- a/.agents/skills/spark-regtest/SKILL.md +++ b/.agents/skills/spark-regtest/SKILL.md @@ -35,7 +35,7 @@ headers for details. The steps below are what is not obvious from them. - Web faucet: https://app.lightspark.com/regtest-faucet, up to 50,000 sats per deposit. The user submits it in a browser. - Script: `SPARK_REGTEST_MNEMONIC=… uv run ../bitkit-android/scripts/spark-regtest-fund.py [sats]`. - The mnemonic is a GitHub secret; ask the user, never print it. + The mnemonic is a GitHub secret. Ask the developer to set it locally, or use the web faucet. Keep it out of chat. 4. Lightspark mines about once a minute. Spark claims a deposit after 3 confirmations unless an Instant transfer claims it early. 5. Two-device payment: fund the payer's Spark balance, copy the invoice from Receive › Spending on the other dev build,