| name | cauldron-swap |
| description | Swap between BCH and PUSD (ParyonUSD stablecoin) using the cashtoken-cli and Cauldron DEX on Bitcoin Cash. Covers buying PUSD with BCH, selling PUSD back to BCH, and checking balances. |
Cauldron DEX Swaps (BCH ↔ PUSD)
Swap between BCH and the PUSD stablecoin (ParyonUSD) on Bitcoin Cash using the Cauldron DEX. The CLI handles pool discovery, optimal multi-pool trade splitting, quoting, and broadcast.
CLI Location
/home/bot/repos/cashtoken-cli/cashtoken-cli.js
Always run from the repo directory:
cd /home/bot/repos/cashtoken-cli
Configuration
Wallet credentials are stored in .env:
cat /home/bot/repos/cashtoken-cli/.env
Set PRIVATE_KEY_WIF and NETWORK there, or pass --wif <WIF> at runtime. The token-aware address is auto-derived from the WIF.
PUSD Token Details
| Field | Value |
|---|
| Token ID | 2469acc5afa4b10cb5b5c04afb89c3a3ffd61c5da9c01e26d00951cae2a02544 |
| Decimals | 2 (1 PUSD = 100 base units) |
| Type | Stablecoin (1:1 USD peg) |
Available Commands
Check Balance
node cashtoken-cli.js balance --wif <WIF>
Buy PUSD with BCH (recommended — uses dollar amounts)
node cashtoken-cli.js buy-pusd --amount 1 --wif <WIF>
node cashtoken-cli.js buy-pusd --amount 1 --wif <WIF> --yes
Sell PUSD for BCH (recommended — uses dollar amounts)
node cashtoken-cli.js sell-pusd --amount 1 --wif <WIF>
node cashtoken-cli.js sell-pusd --amount 1 --wif <WIF> --yes
Generic Swap (any CashToken)
node cashtoken-cli.js swap-bch-for-token \
-c <64-char-token-id> \
-a <base-units> \
--ticker <SYMBOL> \
--wif <WIF> \
--yes
node cashtoken-cli.js swap-token-for-bch \
-c <64-char-token-id> \
-a <base-units> \
--ticker <SYMBOL> \
--wif <WIF> \
--yes
Typical Round-Trip Procedure
1. Check Balance
cd /home/bot/repos/cashtoken-cli && node cashtoken-cli.js balance --wif <WIF>
2. Buy PUSD
cd /home/bot/repos/cashtoken-cli && node cashtoken-cli.js buy-pusd --amount <Dollars> --wif <WIF> --yes
3. Verify PUSD received
cd /home/bot/repos/cashtoken-cli && node cashtoken-cli.js balance --wif <WIF>
4. Sell PUSD back to BCH
cd /home/bot/repos/cashtoken-cli && node cashtoken-cli.js sell-pusd --amount <Dollars> --wif <WIF> --yes
5. Verify BCH returned
cd /home/bot/repos/cashtoken-cli && node cashtoken-cli.js balance --wif <WIF>
How It Works
buy-pusd/sell-pusd hardcode the PUSD token category ID and convert dollar amounts to base units automatically (multiply by 10^decimals = 100)
- The commands fetch all active Cauldron liquidity pools from the Cauldron indexer
- The SDK computes the optimal trade split across pools using binary search on marginal rate — minimizes price impact
- Each pool charges 0.3% LP fee
- Without
--yes, the command shows a quote and exits (dry-run mode)
- With
--yes, it broadcasts the transaction and returns the TXID
Notes
- Dry-run by default: Always verify the quote before passing
--yes
- Dust amount: Token outputs require ~1000 satoshis dust (handled automatically)
- Amount precision: PUSD has 2 decimals, so
--amount 1 = 100 base units = $1 PUSD
- No Cauldron fee: Only 0.3% LP fee paid to pool providers, plus BCH network fee
- WIF can be omitted if
PRIVATE_KEY_WIF is set in the .env file