This guide covers end-to-end (E2E) testing on Stellar's testnet and futurenet networks, which validate credential workflows in actual network conditions beyond local unit testing.
E2E tests ensure that:
- Credential issuance works on real Stellar networks
- Attestation flows complete correctly with network latency
- Verification operations succeed on-chain
- The system handles network failures gracefully
- Rust 1.70+
- Soroban CLI (v21.0+)
- Stellar CLI
- Node.js 18+ (for API server tests)
- Internet connection to reach Stellar RPC endpoints
- (Optional) Funded testnet account for deployment
stellar keys generate deployer --network testnet stellar account fund deployer --testnet
cd contracts/e2e_tests
cargo test --release -- --test-threads=1Set environment variable and run:
STELLAR_NETWORK=futurenet cargo test --release -- --test-threads=1STELLAR_NETWORK=standalone cargo testCreate .env file in project root:
# Network selection: testnet, futurenet, or standalone
STELLAR_NETWORK=testnet
# RPC endpoints (auto-detected from STELLAR_NETWORK)
STELLAR_RPC_URL=https://soroban-testnet.stellar.org
# Contract addresses (after deployment)
CONTRACT_QUORUM_PROOF=CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABSC4
CONTRACT_SBT_REGISTRY=CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABSC4
CONTRACT_ZK_VERIFIER=CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABSC4
# Deployer account (for network deployment)
DEPLOYER_SECRET_KEY=S...E2E tests run automatically on:
- Testnet: Every pull request before merging to main
- Canary: Daily on a schedule to catch network-specific issues
- Pre-production: Before release deployment
See .github/workflows/e2e.yml for automated test configuration.
- Ledger reachability
- RPC endpoint responsiveness
- Network passphrase verification
-
Issuance Flow
- Create new credential on-chain
- Verify credential storage in registry
- Confirm immutability
-
Attestation Flow
- Create quorum slice
- Collect attestations from multiple signers
- Validate multi-signature threshold
-
Verification Flow
- Submit verification query
- Process ZK proof (when implemented)
- Return verification result
- Network Latency: Inject delays to simulate real conditions
- Timeout Handling: Verify graceful failure on slow responses
- Retry Logic: Test exponential backoff and reconnection
- Rate Limiting: Validate behavior under RPC rate limits
- Check internet connectivity
- Verify Stellar RPC endpoint status: https://status.stellar.org
- Try futurenet as alternative:
STELLAR_NETWORK=futurenet cargo test
- Get testnet XLM: https://laboratory.stellar.org/#create-account
- Or use the Stellar CLI:
stellar account fund deployer --testnet
- These are transient network issues - tests retry automatically
- Check ledger availability:
soroban rpc get-ledger --rpc-url <RPC_URL>
- Testnet has rate limits (100 req/min per IP)
- Futurenet is more lenient for development
- Set
--test-threads=1to serialize requests
#[tokio::test]
async fn test_credential_issuance_e2e() {
let client = StellarE2EClient::new(Network::Testnet).unwrap();
// 1. Verify network is reachable
assert!(client.health_check().await.unwrap());
// 2. Perform test operations
let ledger = client.get_ledger().await.unwrap();
// 3. Assert expected outcomes
assert!(ledger["result"]["sequence"].is_number());
}- Testnet: Slower block times, useful for catching real-world delays
- Futurenet: Faster feedback, better for rapid testing
- Standalone: Instant finality, best for local development
Choose the network based on your testing needs:
- Development: Standalone
- Integration Testing: Futurenet
- Pre-release: Testnet + production simulation
- Network passphrase: "Test SDF Network ; September 2015"
- Block time: ~5 seconds
- Chain reset: Periodically (check Stellar docs)
- Best for: Realistic network conditions before mainnet
- Network passphrase: "Test SDF Future Network ; October 2022"
- Block time: ~2 seconds
- Stable chain: No resets expected
- Best for: Rapid development and experimentation
Enable detailed logging:
RUST_LOG=debug cargo test -- --nocapture --test-threads=1Check Stellar status: https://status.stellar.org
- Add contract deployment validation tests
- Implement automated network failure injection
- Set up canary deployments with E2E validation
- Create production smoke tests
For questions or issues, refer to Stellar Documentation.