Advanced Programmability
In previous chapters we've covered the basics of Move and Sui Storage Model. Now it's time to dive deeper into the advanced topics of Sui programmability. This chapter introduces more complex concepts, practices, and features of Move and Sui that are essential for building more sophisticated applications.
The sections are ordered so that each builds on what came before, but they also form a few mostly independent threads, and it is fine to follow the one you need right now:
-
The execution environment - what a program can learn about the transaction it runs in and the system around it, and how it communicates with the outside world: Sui Framework, Transaction Context, Module Initializer, Epoch and Time, Events, and Binary Canonical Serialization.
-
Storage at scale - from simple vector-based collections to dynamic fields, a primitive that attaches arbitrary data to objects and lifts static type and size limits: Collections, Wrapper Type, Dynamic Fields, Dynamic Object Fields, and Dynamic Collections.
-
Patterns of authority - Move's answer to access control: from owned objects acting as permissions to guarantees backed by the system, and features built on top of them: Capability, Witness, One Time Witness, Publisher, Display, and Hot Potato.
-
Assets and funds - fungible value and the two ways to hold it, as objects and as balances attached directly to an address: Balance and Coin and Address Balances.
-
Code evolution - what happens after the code ships: publishing new versions of a package, protecting shared state from old versions, and migrating data: Package Upgrades.
Many code samples in this chapter are written as tests, and use test-only helpers from the framework: tx_context::dummy() creates a placeholder transaction context, and std::unit_test::destroy consumes any value at the end of a test. We cover testing techniques in detail in the Testing chapter.