# Getting Started With the Move Programming Language for Smart Contracts 

By [Goodnessuc](https://paragraph.com/@goodnessuc-2) · 2024-02-11

---

Programming is essential to decentralized technologies and smart contracts. New languages like Vyper and Solidity have emerged for building smart contracts, while blockchains like Algorand and Near use popular existing languages for the same purpose.

Languages for smart contracts need security-focused design and formal verification, two features that make the Move programming language stand out.

What Is the Move Programming Language
-------------------------------------

You can use Move to write smart contracts that manage and transfer value flexibly and securely. The move is inspired by and based on the Rust programming language. One of Move’s key features is its use of resource types that explicitly represent digital assets.

Why Move for Smart Contracts
----------------------------

APTOS and SUI, new layer-one blockchains, have embraced Move as their smart contract programming language. These projects acknowledge the tradeoffs of opting for Move over EVM-compatible languages, balancing the benefits of a broader developer pool and a thriving ecosystem.

Choosing move as a language is in the direction of the security and scalability philosophy of the decentralized future as in the blockchain trilemma.

Move aims to eliminate smart contract vulnerabilities, including recency attacks. It also supports formal verification that allows you to prove code integrity mathematically for reliability and security.

Getting Started Hacking with Move
---------------------------------

You can find everything related to the Move project on its GitHub repository, including tutorials on using Move.

You’ll need to install Move to start writing smart contracts. Move is based on Rust, so you must install Rust and Cargo (Rust’s built-in package manager).

Execute this command to install Rust on your computer:

    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
    

Next, clone the Move GitHub repository with this command:

    git clone https://github.com/move-language/move.git
    

This command makes the Move repository available on your machine.

Enter the repository and execute the \`\`dev\_setup.sh\` script with this command:

    cd move
    ./scripts/dev_setup.sh -ypt
    

The script installs the necessary dependencies for Move.

Execute this command to add environment variable definitions to the `~/.profile` file:

The script adds environment variable definitions to your space. You can include them by running this command:

Now you can install the `move-cli` tool with this `cargo install` command:

    cargo install --path language/tools/move-cli
    

If you experience any issues, install and switch to Rust nightly build and rerun the `move-cli` install command:

    rustup install nightly
    
    rustup default nightly
    

You can verify the installation with the `move` command’s `--help` flag:

    move --help
    

Here’s the output of the command on execution.

![](https://storage.googleapis.com/papyrus_images/13d724cf3a56a4e40c574c1aa0b63d8257b9a6bd4c9539ed61d4a5fd4be5946d.png)

Writing Your First Move Script
------------------------------

There are two types of Move programs: modules and scripts. Modules are libraries with struct types that operate on the types, while scripts are executable entry points that call functions of published modules.

Move source files can contain multiple modules and scripts, but the Move virtual machine treats modules and scripts differently.

Here’s what a Move script looks like:

    module YourAddress::SimpleBank {
        resource struct Coin {
            value: u64,
        }
    
            public fun deposit(account: &signer, amount: u64) {
                let deposit_coin = Coin { value: amount };
                move_to(account, deposit_coin);
            }
                
    }
    

The `SimpleBank` module defines the `Coin` struct (the resource type in this case). The `Coin` resource has a `value` field of the `u64` type representing the coin's value.

The `deposit` function in the module creates a `Coin` with the specified amount and moves it to the caller‘s account with a `move_to` function.

The `public` keyword before the `fun` keyword for the function specifies that the function should be able to modify resources.

Conclusion
----------

You’ve learned about the Move programming language, why it’s preferred for smart contracts, how to set up Move on your computer, and an overview of a Move script.

Set on to familiarize yourself with the ins and outs of the language and start writing smart contracts on Move-based blockchains like Aptos and Sui to make the most out of your Move development skills.

---

*Originally published on [Goodnessuc](https://paragraph.com/@goodnessuc-2/getting-started-with-the-move-programming-language-for-smart-contracts)*
