Resources
Resource consumption metrics for Soroban transactions.
These metrics define the maximum resources a transaction can consume during execution. They are used to:
Calculate resource fees
Ensure network capacity limits aren't exceeded
Provide execution guarantees
Obtaining Resource Values
Always use simulation results when possible:
val simulation = server.simulateTransaction(tx)
// Extract from simulation's transactionDataContent copied to clipboard
Manual construction (testing only):
val resources = SorobanDataBuilder.Resources(
cpuInstructions = 1000000,
diskReadBytes = 5000,
writeBytes = 2000
)Content copied to clipboard
Resource Limits
Each resource has network-level limits:
CPU Instructions: ~100M per transaction (varies by network)
Disk Read: ~200KB per transaction
Write: ~100KB per transaction
Exceeding these limits causes transaction failure.