StateManager for persistent state and BundleStateManager for staging changes.
StateManager
StateManager is the persistent state store that holds:
- Account balances and nonces
- Stored blobs (for RISC-V program intents)
- Key-value storage
- Intents and their status
- Transaction history and receipts
Creating a State Manager
State Queries
Applying Changes
TheStateManager is immutable - changes are applied via BundleStateManager:
BundleStateManager
BundleStateManager is a staging area for batching state changes. It overlays modifications on top of a base StateManager without mutating it.
Creating a Bundle
Account Operations
Working with Blobs
Intent Management
Key-Value Storage
Transaction Storage
Serialization
BothStateManager and BundleStateManager support Borsh serialization:
StateManager Serialization
BundleStateManager Serialization
Complete Example
Here’s a complete example showing the state management workflow:See Also
- Transaction Execution - Use state managers with transaction processing
- Getting Started - Library setup and basic usage