Tutorial · Vaults · Testnet

Spend From a Named Vault: debitvaultbyname

Pay from one vault and keep the change staking in it. IronDivi, divi-cli, the Divi Desktop debug console and BoxWallet.

About 10 minutes · Checked 2026-10-23

1What debitvaultbyname does

debitvaultbyname is the owner's precise spend. You name one vault by its encoding, a destination and an amount. The wallet spends from that vault only, sends the amount to the destination, and puts the change back into the same vault, so the manager keeps staking the rest. Compare reclaimvaultfunds, which draws from any vault and sends the change to a plain address.

Use it to pay someone from staked coins without unstaking everything, or to shrink a vault by a known amount.

2IronDivi: debitvaultbyname

IronDivi 0.2.6 runs it the same way as Divi Core and prints the txid. From a 100-coin vault output:

irondivi-cli --testnet debitvaultbyname "yHZ7CNR7ArAMpgS9TnfH3Jf32knX56gLSw:y9ftHaoaJrp23wTjV2mHqxtT7Ni6jfUzXB" y6U6RPYdb3j8CVMt61ScDqzxi3NjPCrg2d 5
76c478980bfe384ed25151b57d15fa974c75b699d1e88d7404cc229205182796

The transaction has one input and two outputs: 5.0 to the destination and 94.99997 in a new vault output with the same two addresses, so the manager keeps staking it. The options and most errors are the ones in step 4; IronDivi's texts differ in two places:

more than the vault holds   → -6 Insufficient vault funds. Have 104.99997, need 100000.0000407
owner half not in this wallet → -5 Vault owner key is unknown: address=y9ft…UzXB

With receiver_pays the destination got 4.99997; with sweep_funds both outputs of that vault went to the destination as one 99.999935 output and nothing returned to the vault. These outputs are from IronDivi 0.2.6 on regtest, a private test chain.

3divi-cli: debitvaultbyname

divi-cli -testnet debitvaultbyname "y8PL1RQSCWYPnJAvhvs6ZwkxfwuB5Ut5Aj:yF5g4mEraodvfjdRE5VrWum9pSF9gMdssc" y1pWoPjW2qo64wN2Lc61mGSQpRsbJUpa4H 5
2dea1206cdf3c82156f72a3f92cca80b0baa0d274d6f8ef06c9fadaef10ef72f

That spent 5 from the 100-coin vault output funded in fund a vault. Look at the transaction in Explorer 2.0: 2dea1206…f72f ↗. One output pays the destination, the other is a new vault output with the same two addresses holding the remaining 94.99997. The manager's wallet picks the new output up on its own because it already knows the script from addvault.

Afterwards the owner's getcoinavailability true lists the vault with the new txid under Vaulted.AllVaults.

4Options and errors

The fourth argument takes the same options as reclaimvaultfunds:

OptionEffectTestnet txid
receiver_paysFee deducted from the amount sentc9b949b4…97c8
sweep_fundsAmount ignored; the whole selected vault input goes to the destination minus the fee, nothing returns to the vaultdaf4441a…b49e
metadata "comment" "to"Wallet-side notenot run

The sweep transaction had two inputs (both outputs of that vault) and one 9.9999576 output to the destination, so sweep_funds on a named vault is the clean way to close it entirely.

bad encoding                       → -5 Invalid Vault Encoding
bad destination                    → -5 Invalid DIVI address
unknown option                     → -8 Unknown option for reclaiming vault funds
owner half not in this wallet      → -5 Vault owner key is unknown: ownership=0 address=yF5g…dssc
more than the vault holds          → -6 Insufficient funds: 10000000000000(total requested) is greater than 5500000000(total available)
vault output unconfirmed or just spent → -4 Insufficient funds to meet coin selection algorithm requirements.

"Vault owner key is unknown" is also what the manager gets if it tries this command: the manager wallet does not hold the owner key, so the request is refused before any transaction is built.

5Divi Desktop debug console

On testnet (Settings → Advanced mode → Network → Testnet), open the Debug Console, unlock, and type:

debitvaultbyname "y8PL1RQSCWYPnJAvhvs6ZwkxfwuB5Ut5Aj:yF5g4mEraodvfjdRE5VrWum9pSF9gMdssc" y1pWoPjW2qo64wN2Lc61mGSQpRsbJUpa4H 5

6BoxWallet

~/.boxwallet/divi-cli -testnet debitvaultbyname "owner:manager" DEST 5

Trouble

You seeMeansDo
Vault owner key is unknownThis wallet is not the owner, or the encoding is reversedCheck which half is yours with decompose
Insufficient funds to meet coin selection algorithm requirements.The vault's outputs are unconfirmed or just spentWait one block

Still stuck? Ask the Divi chatbot.