When to Use
Use this skill when a bot, treasury job, or ops runbook is about to move a
material amount of crypto to an external destination — treasury rebalancing, cold
storage movements, exchange deposits, OTC settlement, or multi-signature
disbursements — and you want a gate that refuses to release the primary payload
until a dust test transfer has actually demonstrated the destination is correct.
TransferVerificationEngine is a local, in-process gate that runs before your
signing code. It performs no network I/O. Every on-chain fact it reasons about —
confirmation depth, the recipient the dust actually landed at, the chain it landed
on — is supplied by the caller, who is responsible for having read it from a
trusted source. It produces an auditable record of why a transfer was or was not
authorised.
When NOT to Use
- As the enforcer. Fireblocks, BitGo, Coinbase Custody, or your Safe policy
module remain authoritative. If the custody platform refuses the transfer, that
refusal stands regardless of what this engine returned. Configure the
platform's own whitelist and approval quorum first; this gate is the layer that
fails before a signed payload leaves your infrastructure.
- As proof that an address is correct. A test transfer is a detection
control, not a guarantee. Fireblocks documents malware that lets the initial
test transfer succeed and then swaps the deposit address before the main
transfer, and notes that the messaging channels used to confirm receipt are
themselves subject to spoofing and man-in-the-middle attacks. This skill
reduces destination risk; it does not eliminate it.
- With
require_counterparty_receipt=False, for anything you care about.
That setting downgrades the gate to confirmation depth alone, which does not
detect a wrong destination address at all (see the first pitfall below). It
exists for destinations you control on both ends and where an out-of-band
attestation is meaningless, not as a convenience.
- With
allow_bypass_for_whitelisted=True as a default posture. That flag
skips the test transfer entirely for whitelisted recipients at any notional. A
previously used address is not evidence of a safe address.
- As a substitute for signer quorum. This gate verifies a destination. It
does not collect or verify human approvals — see
multi-signature-approval-for-large-transfers.
Prerequisites
- Python 3.10+. Standard library only; no third-party dependencies.
- A trusted way to read back, for a broadcast transaction hash, the recipient
address, the chain, the transferred amount, and the current confirmation depth
— a node RPC, a block explorer API, or your custody provider's transaction
endpoint. This module does not query any of them. It consumes what you pass
it, so a caller that echoes back the address it intended to send to, instead
of the one the chain actually recorded, defeats the entire control.
- An approved recipient whitelist, sourced from your HSM/MPC address book rather
than from application config.
- A defined Approved Communication Channel for counterparty receipt confirmation
(CCSS v9
1.05.8.1) — a callback to a pre-registered number, a signed message,
or an authenticated ticket, not an inbound chat message.
Workflow
- Configure policy. Instantiate
VerificationConfig with
large_transfer_threshold_usd, test_expiry_window_minutes, and
require_counterparty_receipt (leave it True). The threshold comparison is
>=, so a transfer exactly at the threshold is treated as large.
- Register assets. One
AssetConfig per asset, giving chain,
min_confirmations, test_amount, and requires_destination_tag. Set
min_confirmations from your custodian's published requirement, not from a
remembered default — venues differ materially for the same asset, and on
chains with deterministic finality the number means something different
entirely. See references/standards.md.
- Initiate. Submit a
TransferRequest to initiate_transfer_request(). It
validates the notional (rejecting NaN/infinite/negative outright rather than
comparing them), checks whitelist membership, and enforces destination tags.
Below threshold returns NOT_REQUIRED; at or above it returns TEST_PENDING.
- Broadcast the dust transfer, then read the transaction back from the
chain and pass what you read to
record_test_transaction() as
observed_recipient, observed_chain, and observed_amount. If any of the
three disagrees with the request, the engine raises
TestTransactionMismatchError — do not catch it and retry. A mismatch means
the dust went somewhere other than where the primary transfer is going, so
the test has verified nothing and the discrepancy needs a human.
- Track depth. Poll the chain and call
update_test_confirmations(). The
expiry clock is latched at the first crossing of min_confirmations and is
never refreshed by later polls. If depth drops below the requirement — what
a re-org looks like from the caller's side — the engine reverts the test to
TEST_PENDING and clears the latch, so the window restarts from the
re-confirmation.
- Obtain and record the counterparty receipt. Contact the recipient over the
Approved Communication Channel, have them confirm the dust arrived in their
account, and record it with
acknowledge_test_receipt(attested_by, channel).
This is the step that makes the test a control; step 5 on its own is not one.
- Authorise. Call
verify_and_authorize_large_transfer(). It re-checks the
test-to-request binding, whitelist membership at this moment (revocations
land immediately, including for in-flight requests), live confirmation depth,
the receipt, and the expiry window. Authorisation is single-use — a second
call raises, so one dust test cannot authorise a series of transfers.
Common Pitfalls
- Treating confirmation depth as destination verification. This is the
central mistake. A dust transfer to a typo'd or clipboard-poisoned address
reaches 12 confirmations exactly as reliably as one to the correct address.
Depth proves the network accepted a transfer to whatever address was in it and
nothing more. Only the recipient confirming arrival out of band — CCSS v9
1.05.8.1, "Verification of fund destinations and amounts is performed via
Approved Communication Channels prior to the use of key material" — actually
tests the address.
- Recording the intended address instead of the observed one. Passing the
same variable you built the transfer from into
observed_recipient turns the
binding check into a tautology. Read it back from the chain.
- Letting a monitoring loop refresh the expiry clock. If the confirmation
poller restarts the time-decay window on every update, the window never
expires and a test transfer confirmed hours ago still authorises a transfer.
Latch it once, at first confirmation.
- Case-folding addresses to normalise them. ERC-55 capitalisation is a
checksum, so EVM addresses are safe to lowercase — but Base58Check (Bitcoin
legacy, XRP), Solana base58, and TON base64 are case-sensitive. Lowercasing
those collapses distinct addresses onto one whitelist key, so the whitelist
starts approving addresses nobody whitelisted.
- Comparing an unvalidated USD notional against the threshold.
float('nan') >= 50_000 is False under IEEE-754, so a price feed that
returns no quote silently classifies a large transfer as small and authorises
it directly. Validate before comparing.
- Omitted destination memos/tags. XRP, XLM, TON, and EOS use a tag or memo to
route deposits into the right customer account at a shared custodian address.
An XRPL account can set the
RequireDest flag to reject untagged payments, but
it is opt-in — without it the payment succeeds on-chain and simply arrives
uncredited. Note that BNB is no longer in this category: the memo-bearing
BNB Beacon Chain (BEP-2) halted on 2024-11-19, and BEP-20 on BNB Smart Chain is
EVM and uses no memo.
- Re-verifying nothing at the authorisation gate. Whitelists get revoked and
chains re-org between initiation and release. Checks made minutes ago are not
evidence about now.
- Sending to a whitelisted address on the wrong network. An address approved
for Ethereum and used on Arbitrum is a permanent loss, and the whitelist alone
will not catch it — the chain must be part of the binding.
Verification
python -m unittest discover -s skills/test-transaction-verification-before-large-transfers/scripts
The suite covers threshold boundaries (exactly at, just below), NaN/infinite/
negative notional rejection, case-sensitivity of Base58 versus EVM versus bech32
whitelist keys, test-transaction binding to recipient/chain/amount, the
counterparty-receipt requirement, expiry-window latching under sustained polling,
re-org depth regression and re-confirmation, single-use authorisation, and
whitelist revocation of an in-flight request.
Related Skills
multi-signature-approval-for-large-transfers
exchange-withdrawal-whitelist-enforcement
air-gapped-signing-workflow-for-cold-storage
crypto-wallet-key-custody-security
withdrawal-velocity-limits-and-anomaly-detection
1---2name: test-transaction-verification-before-large-transfers3description: >-4 Use before releasing a high-value crypto transfer, requiring a dust test bound to the5 same recipient, chain and amount plus an out-of-band counterparty receipt, so a wrong6 address costs cents rather than the notional.7license: Apache-2.08metadata:9 source: https://skillmd.com/skills/himanshuj16/test-transaction-verification-before-large-transfers10 domain: algorithmic-trading11 subdomain: crypto-custody-security12 tags: crypto-custody, test-transaction, dust-verification, treasury, address-whitelisting, destination-tag, confirmation-depth, spend-verification13 brokers_frameworks: "Fireblocks; BitGo; Coinbase Custody; Safe{Wallet} Smart Account; CCSS v9; Python Dataclasses"14 version: "2.0.0"15 author: algo-trading-skills-contributors16---1718## When to Use1920Use this skill when a bot, treasury job, or ops runbook is about to move a21material amount of crypto to an external destination — treasury rebalancing, cold22storage movements, exchange deposits, OTC settlement, or multi-signature23disbursements — and you want a gate that refuses to release the primary payload24until a dust test transfer has actually demonstrated the destination is correct.2526`TransferVerificationEngine` is a **local, in-process gate that runs before your27signing code**. It performs no network I/O. Every on-chain fact it reasons about —28confirmation depth, the recipient the dust actually landed at, the chain it landed29on — is supplied by the caller, who is responsible for having read it from a30trusted source. It produces an auditable record of why a transfer was or was not31authorised.3233## When NOT to Use3435- **As the enforcer.** Fireblocks, BitGo, Coinbase Custody, or your Safe policy36 module remain authoritative. If the custody platform refuses the transfer, that37 refusal stands regardless of what this engine returned. Configure the38 platform's own whitelist and approval quorum first; this gate is the layer that39 fails *before* a signed payload leaves your infrastructure.40- **As proof that an address is correct.** A test transfer is a *detection*41 control, not a guarantee. Fireblocks documents malware that lets the initial42 test transfer succeed and *then* swaps the deposit address before the main43 transfer, and notes that the messaging channels used to confirm receipt are44 themselves subject to spoofing and man-in-the-middle attacks. This skill45 reduces destination risk; it does not eliminate it.46- **With `require_counterparty_receipt=False`, for anything you care about.**47 That setting downgrades the gate to confirmation depth alone, which does not48 detect a wrong destination address at all (see the first pitfall below). It49 exists for destinations you control on both ends and where an out-of-band50 attestation is meaningless, not as a convenience.51- **With `allow_bypass_for_whitelisted=True` as a default posture.** That flag52 skips the test transfer entirely for whitelisted recipients at any notional. A53 previously used address is not evidence of a safe address.54- **As a substitute for signer quorum.** This gate verifies a *destination*. It55 does not collect or verify human approvals — see56 `multi-signature-approval-for-large-transfers`.5758## Prerequisites5960- Python 3.10+. Standard library only; no third-party dependencies.61- A trusted way to read back, for a broadcast transaction hash, the recipient62 address, the chain, the transferred amount, and the current confirmation depth63 — a node RPC, a block explorer API, or your custody provider's transaction64 endpoint. **This module does not query any of them.** It consumes what you pass65 it, so a caller that echoes back the address it *intended* to send to, instead66 of the one the chain actually recorded, defeats the entire control.67- An approved recipient whitelist, sourced from your HSM/MPC address book rather68 than from application config.69- A defined Approved Communication Channel for counterparty receipt confirmation70 (CCSS v9 `1.05.8.1`) — a callback to a pre-registered number, a signed message,71 or an authenticated ticket, not an inbound chat message.7273## Workflow74751. **Configure policy.** Instantiate `VerificationConfig` with76 `large_transfer_threshold_usd`, `test_expiry_window_minutes`, and77 `require_counterparty_receipt` (leave it `True`). The threshold comparison is78 `>=`, so a transfer exactly at the threshold is treated as large.792. **Register assets.** One `AssetConfig` per asset, giving `chain`,80 `min_confirmations`, `test_amount`, and `requires_destination_tag`. Set81 `min_confirmations` from **your custodian's published requirement**, not from a82 remembered default — venues differ materially for the same asset, and on83 chains with deterministic finality the number means something different84 entirely. See `references/standards.md`.853. **Initiate.** Submit a `TransferRequest` to `initiate_transfer_request()`. It86 validates the notional (rejecting NaN/infinite/negative outright rather than87 comparing them), checks whitelist membership, and enforces destination tags.88 Below threshold returns `NOT_REQUIRED`; at or above it returns `TEST_PENDING`.894. **Broadcast the dust transfer**, then **read the transaction back from the90 chain** and pass what you read to `record_test_transaction()` as91 `observed_recipient`, `observed_chain`, and `observed_amount`. If any of the92 three disagrees with the request, the engine raises93 `TestTransactionMismatchError` — do not catch it and retry. A mismatch means94 the dust went somewhere other than where the primary transfer is going, so95 the test has verified nothing and the discrepancy needs a human.965. **Track depth.** Poll the chain and call `update_test_confirmations()`. The97 expiry clock is latched at the *first* crossing of `min_confirmations` and is98 never refreshed by later polls. If depth *drops* below the requirement — what99 a re-org looks like from the caller's side — the engine reverts the test to100 `TEST_PENDING` and clears the latch, so the window restarts from the101 re-confirmation.1026. **Obtain and record the counterparty receipt.** Contact the recipient over the103 Approved Communication Channel, have them confirm the dust arrived in *their*104 account, and record it with `acknowledge_test_receipt(attested_by, channel)`.105 This is the step that makes the test a control; step 5 on its own is not one.1067. **Authorise.** Call `verify_and_authorize_large_transfer()`. It re-checks the107 test-to-request binding, whitelist membership *at this moment* (revocations108 land immediately, including for in-flight requests), live confirmation depth,109 the receipt, and the expiry window. Authorisation is **single-use** — a second110 call raises, so one dust test cannot authorise a series of transfers.111112## Common Pitfalls113114- **Treating confirmation depth as destination verification.** This is the115 central mistake. A dust transfer to a typo'd or clipboard-poisoned address116 reaches 12 confirmations exactly as reliably as one to the correct address.117 Depth proves the network accepted a transfer to whatever address was in it and118 nothing more. Only the recipient confirming arrival out of band — CCSS v9119 `1.05.8.1`, "Verification of fund destinations and amounts is performed via120 Approved Communication Channels prior to the use of key material" — actually121 tests the address.122- **Recording the intended address instead of the observed one.** Passing the123 same variable you built the transfer from into `observed_recipient` turns the124 binding check into a tautology. Read it back from the chain.125- **Letting a monitoring loop refresh the expiry clock.** If the confirmation126 poller restarts the time-decay window on every update, the window never127 expires and a test transfer confirmed hours ago still authorises a transfer.128 Latch it once, at first confirmation.129- **Case-folding addresses to normalise them.** ERC-55 capitalisation is a130 checksum, so EVM addresses are safe to lowercase — but Base58Check (Bitcoin131 legacy, XRP), Solana base58, and TON base64 are case-**sensitive**. Lowercasing132 those collapses distinct addresses onto one whitelist key, so the whitelist133 starts approving addresses nobody whitelisted.134- **Comparing an unvalidated USD notional against the threshold.**135 `float('nan') >= 50_000` is `False` under IEEE-754, so a price feed that136 returns no quote silently classifies a large transfer as small and authorises137 it directly. Validate before comparing.138- **Omitted destination memos/tags.** XRP, XLM, TON, and EOS use a tag or memo to139 route deposits into the right customer account at a shared custodian address.140 An XRPL account can set the `RequireDest` flag to reject untagged payments, but141 it is opt-in — without it the payment succeeds on-chain and simply arrives142 uncredited. Note that **BNB is no longer in this category**: the memo-bearing143 BNB Beacon Chain (BEP-2) halted on 2024-11-19, and BEP-20 on BNB Smart Chain is144 EVM and uses no memo.145- **Re-verifying nothing at the authorisation gate.** Whitelists get revoked and146 chains re-org between initiation and release. Checks made minutes ago are not147 evidence about now.148- **Sending to a whitelisted address on the wrong network.** An address approved149 for Ethereum and used on Arbitrum is a permanent loss, and the whitelist alone150 will not catch it — the chain must be part of the binding.151152## Verification153154```bash155python -m unittest discover -s skills/test-transaction-verification-before-large-transfers/scripts156```157158The suite covers threshold boundaries (exactly at, just below), NaN/infinite/159negative notional rejection, case-sensitivity of Base58 versus EVM versus bech32160whitelist keys, test-transaction binding to recipient/chain/amount, the161counterparty-receipt requirement, expiry-window latching under sustained polling,162re-org depth regression and re-confirmation, single-use authorisation, and163whitelist revocation of an in-flight request.164165## Related Skills166167- `multi-signature-approval-for-large-transfers`168- `exchange-withdrawal-whitelist-enforcement`169- `air-gapped-signing-workflow-for-cold-storage`170- `crypto-wallet-key-custody-security`171- `withdrawal-velocity-limits-and-anomaly-detection`