Tutorial · Vaults · Testnet

Spend From a Named Vault: debitvaultbyname

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

About 10 minutes · Checked 2026-10-21

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: not implemented

IronDivi 0.2.6 accepts the command but refuses to run it:

irondivi-cli --testnet debitvaultbyname "yC9jjkQGrQnZFExYR8UYgjCpJeD7gJRVF4:y3D2yvmLTwP3Jatsbs7GnqNzEEzkUmSi2a" y1pWoPjW2qo64wN2Lc61mGSQpRsbJUpa4H 1
error code: -1: debitvaultbyname not yet implemented. This command requires coinstake creation, which is outside the current scope. The vault manager can ONLY spend vault funds via coinstake transactions (OP_REQUIRE_COINSTAKE enforces this). …

The message is misleading: on Divi Core this is an owner command and needs no coinstake. Until IronDivi implements it, run the Divi Core version below with the same owner key, or use reclaimvaultfunds and fund the vault again with what is left.

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
debitvaultbyname not yet implemented (IronDivi)Missing in IronDivi 0.2.6Use Divi Core with the owner key, or reclaim and re-fund
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.