℈Scruple Docs v0.1.0-alpha.1

Multisig

Multisig

Create native M-of-N SQIsign vaults and spend them with offline cosigning—no Script VM.

Native consensus feature

xsl2: is an address version, not a script. Multisig spending is enforced by the signature validator: the transaction must carry a threshold of valid SQIsign signatures from the canonical cosigner set. Up to 15 cosigners are supported.

How xsl2 vaults work

A v2 address commits to a threshold and a strictly ascending list of SQIsign public keys:

addr_hash = BLAKE3(
  "scruple-addr-v2"
  || u8(threshold)
  || u8(N)
  || pubkeys[0] || ... || pubkeys[N-1]
)

The resulting address is encoded as legacy xsl2:<64-hex> or checksummed Bech32m (xsl1z... mainnet, txsl1z... testnet, dxsl1z... devnet). The wire authorization entry for a v2 spend contains the threshold, the canonical public-key list, and exactly threshold signatures with strictly ascending signer indices. A 2-of-3 authorization occupies about 607 bytes.

RuleValue
Threshold1 <= threshold <= N
Cosigners1 <= N <= 15
Public key orderStrictly ascending lexicographic byte order
Signature countExactly threshold, with strictly ascending signer indices
Auth size4 + 83*N + 177*M bytes, where M = threshold
Script VMNone

Create a vault address

Each cosigner creates a wallet and exports the 83-byte public key for the agreed HD index:

./target/release/scruple wallet new --wallet alice.json
./target/release/scruple wallet new --wallet bob.json
./target/release/scruple wallet new --wallet carol.json

PK_A=$(./target/release/scruple wallet pubkey --wallet alice.json --index 0)
PK_B=$(./target/release/scruple wallet pubkey --wallet bob.json --index 0)
PK_C=$(./target/release/scruple wallet pubkey --wallet carol.json --index 0)

VAULT=$(./target/release/scruple multisig address \
  --threshold 2 \
  --pubkey "$PK_A" --pubkey "$PK_B" --pubkey "$PK_C")

echo "2-of-3 vault: $VAULT"
FlagDescription
--threshold <M>Required signature threshold. Must satisfy 1 <= M <= N <= 15.
--pubkey <HEX>Repeatable 83-byte SQIsign public key (166 hex characters). The command sorts keys canonically.
--network <NETWORK>Emit a checksummed Bech32m address for mainnet, testnet, or devnet instead of legacy xsl2: hex.
Verify the vault out-of-band

Every cosigner should independently run multisig address with the same public keys and threshold, then compare the resulting address out-of-band. A malicious or mistaken key list produces a different vault and can lock funds away from the intended signers.

Fund the vault

Send to the vault from any wallet, or mine directly into it:

# Send from a regular wallet
./target/release/scruple send \
  --data-dir ./data --rpc 127.0.0.1:18332 \
  --wallet alice.json \
  --to "$VAULT" --amount 1.0 --fee-rate 1

# Or mine directly to the vault
./target/release/scruple mine \
  --data-dir ./data --rpc 127.0.0.1:18332 \
  --to "$VAULT" --blocks 3

Coinbase outputs mined to a vault are subject to the usual coinbase maturity before they can be spent.

Propose an unsigned spend

The proposal queries mature vault UTXOs from a node, selects coins, and writes an unsigned PartialTx JSON file. Change returns to the vault.

./target/release/scruple multisig propose \
  --data-dir ./data --rpc 127.0.0.1:18332 \
  --threshold 2 \
  --pubkey "$PK_A" --pubkey "$PK_B" --pubkey "$PK_C" \
  --to <RECIPIENT_XSL1_OR_XSL2> \
  --amount 0.4 \
  --fee 0.001 \
  --out partial.json
FlagDescription
--threshold <M>Vault threshold. Must match the funded address.
--pubkey <HEX>Repeatable cosigner public keys. Must match the vault.
--to <ADDR>Recipient address (Bech32m or legacy).
--amount <XSL>Amount in XSL, up to 8 decimals. Omit with --send-max.
--send-maxSweep all selected or mature vault UTXOs minus fee into one output.
--fee-rate <GR/B>Fee rate in grains per serialized byte. Defaults to 1.
--fee <XSL>Explicit fee override, floored at exact bytes × fee rate.
--out <PATH>Output path for the unsigned PartialTx JSON.
--coin <HEIGHT:TX:OUT>Repeatable explicit vault UTXO selection.
--exclude <HEIGHT:TX:OUT>Repeatable outpoint exclusion.
--ignore-pendingIgnore tracked pending multisig outpoints in <data-dir>/pending-multisig.json.

Proposals track pending vault outpoints in <data-dir>/pending-multisig.json so a second proposal does not accidentally spend the same UTXO. Pending entries are cleared automatically once the spend confirms. Use --exclude to skip a specific UTXO, or --ignore-pending when an older draft was abandoned.

Cosign offline

Any threshold of matching cosigners can sign the JSON file without a node connection:

./target/release/scruple multisig sign \
  --in partial.json \
  --wallet alice.json \
  --out partial.json

./target/release/scruple multisig sign \
  --in partial.json \
  --wallet carol.json \
  --out partial.json
FlagDescription
--in <PATH>Input PartialTx JSON path.
--wallet <PATH>Cosigner wallet file. The signer must control at least one key in the vault.
--out <PATH>Output path for the updated JSON. Defaults to updating the input in place.

The signer adds its signature to the partial transaction. Duplicate signatures for the same key are avoided, and the finalize step verifies the threshold and canonical ordering.

Air-gapped signing

Move partial.json to an offline machine, sign with the cosigner wallet there, and move it back. The signature covers a reorg-safe sighash that commits to every spent UTXO and output amount, protecting offline signers from fee-drain attacks.

Finalize and broadcast

After collecting the threshold signatures, verify the partial transaction, assemble the canonical Transaction, and optionally broadcast it:

./target/release/scruple multisig finalize \
  --in partial.json \
  --broadcast \
  --data-dir ./data \
  --rpc 127.0.0.1:18332
FlagDescription
--in <PATH>Input PartialTx JSON with collected signatures.
--broadcastSubmit the finalized transaction to a running node via submit_tx.
--fast-fluffBypass Dandelion++ stem delay when broadcasting.
--data-dir <PATH>Reads <data-dir>/.cookie when broadcasting.
--rpc <ADDR>Node RPC address.

Finalization fails if the collected signatures do not meet the threshold, if any signature is invalid, or if the canonical auth ordering does not match the spent address set. On success, the command prints the final transaction and, when broadcasting, the node's submit_tx response.

Spending rules and edge cases

  • A transaction may mix xsl1: and xsl2: inputs. Each unique spent address requires exactly one matching TxAuth entry.
  • Spending multiple UTXOs from the same vault requires only one multisig authorization entry.
  • The canonical public-key list is sorted lexicographically; cosigners must use the same set and threshold or the address will not match.
  • The threshold signatures must come from distinct signer indices in strictly ascending order.
  • Change from a vault spend returns to the same vault by default, preserving the M-of-N policy.
  • Pending vault outpoints are tracked per vault address hash in pending-multisig.json.
  • Coinbase maturity applies to vault outputs mined directly to xsl2:.

GUI multisig

The desktop GUI's Multisig / Cosign tab supports vault derivation, PartialTx sign/merge/finalize/broadcast, and pending outpoint tracking. It is convenient for cosigners who prefer not to use the CLI. See Desktop GUI.

Security checklist

  • Verify the vault address independently on every cosigner machine.
  • Back up each cosigner's 24-word phrase separately; losing more than N - M keys can make the vault unspendable.
  • Keep cosigner wallets encrypted and offline when not signing.
  • Review the recipient address and amount in the PartialTx before signing; the sighash commits to the full spend, but a human should still verify intent.
  • Do not reuse a stale proposal after a conflicting spend confirms; check pending outpoints and the node's UTXO set.
  • Broadcast through a synced node and confirm the transaction appears in the mempool before considering the spend complete.

Scruple Docs · v0.1.0-alpha.1 · Mainnet candidate

Scruple is alpha software. Verify commands against --help and the protocol specification before relying on them.