Smart Contracts
Aptos contracts are written using Move, a next generation language for secure, sandboxed, and formally verified programming which is used for multiple chains. Move allows developers to write programs that flexibly manage and transfer assets while providing security and protections against attacks on those assets.
📖 Learn Move
Section titled “📖 Learn Move” Why Move? Learn why Aptos uses the Move Language
Create Package Get started by learning how to create a Move package
Objects Learn how to use the Object standard on Aptos to create composable and flexible primitives on chain
👨💻 Move Examples
Section titled “👨💻 Move Examples” Aptos Move Examples 30+ examples on how to develop Move on Aptos
Move Tutorial Covers the basics of programming with Move
Your first Move Module A example of how to publish your first move module
Here is a hello_blockchain
example of move
module hello_blockchain::message { use std::error; use std::signer; use std::string; use aptos_framework::event;
//:!:>resource struct MessageHolder has key { message: string::String, } //<:!:resource
#[event] struct MessageChange has drop, store { account: address, from_message: string::String, to_message: string::String, }
/// There is no message present const ENO_MESSAGE: u64 = 0;
#[view] public fun get_message(addr: address): string::String acquires MessageHolder { assert!(exists<MessageHolder>(addr), error::not_found(ENO_MESSAGE)); borrow_global<MessageHolder>(addr).message }
public entry fun set_message(account: signer, message: string::String) acquires MessageHolder { let account_addr = signer::address_of(&account); if (!exists<MessageHolder>(account_addr)) { move_to(&account, MessageHolder { message, }) } else { let old_message_holder = borrow_global_mut<MessageHolder>(account_addr); let from_message = old_message_holder.message; event::emit(MessageChange { account: account_addr, from_message, to_message: copy message, }); old_message_holder.message = message; } }
#[test(account = @0x1)] public entry fun sender_can_set_message(account: signer) acquires MessageHolder { let addr = signer::address_of(&account); aptos_framework::account::create_account_for_test(addr); set_message(account, string::utf8(b"Hello, Blockchain"));
assert!( get_message(addr) == string::utf8(b"Hello, Blockchain"), ENO_MESSAGE ); }}
⚒️ Developer Resources
Section titled “⚒️ Developer Resources”FAQ and Discussions
Section titled “FAQ and Discussions”- Aptos Dev Discussions for Q&A about Move.
Move IDE plugins
Section titled “Move IDE plugins”- Aptos Move Analyzer for Visual Studio.
- Move language plugin for JetBrains IDEs: Supports syntax highlighting, code navigation, renames, formatting, type checks and code generation.
External Resources
Section titled “External Resources”- Aptos Move by Example
- Teach yourself Move on Aptos.
- Formal Verification, the Move Language, and the Move Prover
- Pontem Move Playground
- Collection of nestable Move resources
We have a new Move on Aptos compiler that supports Move 2. See this page for more information.