Delivery vs Payment (DvP) is a securities settlement method that ensures the
transfer of securities occurs simultaneously with the transfer of payment. Both
legs of the transaction execute atomically: either both complete or neither
does.
The Problem
When you buy bonds (like commercial paper), traditionally two things need to happen:- You send money → Seller
- Seller sends bonds → You
The Solution
(DvP) “Delivery vs Payment” means both transfers happen at the exact same moment, or neither happens. It’s like a swap where both sides exchange simultaneously.DvP programThe DvP program settles the same exchange through
program-owned escrow instead of delegation. Each party funds its leg with a
plain token transfer, and the settlement authority cannot redirect proceeds.
This delegation pattern has no program dependency and works with mints that
carry Scaled UI Amount, which the program rejects.
Educational Reference ImplementationYou can use the source code of this
implementation to try an implementation of DvP locally.This guide provides a reference implementation for exploration and educational
purposes only. Do NOT use this code directly in production without:
- Comprehensive security audits
- Proper key management systems
- Regulatory compliance review
- Legal consultation
- Extensive testing and modifications
Why Solana for DvP?
How settlement on Solana compares with traditional securities settlement:| Aspect | Traditional (T+2) | Solana |
|---|---|---|
| Settlement Logic | Clearinghouses | Atomic transaction bundling |
| Settlement Time | 2 days | One transaction |
| Transaction Cost | Per-trade fees apply | <$0.01 |
| Settlement Risk | Sequential, both legs | None between the two legs |
| Finality | End of day | Under a second (see below) |
finalized roughly 150 milliseconds after its block is
produced. See settlement and finality for
what each commitment level means.
Architecture Overview
The DvP system consists of these core components:- Bond Token (Commercial Paper): Token-2022 with token extensions
- Settlement Currency: Standard USDC (existing SPL token)
- Settlement Agent: Orchestrates atomic swaps via delegated authority
- Whitelist System: Controls which addresses can hold bonds
Key Design Principles
- No Custom Programs: Uses only Token-2022 extensions and standard USDC
- Atomic Settlement: Single transaction ensures both transfers succeed or fail together
- Default Frozen State: Bonds require explicit whitelisting for regulatory compliance
- Delegated Authority: Settlement agent coordinates without taking custody
- Network State Communication: No point-to-point API connectivity required
Bond Token with Token-2022 Extensions
Token-2022 provides extensions that enable compliant securities issuance without custom programs:Essential Extensions for Bonds
- Default Account State Extension: Sets all new token accounts to frozen by default, requiring explicit whitelisting
- Metadata Extension: Stores bond details onchain (ISIN, maturity date, coupon rate, etc.)
- Permanent Delegate (optional): Allows authorized recovery or clawback if required by regulation
Authority Configuration
- Mint Authority: Issuer (controls supply creation)
- Freeze Authority: Settlement Agent (manages whitelist)
- Update Authority: Settlement Agent (can update metadata)
The frozen default state is critical for regulatory compliance. It ensures that
only explicitly whitelisted addresses can receive and hold the securities,
meeting KYC/AML requirements.
Complete DvP Implementation
The code below uses legacy@solana/web3.js 1.x with @solana/spl-token.
@solana/web3.js 1.x is no longer actively maintainedIt receives critical fixes only. Use Kit for new code. To migrate existing code, follow the Kit upgrade guide, or the web3.js v3 migration guide to keep the class-based API.To run this code, install 1.x with npm install @solana/web3.js@1. A plain npm install @solana/web3.js installs v3, which this code doesn’t run on.Project Setup
The implementation is a small TypeScript project with two files. Install the dependencies, pinning@solana/web3.js to 1.x (a plain install gets 3.x, which
this code doesn’t use), and start a local
Surfpool forked
from mainnet in a second terminal, since the usage example reads the mainnet
USDC mint:
npx tsx dvp-example.ts.
Setting Up the DvP Engine
First, create the core DvP engine class that handles all operations. Save it asdvp-engine.ts:
Complete Usage Example
Here’s a complete example demonstrating the entire DvP workflow. Save it asdvp-example.ts next to dvp-engine.ts:
Additional Features
The code in this section extends the DvP engine above and also uses legacy@solana/web3.js 1.x with @solana/spl-token.
@solana/web3.js 1.x is no longer actively maintainedIt receives critical fixes only. Use Kit for new code. To migrate existing code, follow the Kit upgrade guide, or the web3.js v3 migration guide to keep the class-based API.To run this code, install 1.x with npm install @solana/web3.js@1. A plain npm install @solana/web3.js installs v3, which this code doesn’t run on.Updating Metadata
The settlement agent (with update authority) can update metadata fields. Updating a field to a longer value grows the mint account, and the mint must stay rent exempt.createBondToken above funds 100 extra bytes of rent for this. If
you expect larger updates, increase METADATA_HEADROOM or transfer extra
lamports to the mint before the update.
Removing from Whitelist
Remove an investor’s ability to hold bonds by freezing their account using the built-inremoveFromWhitelist method:
Freezing vs BurningFreezing an account prevents transfers but preserves the account and balance.
For complete removal, you may want to first transfer bonds back to the issuer,
then freeze the account.
Multi-Party Settlement
For more complex scenarios involving multiple parties, you can bundle multiple transfers into a single atomic transaction:Transaction Size LimitsSolana transactions have a size limit (~1232 bytes). Each transfer instruction
adds ~200 bytes. For very large multi-party settlements, consider using
Address Lookup Tables to
compress account addresses and fit more transfers per transaction.The
v1 transaction format
raises the limit to 4096 bytes but removes Address Lookup Table support, so v1
settlements inline their addresses instead. Either way the runtime loads at most
64 accounts per transaction, or 96 for v1 once
SIMD-0596 activates.
Production Considerations
Before deploying to production, ensure you address:- Security: Professional key management infrastructure, multi-sig controls, comprehensive audits of the codebase
- Regulatory Compliance: Securities registration, KYC/AML systems, transfer restrictions, and legal framework
- Key Management: Professional custody solutions with proper backup and recovery procedures
- Transaction Processing: Priority fees, retry logic, confirmation handling, and RPC redundancy for reliable settlement execution
- Operations: Settlement scheduling, failed trade handling, reconciliation, and customer support
- Monitoring: Real-time tracking, alerting, and automated regulatory reporting
SPL Token LimitationSPL Token accounts can only have one delegate at a time. This means for
multi-party scenarios, you may need to design around this constraint by using
multiple sequential delegations or different architectural patterns.
Inspecting Account State
TheDvPEngine includes a helper to inspect token account state. This is useful
for verifying whitelist status, confirming settlement completion, debugging
transfer issues, and auditing account states.
Conclusion
Solana’s atomic transaction model and Token-2022 extensions provide a foundation for implementing compliant DvP settlements for securities. The combination of:- Atomic execution of both legs in one transaction
- Confirmation in under a second
- Transaction costs of a fraction of a cent
- Built-in compliance features (frozen defaults, metadata)
Related
- DvP program: the same exchange through program-owned escrow and a settlement authority, without delegations
- Choosing the cash leg: which cash instrument settles against the asset, and how it interacts with the mint’s controls
- Transfer hook: run additional compliance checks on every transfer
- Token ACL: allowlists and blocklists with permissionless thaw