Skip to main content
Note: see the language section for more details. For context on Bitcoin transaction reinsertion, see the Bitcoin network support page
Use o.script_pubkey to match a destination on every network. Use o.address only when you want to match one network’s address format (where o is one output in bitcoin.tx.outputs).o.address uses the address format of the signWith account. A wallet can hold a testnet account on the same key as a mainnet account, and any user allowed to create wallet accounts can add one. A transaction signed with that testnet account shows tb1... addresses, and a deny on a bc1... address does not match them. The transaction still spends the key’s mainnet coins, so it can pay the address you meant to block. o.script_pubkey is the same on every network.Due to the nature of Bitcoin signing, which account signs does not change where a transaction runs. Its inputs decide that. A deny that matches one network’s address format misses the same destination when an account in another format signs. If you know every allowed destination, prefer an allow policy to a deny policy.

Allow signing Bitcoin transactions only to certain destinations, on every network

Match each output’s script against a list. The list must include the script of your change address, or the policy refuses transactions that return change.

Allow signing Bitcoin transactions ONLY if all outputs are being sent to a certain address

o.address matches one address format only. This policy also refuses a transaction signed with an account in another format, such as a testnet account.

Deny signing Bitcoin transactions to a certain address

Match the destination’s output script, as lowercase hex. For example, the address bc1qeln8v9chnchymmmgmad374z3qz598y3mh3ed4r has the script 0014cfe67617179e2e4def68df5b1f545100a853923b. To get the script for an address, use the scriptPubKey field from bitcoin-cli validateaddress, or your Bitcoin library.
Decode the address, then put the decoded bytes into the script for its type. Decoding drops the network prefix, so the mainnet and testnet addresses of one key have the same script.A P2PKH address and a P2WPKH address of the same key have different scripts. To block both, list both scripts.
To deny several destinations, match a list: bitcoin.tx.outputs.any(o, o.script_pubkey in ['<SCRIPT_1>', '<SCRIPT_2>']).

Deny signing Bitcoin transactions with testnet accounts

Outputs use the address format of the signWith account, so this policy matches any transaction signed with a testnet wallet account or private key. It blocks all testnet signing for the users it applies to.

Allow signing Bitcoin transactions restricting output values

Allow signing Bitcoin transactions only if ALL inputs are spending a particular UTXO (this key is only allowed to spend one input)

Cap the maximum fee

Deny if fee exceeds a threshold