Overview
This page provides comprehensive examples and implementations for Solana-based policy configurations. These policies control Solana transaction signing and sending, including SOL transfers and SPL token operations. For general policy concepts and setup instructions, see the Policies Overview.Supported Solana Operations
Solana policies support the following operations:signSolTransaction
: To identify incoming signing transactions on the Solana networksendSolTransaction
: To identify incoming transactions that are signed and sent to the Solana networksignSolMessage
: To identify incoming messages to be signed by a Solana account
Supported Criteria Types
The following criteria types are available for Solana policies:solAddress
: Criterion for recipient addresses of native SOL transferssolValue
: Criterion for SOL value in lamports of native transferssplAddress
: Criterion for recipient token account addresses of SPL token transferssplValue
: Criterion for SPL token amounts being transferred, in units of the token decimalsmintAddress
: Criterion for token mint addresses of SPL token transferssolData
: Criterion for instruction parameters given an program IDLprogramId
: Criterion based on the program IDs of a transaction’s instructionssolNetwork
: Criterion based on the intended network of the transactionsolMessage
: Criterion based on the intended message to be signed
For detailed information about using
solData
criteria to validate Solana instruction parameters, see Solana Instruction Data Validation.SOL Transfer Policies
Allow SOL transfers only to known safe addresses
This policy restricts SOL transfers to a predefined list of trusted recipient addresses.sol-allowlist-policy.json
Block SOL transfers exceeding 1 SOL
This policy prevents any SOL transfers that exceed 1 SOL (1,000,000,000 lamports).sol-limit-policy.json
Restrict SOL transfers to trusted addresses under 5 SOL
This policy ensures SOL can only be sent to specific trusted addresses and limits transfers to 5 SOL maximum.trusted-sol-transfers-policy.json
SPL Token Transfer Policies
Only allow SPL token transfers for specific token mints
This policy restricts SPL token transfers to only specific token mint addresses (USDC and USDT in this example).spl-token-mint-policy.json
Allow USDC token transfers up to 100 USDC
This policy allows USDC transfers up to 100 USDC (100,000,000 considering 6 decimals).usdc-limit-policy.json
Allow transactions only if recipient token account address is allowlisted
This policy ensures SPL token transfers can only be sent to pre-approved token account addresses.spl-recipient-allowlist-policy.json
Advanced SPL token policy: USDT with amount and recipient restrictions
This comprehensive policy allows SPL token transfers only for USDC or USDT mints, with amounts between 100 and 10,000 tokens, and only to allowlisted recipient addresses.advanced-spl-policy.json
General Examples
SOL and USDC amount restrictions
This policy allows sending up to 2 SOL or 1000 USDC.sol-spl-combined-policy.json
Denylist malicious addresses
sol-denylist-policy.json
Limiting for large transfers
emergency-limits-policy.json
Allow only messages with custom prefix
This policy restricts message signing to only messages that start with “CDP:” prefix, helping prevent unauthorized message signing.custom-message-policy.json
Allow only transactions with specific program interactions
This policy rejects transactions that interact with programs outside of your allowed list (System Program and Token Program in this example).program-restriction-policy.json
Implementation Examples
Basic Solana policy creation
Key Considerations for Solana Policies
Token Decimals
When setting token amounts, remember to account for token decimals:- SOL: 9 decimals (1 SOL = 1,000,000,000 lamports)
- USDC: 6 decimals (1 USDC = 1,000,000 base units)
- USDT: 6 decimals (1 USDT = 1,000,000 base units)
Common Token Mint Addresses
- USDC:
EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
- USDT:
Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB
- Wrapped SOL:
So11111111111111111111111111111111111111112
Common Program Addresses
- System Program:
11111111111111111111111111111112
- Token Program:
TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
- Associated Token Program:
ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL
What to read next
- Policies Overview: Learn about general policy concepts and setup
- Solana IDL Policies: Learn about Solana IDL policies
- EVM Policies: Learn about EVM-specific policy examples
- v2 Server Wallet Security: Learn more about the security features of the CDP v2 Server Wallet
- v2 API Reference: Explore the API reference for CDP Policies