jam/docker/regtest/init-setup.sh

104 lines
5 KiB
Bash
Raw Permalink Normal View History

Enable coinjoin on regtest env (#6) * fix: prevent 'config value not set' on cj in regtest env 'max_cj_fee' config values must be present when invoking a coinjoin via the api. the default config for the regtest env did not include these values before, hence they could not be overridden in docker-compose setup file. * dev: switch irc server from miniirc to ergochat * dev: start second joinmarket container In order to successfully perform a CoinJoin, there must be at least one maker. This commit adds a second JoinMarket container with jmwalletd accessible on port 29183. * dev: add helper script to mine a block * dev: add container switch to regtest-control script * dev: invoke mine-block in regtest-control script * dev: add flag '--unmatured' to regtest-control script Sometimes it is desired that block rewards do not reach maturity immediately. This is convenient if you want to supply several wallets with coins, but do not want to generate many blocks all the time. * dev: add helper script to start maker service This script helps in providing both JoinMarket containers a wallet with spendable coins and starting the Maker Service in the secondary container. Its main goal is to make CoinJoin transactions possible in the regtest environment. * dev: move common functions to script common.sh * fix: use correct irc host in docker setup * dev: use ergochat image from ghcr.io * dev: dont lock secondary wallet in setup script normally the wallet should be locked, but it seems this leads to the maker service responding very slowly which causes failing coinjoins. as the secondary instance is never interacted with directly, we can refrain from unlocking the wallet for now. * docs: add debug log command to docker readme * cleanup: rename script 'regtest-control' to 'fund-wallet' * dev: upgrade joinmarket from v0.9.3 to use current master branch * review: add more descriptive comments and cleanup files
2022-01-22 17:09:14 +01:00
#!/usr/bin/env bash
###
#
# This script helps initializing the JoinMarket docker containers.
Enable coinjoin on regtest env (#6) * fix: prevent 'config value not set' on cj in regtest env 'max_cj_fee' config values must be present when invoking a coinjoin via the api. the default config for the regtest env did not include these values before, hence they could not be overridden in docker-compose setup file. * dev: switch irc server from miniirc to ergochat * dev: start second joinmarket container In order to successfully perform a CoinJoin, there must be at least one maker. This commit adds a second JoinMarket container with jmwalletd accessible on port 29183. * dev: add helper script to mine a block * dev: add container switch to regtest-control script * dev: invoke mine-block in regtest-control script * dev: add flag '--unmatured' to regtest-control script Sometimes it is desired that block rewards do not reach maturity immediately. This is convenient if you want to supply several wallets with coins, but do not want to generate many blocks all the time. * dev: add helper script to start maker service This script helps in providing both JoinMarket containers a wallet with spendable coins and starting the Maker Service in the secondary container. Its main goal is to make CoinJoin transactions possible in the regtest environment. * dev: move common functions to script common.sh * fix: use correct irc host in docker setup * dev: use ergochat image from ghcr.io * dev: dont lock secondary wallet in setup script normally the wallet should be locked, but it seems this leads to the maker service responding very slowly which causes failing coinjoins. as the secondary instance is never interacted with directly, we can refrain from unlocking the wallet for now. * docs: add debug log command to docker readme * cleanup: rename script 'regtest-control' to 'fund-wallet' * dev: upgrade joinmarket from v0.9.3 to use current master branch * review: add more descriptive comments and cleanup files
2022-01-22 17:09:14 +01:00
# Its main goal is to make CoinJoin transactions possible in the regtest environment.
#
# It has two responsibilities:
# - funding wallets in all containers with some coins
chore(regtest): initial joinmarket-ng backend for regtest environment (#1240) * chore(regtest): initial joinmarket-ng backend for regtest environment Adds jmwalletd, directory servers, makers, and bitcoind to the regtest docker-compose environment so jam can be developed against the jm-ng backend end-to-end. chore(regtest): wire docker compose env and vite dev proxy for jm-ng Connects the local regtest containers into a single compose network, adds tor and fund-wallet helpers, and points Vite's dev proxy at the local jmwalletd instance. fix(tags): recognize cj-change, used-empty, and flagged UTXO statuses joinmarket-ng's WalletService emits four statuses jam's JmPlainTagValue didn't cover: 'cj-change' (deanonymising change from our CJ), 'used-empty' (previously-used address with zero balance), and 'flagged' (address shared in a CJ that later failed). They fell through to the generic 'default' badge with no distinguishing styling. Add them to JmPlainTagValue and the status->variant map. 'used-empty' maps to the existing 'used' variant, 'flagged' to 'reused' (both signal a used address the user should avoid reusing). Add a dedicated 'cj-change' badge variant (emerald) next to 'cj-out' so the deanonymising change output is visually distinct from an equal-amount CJ output. fix(send): keep direct send available with maker Only block collaborative sends while the maker service is running. Direct sends stay enabled and the form explains why the collaborative toggle is unavailable. Changelog: Allow direct sends while the maker service is running docs(dev): explain jm-ng backend workflow fix(auth): only clear auth on invalid_token 401s Previously every 401 response cleared the session and logged the user out. jm-ng returns 401 for service-state errors (e.g. POST /tumbler/stop when nothing is running), which should never drop the session. Inspect the WWW-Authenticate header and only clear auth when the server signals ``error="invalid_token"``. Changelog: Non-auth 401 responses no longer log the user out. fix(dev): proxy /jmws to the jm-ng HTTPS port jm-ng serves WebSocket on the same port as the HTTPS API. The `jm-ng:dev` script used to override JMWALLETD_WEBSOCKET_PORT to 32283, but the regtest stack exposes that port without a matching listener, so vite proxied WebSocket upgrades into a dead port and the handshake returned empty. Default the env var to JMWALLETD_API_PORT and drop the override. Changelog: Fix WebSocket proxying in the local jm-ng dev setup. fix(dev): correct jm-ng websocket port and proxy targets Update the README and developer docs to reflect that both ports must be set when overriding for a custom jm-ng setup. fix(dev): correct jm-ng websocket port (#1237) chore(dev): distinct server configs for various backends * chore(regtest): address jm-ng review comments --------- Co-authored-by: m0wer <m0wer@sgn.space> Co-authored-by: Parth Bandwal <143504541+parrth20@users.noreply.github.com>
2026-05-05 13:52:41 +02:00
# - starting the maker service in secondary through quinary containers
Enable coinjoin on regtest env (#6) * fix: prevent 'config value not set' on cj in regtest env 'max_cj_fee' config values must be present when invoking a coinjoin via the api. the default config for the regtest env did not include these values before, hence they could not be overridden in docker-compose setup file. * dev: switch irc server from miniirc to ergochat * dev: start second joinmarket container In order to successfully perform a CoinJoin, there must be at least one maker. This commit adds a second JoinMarket container with jmwalletd accessible on port 29183. * dev: add helper script to mine a block * dev: add container switch to regtest-control script * dev: invoke mine-block in regtest-control script * dev: add flag '--unmatured' to regtest-control script Sometimes it is desired that block rewards do not reach maturity immediately. This is convenient if you want to supply several wallets with coins, but do not want to generate many blocks all the time. * dev: add helper script to start maker service This script helps in providing both JoinMarket containers a wallet with spendable coins and starting the Maker Service in the secondary container. Its main goal is to make CoinJoin transactions possible in the regtest environment. * dev: move common functions to script common.sh * fix: use correct irc host in docker setup * dev: use ergochat image from ghcr.io * dev: dont lock secondary wallet in setup script normally the wallet should be locked, but it seems this leads to the maker service responding very slowly which causes failing coinjoins. as the secondary instance is never interacted with directly, we can refrain from unlocking the wallet for now. * docs: add debug log command to docker readme * cleanup: rename script 'regtest-control' to 'fund-wallet' * dev: upgrade joinmarket from v0.9.3 to use current master branch * review: add more descriptive comments and cleanup files
2022-01-22 17:09:14 +01:00
#
###
set -Eeuo pipefail
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
# fund wallet in primary JoinMarket NG container
. "$script_dir/fund-wallet.sh" --container jm_regtest_joinmarket --mixdepth 0 --unmatured --blocks 1
. "$script_dir/fund-wallet.sh" --container jm_regtest_joinmarket --mixdepth 1 --unmatured --blocks 2 # outputs should be flagged as "reused"
. "$script_dir/fund-wallet.sh" --container jm_regtest_joinmarket --mixdepth 4 --unmatured --blocks 1
Enable coinjoin on regtest env (#6) * fix: prevent 'config value not set' on cj in regtest env 'max_cj_fee' config values must be present when invoking a coinjoin via the api. the default config for the regtest env did not include these values before, hence they could not be overridden in docker-compose setup file. * dev: switch irc server from miniirc to ergochat * dev: start second joinmarket container In order to successfully perform a CoinJoin, there must be at least one maker. This commit adds a second JoinMarket container with jmwalletd accessible on port 29183. * dev: add helper script to mine a block * dev: add container switch to regtest-control script * dev: invoke mine-block in regtest-control script * dev: add flag '--unmatured' to regtest-control script Sometimes it is desired that block rewards do not reach maturity immediately. This is convenient if you want to supply several wallets with coins, but do not want to generate many blocks all the time. * dev: add helper script to start maker service This script helps in providing both JoinMarket containers a wallet with spendable coins and starting the Maker Service in the secondary container. Its main goal is to make CoinJoin transactions possible in the regtest environment. * dev: move common functions to script common.sh * fix: use correct irc host in docker setup * dev: use ergochat image from ghcr.io * dev: dont lock secondary wallet in setup script normally the wallet should be locked, but it seems this leads to the maker service responding very slowly which causes failing coinjoins. as the secondary instance is never interacted with directly, we can refrain from unlocking the wallet for now. * docs: add debug log command to docker readme * cleanup: rename script 'regtest-control' to 'fund-wallet' * dev: upgrade joinmarket from v0.9.3 to use current master branch * review: add more descriptive comments and cleanup files
2022-01-22 17:09:14 +01:00
# fund wallet in ng standalone secondary container
. "$script_dir/fund-wallet.sh" --container jm_regtest_joinmarket2 --unmatured --blocks 50
# fund wallet in legacy clientserver native tertiary container
. "$script_dir/fund-wallet.sh" --container jm_regtest_joinmarket3 --unmatured --blocks 50
Enable coinjoin on regtest env (#6) * fix: prevent 'config value not set' on cj in regtest env 'max_cj_fee' config values must be present when invoking a coinjoin via the api. the default config for the regtest env did not include these values before, hence they could not be overridden in docker-compose setup file. * dev: switch irc server from miniirc to ergochat * dev: start second joinmarket container In order to successfully perform a CoinJoin, there must be at least one maker. This commit adds a second JoinMarket container with jmwalletd accessible on port 29183. * dev: add helper script to mine a block * dev: add container switch to regtest-control script * dev: invoke mine-block in regtest-control script * dev: add flag '--unmatured' to regtest-control script Sometimes it is desired that block rewards do not reach maturity immediately. This is convenient if you want to supply several wallets with coins, but do not want to generate many blocks all the time. * dev: add helper script to start maker service This script helps in providing both JoinMarket containers a wallet with spendable coins and starting the Maker Service in the secondary container. Its main goal is to make CoinJoin transactions possible in the regtest environment. * dev: move common functions to script common.sh * fix: use correct irc host in docker setup * dev: use ergochat image from ghcr.io * dev: dont lock secondary wallet in setup script normally the wallet should be locked, but it seems this leads to the maker service responding very slowly which causes failing coinjoins. as the secondary instance is never interacted with directly, we can refrain from unlocking the wallet for now. * docs: add debug log command to docker readme * cleanup: rename script 'regtest-control' to 'fund-wallet' * dev: upgrade joinmarket from v0.9.3 to use current master branch * review: add more descriptive comments and cleanup files
2022-01-22 17:09:14 +01:00
# fund wallet in legacy clientserver jam-standalone quaternary container
chore(regtest): initial joinmarket-ng backend for regtest environment (#1240) * chore(regtest): initial joinmarket-ng backend for regtest environment Adds jmwalletd, directory servers, makers, and bitcoind to the regtest docker-compose environment so jam can be developed against the jm-ng backend end-to-end. chore(regtest): wire docker compose env and vite dev proxy for jm-ng Connects the local regtest containers into a single compose network, adds tor and fund-wallet helpers, and points Vite's dev proxy at the local jmwalletd instance. fix(tags): recognize cj-change, used-empty, and flagged UTXO statuses joinmarket-ng's WalletService emits four statuses jam's JmPlainTagValue didn't cover: 'cj-change' (deanonymising change from our CJ), 'used-empty' (previously-used address with zero balance), and 'flagged' (address shared in a CJ that later failed). They fell through to the generic 'default' badge with no distinguishing styling. Add them to JmPlainTagValue and the status->variant map. 'used-empty' maps to the existing 'used' variant, 'flagged' to 'reused' (both signal a used address the user should avoid reusing). Add a dedicated 'cj-change' badge variant (emerald) next to 'cj-out' so the deanonymising change output is visually distinct from an equal-amount CJ output. fix(send): keep direct send available with maker Only block collaborative sends while the maker service is running. Direct sends stay enabled and the form explains why the collaborative toggle is unavailable. Changelog: Allow direct sends while the maker service is running docs(dev): explain jm-ng backend workflow fix(auth): only clear auth on invalid_token 401s Previously every 401 response cleared the session and logged the user out. jm-ng returns 401 for service-state errors (e.g. POST /tumbler/stop when nothing is running), which should never drop the session. Inspect the WWW-Authenticate header and only clear auth when the server signals ``error="invalid_token"``. Changelog: Non-auth 401 responses no longer log the user out. fix(dev): proxy /jmws to the jm-ng HTTPS port jm-ng serves WebSocket on the same port as the HTTPS API. The `jm-ng:dev` script used to override JMWALLETD_WEBSOCKET_PORT to 32283, but the regtest stack exposes that port without a matching listener, so vite proxied WebSocket upgrades into a dead port and the handshake returned empty. Default the env var to JMWALLETD_API_PORT and drop the override. Changelog: Fix WebSocket proxying in the local jm-ng dev setup. fix(dev): correct jm-ng websocket port and proxy targets Update the README and developer docs to reflect that both ports must be set when overriding for a custom jm-ng setup. fix(dev): correct jm-ng websocket port (#1237) chore(dev): distinct server configs for various backends * chore(regtest): address jm-ng review comments --------- Co-authored-by: m0wer <m0wer@sgn.space> Co-authored-by: Parth Bandwal <143504541+parrth20@users.noreply.github.com>
2026-05-05 13:52:41 +02:00
. "$script_dir/fund-wallet.sh" --container jm_regtest_joinmarket4 --unmatured --blocks 50
# fund wallet in ng peer quinary container
. "$script_dir/fund-wallet.sh" --container jm_regtest_joinmarket5 --unmatured --blocks 50
feat: import wallet (#621) * chore(regtest): do not build tor locally in regtest env * feat(import): add rescanning param to session request * feat(api): add rescanblockchain request to JmWalletApi * feat: add import wallet button to wallets page * refactor: externalize component PreventLeavingPageByMistake * refactor: externalize component WalletCreationForm * wip: use WalletCreationForm in ImportWallet * refactor: externalize SeedWordInput and rename to MnemonicWordInput * feat(api): add wallet recover request to JmWalletApi * build(deps): bump caniuse-lite to v1.0.30001511 * wip(import): start wallet after successful import * refactor: externalize component WalletCreationConfirmation * wip(import): use WalletCreationConfirmation view in component WalletImport * dev(regtest): add funds to dummy wallet during initialization of local setup * wip(import): update gaplimit before rescanning chain * wip(import): prevent import if rescan is in progress * wip(import): ability to customize gaplimit and blockheight * wip(import): show duration hint when importing wallet * wip(import): hide sensitive info while importing wallet * wip(import): reset gaplimit to original value after importing * wip(import): add description for blockheight and gaplimit * wip(import): add cancel button to WalletCreationForm * refactor: externalize component MnemonicPhraseInput * wip(import): show rescanning indicator on main wallet view * wip(import): show rescanning indicator in navbar * wip(import): disable sending when rescanning is in progress * wip(import): disable navbar/earn/jam when rescanning is in progress * Update src/i18n/locales/en/translation.json Co-authored-by: openoms <43343391+openoms@users.noreply.github.com> * fix(import): disable viewing jars on main wallet if rescanning is active * wip(import): prevent creating new address when rescanning * fix(import): reload wallet info after rescanning finishes * refactor: move auto reloading code from WalletContext to WalletInfoAutoReload * refactor: remove unused method reloadDisplay * wip(import): reload recursively till balance is found * wip(import): expand import options by default * ui: add 'dev' badge to buttons only visible in dev env --------- Co-authored-by: openoms <43343391+openoms@users.noreply.github.com>
2023-09-08 13:26:59 +02:00
# fund addresses of seed 'abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about'
# this is useful if you "import an existing wallet" and verify rescanning the chain works as expected.
dummy_wallet_address1='bcrt1q6rz28mcfaxtmd6v789l9rrlrusdprr9pz3cppk' # 1st address of jar A (m/84'/1'/0'/0/0)
dummy_wallet_address2='bcrt1qt5yxk3xzrx66q9wd5sdyynklqynqcyf7uh74j3' # 8th address of jar C (m/84'/1'/2'/0/7)
dummy_wallet_address3='bcrt1qn8804dw5fahuc5cwqteuq5j4xlhk2cnkq7a8kw' # 21st change address of jar E (m/84'/1'/4'/1/21)
feat: plan scheduled sweep (#1339) * refactor: add reason to scheduler error messages * fix: dismiss schedule confirm dialog on error * chore(i18n): distinct scheduler starting/stopping messages * chore(sweep): remove redundant manual destination validation * chore(sweep): initial sweep options * chore(ui): add slider component * chore(sweep): add rounding chance option * feat(sweep): ability to add/remove destinations * chore(sweep): use plan tumbler mutation * refactor(sweep): use tumblerstartMutation * refactor(sweep): externalize SweepForm * feat(sweep): ability to set min/max number of collaborators * chore(sweep): increase time_lambda_seconds in insecure test options * chore(sweep): fix progress step of quick sweep * chore(sweep): start refactor schedule entry * chore(sweep): preserve raw data in ScheduleEntry * feat(sweep): show destination addresses * chore(sweep): scroll to top after start/stop * chore(ui): add Item component * fix: only abort single taker runs on send page * chore(sweep): schedule entries with Item component * chore(sweep): show wait time before next action * chore(sweep): schedule entries in accordion * chore(sweep): remove scheduler.progress_current_state_wait_before_next message * chore(sweep): tab for completed entries * refactor(sweep): align Schedule object structure * chore(sweep): display error message on failed actions * chore(sweep): display completed scheduled sweep * chore(sweep): move stop button from child component to page * feat(sweep): ability to review scheduled sweep plan * chore(sweep): increase schedule polling from 3s to 10s * chore(sweep): hourglass icon for waiting alerts * chore(sweep): adapt buttons, labels and alert texts * fix(sweep): default min confirmations between phases * chore(sweep): improve time estimate on sweeps * chore(sweep): show pending tasks in details * feat(sweep): ability to configure mintxcount * chore(storybook): add slider, sidebar and item stories * test(sweep): verify add/remove sweep destination input * test: load decorators from story meta config * chore(sweep): add makeSessionIdleTimeoutSeconds to form values * chore(sweep): reload schedule if not stale or terminated * chore(sweep): more details in sections * chore(sweep): reorder entry details * chore(sweep): show transaction info in destination section * chore(sweep): estimate duration with fixed runtime info of maker phases * chore(regtest): setup dummy wallet fidelity bonds * fix(sweep): maker idle timeout less than runtime duration * chore(sweep): use taker_utxo_age as min confs in sweep preconditions * chore(build): add task test:coverage * chore(sweep): max number of destination addresses * chore(sweep): maxNumberOfDestinations
2026-07-23 13:06:40 +02:00
dummy_wallet_address_fb0='bcrt1q7war3lusq3ez633rzzfkp75unfcgrqqcu80sgp0ellhrdvkzxh5swspygk' # 1st fb address (m/84'/1'/0'/2/0)
dummy_wallet_address_fb959='bcrt1q6rlcknptmqhf4w20928tpz6px4y70960gyupd029c7vx7kdjwt0q46nk9c' # 960th fb address (m/84'/1'/0'/2/959)
# make block rewards spendable: 100 + 5 (default of `taker_utxo_age`) + 1 = at least 106 blocks
feat: import wallet (#621) * chore(regtest): do not build tor locally in regtest env * feat(import): add rescanning param to session request * feat(api): add rescanblockchain request to JmWalletApi * feat: add import wallet button to wallets page * refactor: externalize component PreventLeavingPageByMistake * refactor: externalize component WalletCreationForm * wip: use WalletCreationForm in ImportWallet * refactor: externalize SeedWordInput and rename to MnemonicWordInput * feat(api): add wallet recover request to JmWalletApi * build(deps): bump caniuse-lite to v1.0.30001511 * wip(import): start wallet after successful import * refactor: externalize component WalletCreationConfirmation * wip(import): use WalletCreationConfirmation view in component WalletImport * dev(regtest): add funds to dummy wallet during initialization of local setup * wip(import): update gaplimit before rescanning chain * wip(import): prevent import if rescan is in progress * wip(import): ability to customize gaplimit and blockheight * wip(import): show duration hint when importing wallet * wip(import): hide sensitive info while importing wallet * wip(import): reset gaplimit to original value after importing * wip(import): add description for blockheight and gaplimit * wip(import): add cancel button to WalletCreationForm * refactor: externalize component MnemonicPhraseInput * wip(import): show rescanning indicator on main wallet view * wip(import): show rescanning indicator in navbar * wip(import): disable sending when rescanning is in progress * wip(import): disable navbar/earn/jam when rescanning is in progress * Update src/i18n/locales/en/translation.json Co-authored-by: openoms <43343391+openoms@users.noreply.github.com> * fix(import): disable viewing jars on main wallet if rescanning is active * wip(import): prevent creating new address when rescanning * fix(import): reload wallet info after rescanning finishes * refactor: move auto reloading code from WalletContext to WalletInfoAutoReload * refactor: remove unused method reloadDisplay * wip(import): reload recursively till balance is found * wip(import): expand import options by default * ui: add 'dev' badge to buttons only visible in dev env --------- Co-authored-by: openoms <43343391+openoms@users.noreply.github.com>
2023-09-08 13:26:59 +02:00
. "$script_dir/mine-block.sh" 2 "$dummy_wallet_address1" &>/dev/null
. "$script_dir/mine-block.sh" 2 "$dummy_wallet_address2" &>/dev/null
. "$script_dir/mine-block.sh" 2 "$dummy_wallet_address3" &>/dev/null
feat: plan scheduled sweep (#1339) * refactor: add reason to scheduler error messages * fix: dismiss schedule confirm dialog on error * chore(i18n): distinct scheduler starting/stopping messages * chore(sweep): remove redundant manual destination validation * chore(sweep): initial sweep options * chore(ui): add slider component * chore(sweep): add rounding chance option * feat(sweep): ability to add/remove destinations * chore(sweep): use plan tumbler mutation * refactor(sweep): use tumblerstartMutation * refactor(sweep): externalize SweepForm * feat(sweep): ability to set min/max number of collaborators * chore(sweep): increase time_lambda_seconds in insecure test options * chore(sweep): fix progress step of quick sweep * chore(sweep): start refactor schedule entry * chore(sweep): preserve raw data in ScheduleEntry * feat(sweep): show destination addresses * chore(sweep): scroll to top after start/stop * chore(ui): add Item component * fix: only abort single taker runs on send page * chore(sweep): schedule entries with Item component * chore(sweep): show wait time before next action * chore(sweep): schedule entries in accordion * chore(sweep): remove scheduler.progress_current_state_wait_before_next message * chore(sweep): tab for completed entries * refactor(sweep): align Schedule object structure * chore(sweep): display error message on failed actions * chore(sweep): display completed scheduled sweep * chore(sweep): move stop button from child component to page * feat(sweep): ability to review scheduled sweep plan * chore(sweep): increase schedule polling from 3s to 10s * chore(sweep): hourglass icon for waiting alerts * chore(sweep): adapt buttons, labels and alert texts * fix(sweep): default min confirmations between phases * chore(sweep): improve time estimate on sweeps * chore(sweep): show pending tasks in details * feat(sweep): ability to configure mintxcount * chore(storybook): add slider, sidebar and item stories * test(sweep): verify add/remove sweep destination input * test: load decorators from story meta config * chore(sweep): add makeSessionIdleTimeoutSeconds to form values * chore(sweep): reload schedule if not stale or terminated * chore(sweep): more details in sections * chore(sweep): reorder entry details * chore(sweep): show transaction info in destination section * chore(sweep): estimate duration with fixed runtime info of maker phases * chore(regtest): setup dummy wallet fidelity bonds * fix(sweep): maker idle timeout less than runtime duration * chore(sweep): use taker_utxo_age as min confs in sweep preconditions * chore(build): add task test:coverage * chore(sweep): max number of destination addresses * chore(sweep): maxNumberOfDestinations
2026-07-23 13:06:40 +02:00
. "$script_dir/mine-block.sh" 1 "$dummy_wallet_address_fb0" &>/dev/null
. "$script_dir/mine-block.sh" 1 "$dummy_wallet_address_fb959" &>/dev/null
feat: import wallet (#621) * chore(regtest): do not build tor locally in regtest env * feat(import): add rescanning param to session request * feat(api): add rescanblockchain request to JmWalletApi * feat: add import wallet button to wallets page * refactor: externalize component PreventLeavingPageByMistake * refactor: externalize component WalletCreationForm * wip: use WalletCreationForm in ImportWallet * refactor: externalize SeedWordInput and rename to MnemonicWordInput * feat(api): add wallet recover request to JmWalletApi * build(deps): bump caniuse-lite to v1.0.30001511 * wip(import): start wallet after successful import * refactor: externalize component WalletCreationConfirmation * wip(import): use WalletCreationConfirmation view in component WalletImport * dev(regtest): add funds to dummy wallet during initialization of local setup * wip(import): update gaplimit before rescanning chain * wip(import): prevent import if rescan is in progress * wip(import): ability to customize gaplimit and blockheight * wip(import): show duration hint when importing wallet * wip(import): hide sensitive info while importing wallet * wip(import): reset gaplimit to original value after importing * wip(import): add description for blockheight and gaplimit * wip(import): add cancel button to WalletCreationForm * refactor: externalize component MnemonicPhraseInput * wip(import): show rescanning indicator on main wallet view * wip(import): show rescanning indicator in navbar * wip(import): disable sending when rescanning is in progress * wip(import): disable navbar/earn/jam when rescanning is in progress * Update src/i18n/locales/en/translation.json Co-authored-by: openoms <43343391+openoms@users.noreply.github.com> * fix(import): disable viewing jars on main wallet if rescanning is active * wip(import): prevent creating new address when rescanning * fix(import): reload wallet info after rescanning finishes * refactor: move auto reloading code from WalletContext to WalletInfoAutoReload * refactor: remove unused method reloadDisplay * wip(import): reload recursively till balance is found * wip(import): expand import options by default * ui: add 'dev' badge to buttons only visible in dev env --------- Co-authored-by: openoms <43343391+openoms@users.noreply.github.com>
2023-09-08 13:26:59 +02:00
. "$script_dir/mine-block.sh" 100 &>/dev/null
Enable coinjoin on regtest env (#6) * fix: prevent 'config value not set' on cj in regtest env 'max_cj_fee' config values must be present when invoking a coinjoin via the api. the default config for the regtest env did not include these values before, hence they could not be overridden in docker-compose setup file. * dev: switch irc server from miniirc to ergochat * dev: start second joinmarket container In order to successfully perform a CoinJoin, there must be at least one maker. This commit adds a second JoinMarket container with jmwalletd accessible on port 29183. * dev: add helper script to mine a block * dev: add container switch to regtest-control script * dev: invoke mine-block in regtest-control script * dev: add flag '--unmatured' to regtest-control script Sometimes it is desired that block rewards do not reach maturity immediately. This is convenient if you want to supply several wallets with coins, but do not want to generate many blocks all the time. * dev: add helper script to start maker service This script helps in providing both JoinMarket containers a wallet with spendable coins and starting the Maker Service in the secondary container. Its main goal is to make CoinJoin transactions possible in the regtest environment. * dev: move common functions to script common.sh * fix: use correct irc host in docker setup * dev: use ergochat image from ghcr.io * dev: dont lock secondary wallet in setup script normally the wallet should be locked, but it seems this leads to the maker service responding very slowly which causes failing coinjoins. as the secondary instance is never interacted with directly, we can refrain from unlocking the wallet for now. * docs: add debug log command to docker readme * cleanup: rename script 'regtest-control' to 'fund-wallet' * dev: upgrade joinmarket from v0.9.3 to use current master branch * review: add more descriptive comments and cleanup files
2022-01-22 17:09:14 +01:00
start_maker() {
local base_url; base_url=${1:-}
local wallet_name; wallet_name=${2:-}
local wallet_password; wallet_password=${3:-}
# Check if maker service is not yet running
verify_no_open_session_or_throw "$base_url"
Enable coinjoin on regtest env (#6) * fix: prevent 'config value not set' on cj in regtest env 'max_cj_fee' config values must be present when invoking a coinjoin via the api. the default config for the regtest env did not include these values before, hence they could not be overridden in docker-compose setup file. * dev: switch irc server from miniirc to ergochat * dev: start second joinmarket container In order to successfully perform a CoinJoin, there must be at least one maker. This commit adds a second JoinMarket container with jmwalletd accessible on port 29183. * dev: add helper script to mine a block * dev: add container switch to regtest-control script * dev: invoke mine-block in regtest-control script * dev: add flag '--unmatured' to regtest-control script Sometimes it is desired that block rewards do not reach maturity immediately. This is convenient if you want to supply several wallets with coins, but do not want to generate many blocks all the time. * dev: add helper script to start maker service This script helps in providing both JoinMarket containers a wallet with spendable coins and starting the Maker Service in the secondary container. Its main goal is to make CoinJoin transactions possible in the regtest environment. * dev: move common functions to script common.sh * fix: use correct irc host in docker setup * dev: use ergochat image from ghcr.io * dev: dont lock secondary wallet in setup script normally the wallet should be locked, but it seems this leads to the maker service responding very slowly which causes failing coinjoins. as the secondary instance is never interacted with directly, we can refrain from unlocking the wallet for now. * docs: add debug log command to docker readme * cleanup: rename script 'regtest-control' to 'fund-wallet' * dev: upgrade joinmarket from v0.9.3 to use current master branch * review: add more descriptive comments and cleanup files
2022-01-22 17:09:14 +01:00
local maker_running; maker_running=$(is_maker_running "$base_url")
Enable coinjoin on regtest env (#6) * fix: prevent 'config value not set' on cj in regtest env 'max_cj_fee' config values must be present when invoking a coinjoin via the api. the default config for the regtest env did not include these values before, hence they could not be overridden in docker-compose setup file. * dev: switch irc server from miniirc to ergochat * dev: start second joinmarket container In order to successfully perform a CoinJoin, there must be at least one maker. This commit adds a second JoinMarket container with jmwalletd accessible on port 29183. * dev: add helper script to mine a block * dev: add container switch to regtest-control script * dev: invoke mine-block in regtest-control script * dev: add flag '--unmatured' to regtest-control script Sometimes it is desired that block rewards do not reach maturity immediately. This is convenient if you want to supply several wallets with coins, but do not want to generate many blocks all the time. * dev: add helper script to start maker service This script helps in providing both JoinMarket containers a wallet with spendable coins and starting the Maker Service in the secondary container. Its main goal is to make CoinJoin transactions possible in the regtest environment. * dev: move common functions to script common.sh * fix: use correct irc host in docker setup * dev: use ergochat image from ghcr.io * dev: dont lock secondary wallet in setup script normally the wallet should be locked, but it seems this leads to the maker service responding very slowly which causes failing coinjoins. as the secondary instance is never interacted with directly, we can refrain from unlocking the wallet for now. * docs: add debug log command to docker readme * cleanup: rename script 'regtest-control' to 'fund-wallet' * dev: upgrade joinmarket from v0.9.3 to use current master branch * review: add more descriptive comments and cleanup files
2022-01-22 17:09:14 +01:00
if [ "$maker_running" != false ]; then
msg_success "Maker is already running"
Enable coinjoin on regtest env (#6) * fix: prevent 'config value not set' on cj in regtest env 'max_cj_fee' config values must be present when invoking a coinjoin via the api. the default config for the regtest env did not include these values before, hence they could not be overridden in docker-compose setup file. * dev: switch irc server from miniirc to ergochat * dev: start second joinmarket container In order to successfully perform a CoinJoin, there must be at least one maker. This commit adds a second JoinMarket container with jmwalletd accessible on port 29183. * dev: add helper script to mine a block * dev: add container switch to regtest-control script * dev: invoke mine-block in regtest-control script * dev: add flag '--unmatured' to regtest-control script Sometimes it is desired that block rewards do not reach maturity immediately. This is convenient if you want to supply several wallets with coins, but do not want to generate many blocks all the time. * dev: add helper script to start maker service This script helps in providing both JoinMarket containers a wallet with spendable coins and starting the Maker Service in the secondary container. Its main goal is to make CoinJoin transactions possible in the regtest environment. * dev: move common functions to script common.sh * fix: use correct irc host in docker setup * dev: use ergochat image from ghcr.io * dev: dont lock secondary wallet in setup script normally the wallet should be locked, but it seems this leads to the maker service responding very slowly which causes failing coinjoins. as the secondary instance is never interacted with directly, we can refrain from unlocking the wallet for now. * docs: add debug log command to docker readme * cleanup: rename script 'regtest-control' to 'fund-wallet' * dev: upgrade joinmarket from v0.9.3 to use current master branch * review: add more descriptive comments and cleanup files
2022-01-22 17:09:14 +01:00
else
# Unlock wallet
local unlock_result; unlock_result=$(unlock_wallet "$base_url" "$wallet_name" "$wallet_password")
local auth_token; auth_token=$(jq -r '.token' <<< "$unlock_result")
local auth_header; auth_header="Authorization: Bearer $auth_token"
# --------------------------
# Start maker
# --------------------------
## API: POST /api/v1/wallet/$wallet_name/maker/start
##
## Response:
## 200 OK
## {}
msg "Starting maker service for wallet $wallet_name.."
local start_maker_request_payload; start_maker_request_payload="{\"txfee\":\"0\",\"cjfee_a\":\"0\",\"cjfee_r\":\"0.0003\",\"ordertype\":\"sw0absoffer\",\"minsize\":\"1\"}"
chore(regtest): initial joinmarket-ng backend for regtest environment (#1240) * chore(regtest): initial joinmarket-ng backend for regtest environment Adds jmwalletd, directory servers, makers, and bitcoind to the regtest docker-compose environment so jam can be developed against the jm-ng backend end-to-end. chore(regtest): wire docker compose env and vite dev proxy for jm-ng Connects the local regtest containers into a single compose network, adds tor and fund-wallet helpers, and points Vite's dev proxy at the local jmwalletd instance. fix(tags): recognize cj-change, used-empty, and flagged UTXO statuses joinmarket-ng's WalletService emits four statuses jam's JmPlainTagValue didn't cover: 'cj-change' (deanonymising change from our CJ), 'used-empty' (previously-used address with zero balance), and 'flagged' (address shared in a CJ that later failed). They fell through to the generic 'default' badge with no distinguishing styling. Add them to JmPlainTagValue and the status->variant map. 'used-empty' maps to the existing 'used' variant, 'flagged' to 'reused' (both signal a used address the user should avoid reusing). Add a dedicated 'cj-change' badge variant (emerald) next to 'cj-out' so the deanonymising change output is visually distinct from an equal-amount CJ output. fix(send): keep direct send available with maker Only block collaborative sends while the maker service is running. Direct sends stay enabled and the form explains why the collaborative toggle is unavailable. Changelog: Allow direct sends while the maker service is running docs(dev): explain jm-ng backend workflow fix(auth): only clear auth on invalid_token 401s Previously every 401 response cleared the session and logged the user out. jm-ng returns 401 for service-state errors (e.g. POST /tumbler/stop when nothing is running), which should never drop the session. Inspect the WWW-Authenticate header and only clear auth when the server signals ``error="invalid_token"``. Changelog: Non-auth 401 responses no longer log the user out. fix(dev): proxy /jmws to the jm-ng HTTPS port jm-ng serves WebSocket on the same port as the HTTPS API. The `jm-ng:dev` script used to override JMWALLETD_WEBSOCKET_PORT to 32283, but the regtest stack exposes that port without a matching listener, so vite proxied WebSocket upgrades into a dead port and the handshake returned empty. Default the env var to JMWALLETD_API_PORT and drop the override. Changelog: Fix WebSocket proxying in the local jm-ng dev setup. fix(dev): correct jm-ng websocket port and proxy targets Update the README and developer docs to reflect that both ports must be set when overriding for a custom jm-ng setup. fix(dev): correct jm-ng websocket port (#1237) chore(dev): distinct server configs for various backends * chore(regtest): address jm-ng review comments --------- Co-authored-by: m0wer <m0wer@sgn.space> Co-authored-by: Parth Bandwal <143504541+parrth20@users.noreply.github.com>
2026-05-05 13:52:41 +02:00
local start_maker_result; start_maker_result=$(curl "$base_url/api/v1/wallet/$wallet_name/maker/start" --silent --show-error --insecure -H "$auth_header" -H "Content-Type: application/json" --data "$start_maker_request_payload" | jq ".")
if [ "$start_maker_result" != "{}" ]; then
msg_warn "There has been a problem starting the maker service: $start_maker_result"
else
msg_success "Successfully started maker for wallet $wallet_name."
fi
# do not lock the wallet as this will terminate the maker service
msg_warn "Wallet $wallet_name remains unlocked!"
Enable coinjoin on regtest env (#6) * fix: prevent 'config value not set' on cj in regtest env 'max_cj_fee' config values must be present when invoking a coinjoin via the api. the default config for the regtest env did not include these values before, hence they could not be overridden in docker-compose setup file. * dev: switch irc server from miniirc to ergochat * dev: start second joinmarket container In order to successfully perform a CoinJoin, there must be at least one maker. This commit adds a second JoinMarket container with jmwalletd accessible on port 29183. * dev: add helper script to mine a block * dev: add container switch to regtest-control script * dev: invoke mine-block in regtest-control script * dev: add flag '--unmatured' to regtest-control script Sometimes it is desired that block rewards do not reach maturity immediately. This is convenient if you want to supply several wallets with coins, but do not want to generate many blocks all the time. * dev: add helper script to start maker service This script helps in providing both JoinMarket containers a wallet with spendable coins and starting the Maker Service in the secondary container. Its main goal is to make CoinJoin transactions possible in the regtest environment. * dev: move common functions to script common.sh * fix: use correct irc host in docker setup * dev: use ergochat image from ghcr.io * dev: dont lock secondary wallet in setup script normally the wallet should be locked, but it seems this leads to the maker service responding very slowly which causes failing coinjoins. as the secondary instance is never interacted with directly, we can refrain from unlocking the wallet for now. * docs: add debug log command to docker readme * cleanup: rename script 'regtest-control' to 'fund-wallet' * dev: upgrade joinmarket from v0.9.3 to use current master branch * review: add more descriptive comments and cleanup files
2022-01-22 17:09:14 +01:00
fi
}
msg "Attempt to start maker service for wallet $wallet_name in ng standalone container.."
start_maker "https://localhost:29183" "Satoshi.jmdat" "test"
msg "Attempt to start maker service for wallet $wallet_name in legacy native container.."
start_maker "https://localhost:30183" "Satoshi.jmdat" "test"
chore(regtest): initial joinmarket-ng backend for regtest environment (#1240) * chore(regtest): initial joinmarket-ng backend for regtest environment Adds jmwalletd, directory servers, makers, and bitcoind to the regtest docker-compose environment so jam can be developed against the jm-ng backend end-to-end. chore(regtest): wire docker compose env and vite dev proxy for jm-ng Connects the local regtest containers into a single compose network, adds tor and fund-wallet helpers, and points Vite's dev proxy at the local jmwalletd instance. fix(tags): recognize cj-change, used-empty, and flagged UTXO statuses joinmarket-ng's WalletService emits four statuses jam's JmPlainTagValue didn't cover: 'cj-change' (deanonymising change from our CJ), 'used-empty' (previously-used address with zero balance), and 'flagged' (address shared in a CJ that later failed). They fell through to the generic 'default' badge with no distinguishing styling. Add them to JmPlainTagValue and the status->variant map. 'used-empty' maps to the existing 'used' variant, 'flagged' to 'reused' (both signal a used address the user should avoid reusing). Add a dedicated 'cj-change' badge variant (emerald) next to 'cj-out' so the deanonymising change output is visually distinct from an equal-amount CJ output. fix(send): keep direct send available with maker Only block collaborative sends while the maker service is running. Direct sends stay enabled and the form explains why the collaborative toggle is unavailable. Changelog: Allow direct sends while the maker service is running docs(dev): explain jm-ng backend workflow fix(auth): only clear auth on invalid_token 401s Previously every 401 response cleared the session and logged the user out. jm-ng returns 401 for service-state errors (e.g. POST /tumbler/stop when nothing is running), which should never drop the session. Inspect the WWW-Authenticate header and only clear auth when the server signals ``error="invalid_token"``. Changelog: Non-auth 401 responses no longer log the user out. fix(dev): proxy /jmws to the jm-ng HTTPS port jm-ng serves WebSocket on the same port as the HTTPS API. The `jm-ng:dev` script used to override JMWALLETD_WEBSOCKET_PORT to 32283, but the regtest stack exposes that port without a matching listener, so vite proxied WebSocket upgrades into a dead port and the handshake returned empty. Default the env var to JMWALLETD_API_PORT and drop the override. Changelog: Fix WebSocket proxying in the local jm-ng dev setup. fix(dev): correct jm-ng websocket port and proxy targets Update the README and developer docs to reflect that both ports must be set when overriding for a custom jm-ng setup. fix(dev): correct jm-ng websocket port (#1237) chore(dev): distinct server configs for various backends * chore(regtest): address jm-ng review comments --------- Co-authored-by: m0wer <m0wer@sgn.space> Co-authored-by: Parth Bandwal <143504541+parrth20@users.noreply.github.com>
2026-05-05 13:52:41 +02:00
msg "Attempt to start maker service for wallet $wallet_name in legacy standalone container.."
chore(regtest): initial joinmarket-ng backend for regtest environment (#1240) * chore(regtest): initial joinmarket-ng backend for regtest environment Adds jmwalletd, directory servers, makers, and bitcoind to the regtest docker-compose environment so jam can be developed against the jm-ng backend end-to-end. chore(regtest): wire docker compose env and vite dev proxy for jm-ng Connects the local regtest containers into a single compose network, adds tor and fund-wallet helpers, and points Vite's dev proxy at the local jmwalletd instance. fix(tags): recognize cj-change, used-empty, and flagged UTXO statuses joinmarket-ng's WalletService emits four statuses jam's JmPlainTagValue didn't cover: 'cj-change' (deanonymising change from our CJ), 'used-empty' (previously-used address with zero balance), and 'flagged' (address shared in a CJ that later failed). They fell through to the generic 'default' badge with no distinguishing styling. Add them to JmPlainTagValue and the status->variant map. 'used-empty' maps to the existing 'used' variant, 'flagged' to 'reused' (both signal a used address the user should avoid reusing). Add a dedicated 'cj-change' badge variant (emerald) next to 'cj-out' so the deanonymising change output is visually distinct from an equal-amount CJ output. fix(send): keep direct send available with maker Only block collaborative sends while the maker service is running. Direct sends stay enabled and the form explains why the collaborative toggle is unavailable. Changelog: Allow direct sends while the maker service is running docs(dev): explain jm-ng backend workflow fix(auth): only clear auth on invalid_token 401s Previously every 401 response cleared the session and logged the user out. jm-ng returns 401 for service-state errors (e.g. POST /tumbler/stop when nothing is running), which should never drop the session. Inspect the WWW-Authenticate header and only clear auth when the server signals ``error="invalid_token"``. Changelog: Non-auth 401 responses no longer log the user out. fix(dev): proxy /jmws to the jm-ng HTTPS port jm-ng serves WebSocket on the same port as the HTTPS API. The `jm-ng:dev` script used to override JMWALLETD_WEBSOCKET_PORT to 32283, but the regtest stack exposes that port without a matching listener, so vite proxied WebSocket upgrades into a dead port and the handshake returned empty. Default the env var to JMWALLETD_API_PORT and drop the override. Changelog: Fix WebSocket proxying in the local jm-ng dev setup. fix(dev): correct jm-ng websocket port and proxy targets Update the README and developer docs to reflect that both ports must be set when overriding for a custom jm-ng setup. fix(dev): correct jm-ng websocket port (#1237) chore(dev): distinct server configs for various backends * chore(regtest): address jm-ng review comments --------- Co-authored-by: m0wer <m0wer@sgn.space> Co-authored-by: Parth Bandwal <143504541+parrth20@users.noreply.github.com>
2026-05-05 13:52:41 +02:00
start_maker "https://localhost:31183" "Satoshi.jmdat" "test"
msg "Attempt to start maker service for wallet $wallet_name in ng peer container.."
chore(regtest): initial joinmarket-ng backend for regtest environment (#1240) * chore(regtest): initial joinmarket-ng backend for regtest environment Adds jmwalletd, directory servers, makers, and bitcoind to the regtest docker-compose environment so jam can be developed against the jm-ng backend end-to-end. chore(regtest): wire docker compose env and vite dev proxy for jm-ng Connects the local regtest containers into a single compose network, adds tor and fund-wallet helpers, and points Vite's dev proxy at the local jmwalletd instance. fix(tags): recognize cj-change, used-empty, and flagged UTXO statuses joinmarket-ng's WalletService emits four statuses jam's JmPlainTagValue didn't cover: 'cj-change' (deanonymising change from our CJ), 'used-empty' (previously-used address with zero balance), and 'flagged' (address shared in a CJ that later failed). They fell through to the generic 'default' badge with no distinguishing styling. Add them to JmPlainTagValue and the status->variant map. 'used-empty' maps to the existing 'used' variant, 'flagged' to 'reused' (both signal a used address the user should avoid reusing). Add a dedicated 'cj-change' badge variant (emerald) next to 'cj-out' so the deanonymising change output is visually distinct from an equal-amount CJ output. fix(send): keep direct send available with maker Only block collaborative sends while the maker service is running. Direct sends stay enabled and the form explains why the collaborative toggle is unavailable. Changelog: Allow direct sends while the maker service is running docs(dev): explain jm-ng backend workflow fix(auth): only clear auth on invalid_token 401s Previously every 401 response cleared the session and logged the user out. jm-ng returns 401 for service-state errors (e.g. POST /tumbler/stop when nothing is running), which should never drop the session. Inspect the WWW-Authenticate header and only clear auth when the server signals ``error="invalid_token"``. Changelog: Non-auth 401 responses no longer log the user out. fix(dev): proxy /jmws to the jm-ng HTTPS port jm-ng serves WebSocket on the same port as the HTTPS API. The `jm-ng:dev` script used to override JMWALLETD_WEBSOCKET_PORT to 32283, but the regtest stack exposes that port without a matching listener, so vite proxied WebSocket upgrades into a dead port and the handshake returned empty. Default the env var to JMWALLETD_API_PORT and drop the override. Changelog: Fix WebSocket proxying in the local jm-ng dev setup. fix(dev): correct jm-ng websocket port and proxy targets Update the README and developer docs to reflect that both ports must be set when overriding for a custom jm-ng setup. fix(dev): correct jm-ng websocket port (#1237) chore(dev): distinct server configs for various backends * chore(regtest): address jm-ng review comments --------- Co-authored-by: m0wer <m0wer@sgn.space> Co-authored-by: Parth Bandwal <143504541+parrth20@users.noreply.github.com>
2026-05-05 13:52:41 +02:00
start_maker "https://localhost:32183" "Satoshi.jmdat" "test"