Welcome to the world of Move, a smart contract language designed for the Web3 era! In this tutorial, we'll help you set up your environment, create your first Move application, and test it locally. So let's dive in and learn how to write smart contracts using Move.
modules/ - directory for our modules
scripts/ - directory for transaction scripts
out/ - this directory will hold compiled sources
.mvconfig.json
in the root of your project directory to configure your working environment. Here's a sample configuration for the libra
network:{
"network": "libra",
"sender": "0x1"
}
Or you can use dfinance
as network:
{
"network": "dfinance",
"sender": "0x1"
}
Now that your environment is set up, let's create a simple Move application that implements a gimme_five()
function.
hello_world.move
inside the modules/
directory of your project:// modules/hello_world.move
address 0x1 {
module HelloWorld {
public fun gimme_five(): u8 {
5
}
}
}
run_hello.move
inside the scripts/
directory of your project:
// scripts/run_hello.move
script {
use 0x1::HelloWorld;
use 0x1::Debug;
fun main() {
let five = HelloWorld::gimme_five();
Debug::print<u8>(&five);
}
}