Move: A Safe, Cross-Platform Language for Programming With Assets
Sam Blackshear
Working on Sui blockchain + Move @ Mysten Labs
Joint work with collaborators at Mysten, Aptos, Meta, Stanford, Waterloo, 0L, StarCoin
Agenda
Smart contract safety is an existential threat to broader crypto adoption
What is a smart contract language, and how does it fit into a blockchain?
Blockchain = replicated state machine
Replicas (“validators”) must agree on State 0 (“genesis”), tx order (“consensus”), and function f(State, Transaction) -> State
How does a language fit into a blockchain?
Smart contract =
executable code inside state
Tx = main() + args
f = language semantics
Must-have properties of a smart contract language
No conventional language has all three.
Smart contracts are unconventional programs
Smart contracts really only do three things:
Thus, need language support for
Not common tasks in conventional languages
Not supported well by existing SC languages
In other smart contract langs, you typically cannot:
Assets, ownership are the fundamental building blocks of smart contracts, but there’s no vocabulary for describing them!
Opinion: Solidity/EVM network effects over-emphasized
Agenda
Assets encoded via Rust-like ownership types
“If you give me a coin, I will give you a car title”
“If you show me your title and pay a fee, I will give you a car registration”
CarTitle, CarRegistration, Coin are user-defined types declared in different modules.
Type can flow across trust boundaries without losing integrity
Type system prevents misuse of asset values
Destruction
“Double-spending”
Duplication
Protection against:
Ensures that digital assets behave like physical ones
Enforced by both compiler and JVM-style bytecode verifier
Struct abilities let programmers create linear types, affine types, and more
Move design optimizes for safety + predictability
Co-developed with Move Prover verification tool
Prover aims at fast, precise, accessible verification
Platform-specific SC languages frustrate platform experimentation
Move is platform-agnostic
Vision: Move is the WASM of web3
Conclusion
Example: flash loans
Leveraging linearity with “hot potato” objects
Loan and repay are symmetric
loan function in detail
Putting it all together: example usage