Sandbox & Testing Environments
Learning Objectives
Design a multi-environment progression appropriate for CBDC
Develop comprehensive test case categories covering all risk areas
Implement security testing protocols including penetration testing
Establish performance testing at appropriate scale multiples
Build resilience testing for disaster recovery scenarios
CBDC TESTING ENVIRONMENT PROGRESSION
DEV (Development)
├── Purpose: Active code development
├── Data: Synthetic test data
├── Access: Development team only
├── Stability: Unstable (constant changes)
├── Refresh: Continuous
└── Used for: Feature development, unit testing
INT (Integration)
├── Purpose: Component integration testing
├── Data: Synthetic, production-like structure
├── Access: Dev + QA teams
├── Stability: Relatively stable
├── Refresh: Weekly
└── Used for: API testing, integration validation
UAT (User Acceptance Testing)
├── Purpose: Business validation
├── Data: Anonymized production-like
├── Access: Business users, stakeholders
├── Stability: Stable (change-controlled)
├── Refresh: Per test cycle
└── Used for: Feature validation, user sign-off
STAGING
├── Purpose: Pre-production validation
├── Data: Production-equivalent (anonymized)
├── Access: Operations, limited dev
├── Stability: Production-like stability
├── Refresh: Matches production releases
└── Used for: Final verification, deployment practice
PILOT
├── Purpose: Controlled real-user testing
├── Data: Real user data (pilot participants)
├── Access: Real users (limited)
├── Stability: Production stability required
├── Refresh: Production cycle
└── Used for: Real-world validation
PRODUCTION
├── Purpose: Live service
├── Data: Real user data
├── Access: General public
├── Stability: Maximum stability required
├── Refresh: Controlled releases only
└── Used for: Actual CBDC operations
```
ENVIRONMENT MANAGEMENT PRINCIPLES
PRINCIPLE 1: PRODUCTION PARITY
├── Staging must mirror production exactly
├── Same configuration, same scale (or representative)
├── Same security controls
└── Different data only (anonymized)
PRINCIPLE 2: DATA ISOLATION
├── No production data in lower environments
├── Synthetic data must cover edge cases
├── Anonymization must be irreversible
└── PII never leaves production without anonymization
PRINCIPLE 3: ACCESS CONTROL
├── Least privilege access per environment
├── Production access strictly controlled
├── Audit logs for all environment access
└── Separate credentials per environment
PRINCIPLE 4: CONFIGURATION MANAGEMENT
├── Infrastructure as code
├── Version-controlled configuration
├── Automated provisioning
└── Consistent across environments
PRINCIPLE 5: PROMOTION PATH
├── Code flows one direction: Dev → Prod
├── Each promotion requires gate passage
├── No shortcuts (no direct Dev → Prod)
└── Rollback capability at each stage
```
CBDC TEST CATEGORY MATRIX
- FUNCTIONAL TESTING
- PERFORMANCE TESTING
- SECURITY TESTING
- RESILIENCE TESTING
- COMPLIANCE TESTING
CRITICAL CBDC TEST CASES
WALLET CREATION:
□ Create wallet with valid ID → Success
□ Create wallet with invalid ID → Reject with clear error
□ Create duplicate wallet → Prevent with clear message
□ Create wallet with KYC timeout → Handle gracefully
□ Create wallet in sanctioned jurisdiction → Block appropriately
TRANSACTION PROCESSING:
□ Transfer within limits → Complete in <3 seconds
□ Transfer exceeding balance → Reject immediately
□ Transfer exceeding daily limit → Reject with limit info
□ Concurrent transfers (race condition) → Handle correctly
□ Transfer during maintenance window → Queue appropriately
SECURITY SCENARIOS:
□ Brute force login attempt → Lock after N attempts
□ Session hijacking attempt → Detect and invalidate
□ API rate limit exceeded → Throttle appropriately
□ SQL injection attempt → Block, log, alert
□ Man-in-middle attempt → Detect, terminate
EDGE CASES:
□ Transfer of $0.01 → Handle without rounding errors
□ Transfer at exactly limit → Accept
□ Transfer at limit + $0.01 → Reject
□ Wallet at exact holding limit → Block further receipt
□ Simultaneous transactions → Process in correct order
FAILURE SCENARIOS:
□ Database unavailable → Fail gracefully, queue if possible
□ Payment network timeout → Retry with backoff
□ Partial system failure → Degrade gracefully
□ Complete outage → Display maintenance message
□ Recovery from outage → Reconcile all pending
```
CBDC SECURITY TESTING PROTOCOL
PRE-LAUNCH REQUIREMENTS:
EXTERNAL PENETRATION TEST
APPLICATION SECURITY ASSESSMENT
INFRASTRUCTURE SECURITY REVIEW
CRYPTOGRAPHIC REVIEW
RED TEAM EXERCISE
ONGOING REQUIREMENTS:
Continuous vulnerability scanning (weekly)
Quarterly penetration tests
Annual red team exercise
Bug bounty program (post-launch)
Security monitoring and alerting
Incident response testing (quarterly)
```
CBDC-SPECIFIC SECURITY SCENARIOS
FINANCIAL ATTACKS:
□ Double-spending attempt
□ Balance manipulation
□ Transaction replay
□ Race condition exploitation
□ Overflow/underflow attacks
IDENTITY ATTACKS:
□ Account takeover
□ Identity spoofing
□ KYC bypass attempts
□ Privilege escalation
□ Session fixation
CRYPTOGRAPHIC ATTACKS:
□ Key extraction attempts
□ Signature forgery
□ Timing attacks
□ Side-channel attacks
□ Quantum-resistance validation
INFRASTRUCTURE ATTACKS:
□ DDoS resilience
□ API abuse
□ Database injection
□ Network segmentation bypass
□ Cloud misconfiguration exploitation
PRIVACY ATTACKS:
□ Transaction tracing
□ User deanonymization
□ Metadata analysis
□ Data exfiltration
□ Inference attacks
```
CBDC PERFORMANCE REQUIREMENTS
TRANSACTION THROUGHPUT:
├── Target: Support expected peak × 10
├── Example: 1,000 TPS expected → Test 10,000 TPS
├── Sustain: For 1 hour minimum at 10x
└── Reality: Most retail CBDCs need 100-1,000 TPS
LATENCY:
├── P50 (median): <1 second
├── P95: <3 seconds
├── P99: <5 seconds
└── Measure: End-to-end user experience
AVAILABILITY:
├── Target: 99.99% (52 minutes downtime/year)
├── Measure: Including planned maintenance
├── Components: All user-facing services
└── Monitoring: Real-time, 24/7
CONCURRENT USERS:
├── Support: Expected peak × 5
├── Session management: No degradation
└── Database connections: Pooled, managed
RECOVERY:
├── RTO (Recovery Time Objective): <4 hours
├── RPO (Recovery Point Objective): <1 minute
└── Test: Quarterly DR exercises
```
LOAD TESTING METHODOLOGY
STEP 1: BASELINE
├── Test with minimal load
├── Establish performance baseline
├── Identify single-user metrics
└── Duration: 1 hour
STEP 2: NORMAL LOAD
├── Expected average load
├── Sustained operation
├── All features exercised
└── Duration: 24 hours
STEP 3: PEAK LOAD
├── Expected peak (highest hour)
├── All user types active
├── Background jobs running
└── Duration: 4 hours
STEP 4: STRESS TEST
├── 2x, 5x, 10x peak load
├── Identify breaking points
├── Observe degradation patterns
└── Duration: Until failure
STEP 5: SPIKE TEST
├── Sudden load increase
├── 0 → peak in minutes
├── Test auto-scaling
└── Duration: 30 minutes
STEP 6: ENDURANCE
├── Normal load sustained
├── Identify memory leaks
├── Observe long-term stability
└── Duration: 72+ hours
TOOLS:
├── JMeter, Gatling, k6
├── Realistic user scenarios
├── Distributed load generation
└── Production-equivalent environment
```
DR TESTING PROTOCOL
QUARTERLY DR DRILL:
Scenario 1: Database Failover
├── Simulate primary database failure
├── Observe automatic failover
├── Verify data consistency
├── Measure: Time to recovery
└── Target: <5 minutes
Scenario 2: Application Failover
├── Simulate application server failure
├── Observe load balancer response
├── Verify session handling
├── Measure: User impact
└── Target: Zero dropped transactions
Scenario 3: Region Failover
├── Simulate complete region outage
├── Activate DR region
├── Verify all services operational
├── Measure: RTO achievement
└── Target: <4 hours
Scenario 4: Data Restoration
├── Simulate data corruption
├── Restore from backup
├── Verify data integrity
├── Measure: RPO achievement
└── Target: <1 minute data loss
DOCUMENTATION:
├── Runbooks for each scenario
├── Decision trees for operators
├── Communication templates
├── Post-mortem process
└── Lessons learned integration
```
CHAOS ENGINEERING APPROACH
PRINCIPLE: "Break things on purpose to find weaknesses"
CHAOS EXPERIMENTS:
Infrastructure Chaos:
├── Kill random instances
├── Network partition simulation
├── DNS failures
├── Storage degradation
└── Clock skew injection
Application Chaos:
├── Memory pressure
├── CPU saturation
├── Thread pool exhaustion
├── Connection pool depletion
└── Slow dependencies
Dependency Chaos:
├── Database latency injection
├── Third-party service failures
├── Message queue delays
├── Cache invalidation
└── Certificate expiration
IMPLEMENTATION:
├── Start in non-production
├── Small blast radius initially
├── Expand gradually
├── Monitor closely
├── Have rollback ready
└── Document learnings
---
✅ Production parity matters: Issues caught in staging that mirrors production prevent production incidents.
✅ Security testing is non-negotiable: CBDC systems will be attacked. Testing must find vulnerabilities before attackers do.
✅ Performance testing prevents surprises: Systems that haven't been tested at scale fail at scale.
⚠️ How much testing is enough: There's no perfect answer—it's a risk-based judgment.
⚠️ Whether testing catches all issues: Production will always surface issues not found in testing.
🔴 Skipping security testing for speed: Launching with unaddressed vulnerabilities.
🔴 Testing at 1x instead of 10x: Systems need headroom for unexpected load.
🔴 Never testing disaster recovery: DR that hasn't been tested won't work when needed.
Assignment: Create a comprehensive test strategy document for a CBDC implementation.
- Environment progression with data strategy
- Test categories with coverage targets
- Security testing protocol
- Performance testing approach with targets
- DR testing schedule and scenarios
Time investment: 2-3 hours
Q1: At what multiple of expected peak should performance testing target?
A) 1x B) 2x C) 10x D) 100x
Answer: C
Q2: Minimum frequency for external penetration testing?
A) Weekly B) Monthly C) Quarterly D) Annually
Answer: C
Q3: Which environment should exactly mirror production?
A) Dev B) Integration C) UAT D) Staging
Answer: D
Q4: Target availability for CBDC systems?
A) 99% B) 99.9% C) 99.99% D) 100%
Answer: C
Q5: What is chaos engineering?
A) Random testing B) Deliberately breaking systems to find weaknesses C) Performance testing D) Security testing
Answer: B
End of Lesson 9
Key Takeaways
Six environments minimum
: Dev → Integration → UAT → Staging → Pilot → Production, with clear purpose for each.
Test at 10x scale
: Performance testing at expected peak isn't enough. Test at 10x to have headroom.
External security testing required
: Internal testing is necessary but insufficient. Third-party penetration testing catches what internal teams miss.
DR must be tested
: Disaster recovery plans that haven't been tested don't work. Quarterly DR drills are essential.
Chaos engineering builds resilience
: Deliberately breaking things in controlled ways reveals weaknesses before they cause incidents. ---