Move开发环境构建常规有两种方式,第一种是通过源码的方式构建,第二种是通过 docker 的方式构建。本文主要介绍 第一种方式
建议采用如下的操作系统:
MacOS
Ubuntu
cargo
Move-cli
Move-analyzer
VSCode
VSCode Move插件
curl https://sh.rustup.rs -sSf | sh
Tip: 等待安装完成即可
这里的工作目录是 ~/workspace/github/
拉取move最新代码
~# git clone https://github.com/move-language/move.git
安装Move-cli
~# cargo install --path move/language/tools/move-cli
验证安装结果
~# move -h
move-cli 0.1.0
Diem Association <opensource@diem.com>
MoveCLI is the CLI that will be executed by the `move-cli` command The `cmd` argument is added here
rather than in `Move` to make it easier for other crates to extend `move-cli`
USAGE:
move [OPTIONS] <SUBCOMMAND>
OPTIONS:
--abi Generate ABIs for packages
--arch <ARCHITECTURE>
-d, --dev Compile in 'dev' mode. The 'dev-addresses' and
'dev-dependencies' fields will be used if this flag is set.
This flag is useful for development of packages that expose
named addresses that are not set to a specific value
--doc Generate documentation for packages
--fetch-deps-only Only fetch dependency repos to MOVE_HOME
--force Force recompilation of all packages
-h, --help Print help information
--install-dir <INSTALL_DIR> Installation directory for compiled artifacts. Defaults to
current directory
-p, --path <PACKAGE_PATH> Path to a package which the command should be run with
respect to
--test Compile in 'test' mode. The 'dev-addresses' and
'dev-dependencies' fields will be used along with any code in
the 'tests' directory
-v Print additional diagnostics if available
-V, --version Print version information
SUBCOMMANDS:
build Build the package at `path`. If no path is provided defaults to current
directory
coverage Inspect test coverage for this package. A previous test run with the
`--coverage` flag must have previously been run
disassemble Disassemble the Move bytecode pointed to
docgen Generating javadoc style documentation for packages using the Move Prover
errmap Generate error map for the package and its dependencies at `path` for use by
the Move explanation tool
experimental (Experimental) Run static analyses on Move source or bytecode
help Print this message or the help of the given subcommand(s)
info Print address information
movey-login
new Create a new Move package with name `name` at `path`. If `path` is not
provided the package will be created in the directory `name`
prove Run the Move Prover on the package at `path`. If no path is provided
defaults to current directory. Use `.. prove .. -- <options>` to pass on
options to the prover
sandbox Execute a sandbox command
test Run Move unit tests in this package
moe-analyzer 主要提供语法检查、高亮等功能,vscode的插件也需要用到该命令,否则会报错。
~# cargo install --path move/language/tools/move-analyzer
目前用到的插件有2个,一个是 move-analyzer 和 move syntax
!image-20220812155330720
!image-20220812155406299
代码目录结构如下:
├── Move.toml # move 配置文件,存放项目信息、依赖、命名地址等内容
└── sources # 源码目录,用于存放模块、脚本等内容
├── modules # 模块目录
│ └── Coin.move # 具体模块
└── scripts # 脚本目录
└── test-coin.move # 具体脚本
Move.toml 配置内容
[package]
name = "example1"
version = "0.0.0"
[addresses]
std="0x1"
[dependencies]
MoveNursery = { git = "https://github.com/move-language/move.git", subdir="language/move-stdlib/nursery", rev = "main"}
MoveStdlib = { git = "https://github.com/move-language/move.git", subdir="language/move-stdlib", rev = "main"}
Coin.move 代码内容
address 0x2 {
module Coin {
struct Coin {
value: u64,
}
public fun mint(value: u64): Coin {
Coin { value }
}
public fun value(coin: &Coin): u64 {
coin.value
}
public fun burn(coin: Coin): u64 {
let Coin { value } = coin;
value
}
}
}
test-coin.move 代码内容
script {
use std::debug;
use 0x2::Coin;
fun main() {
let coin = Coin::mint(1000000);
debug::print(&Coin::value(&coin));
Coin::burn(coin);
}
}
构建测试
# move sandbox publish
# move sandbox run sources/scripts/test-coin.move
[debug] 1000000
Mov社区成员:欢迎大家加入 Move 社区共建 Move社区,加入 Discord Move社区
Twitter: Follow Me

GCP 如何采用第三方工具 ssh 连接
GCP(Google Cloud Platform)是 Google 自研的云计算平台,当购买云主机后会碰到如何远程 SSH连接的问题,因此编写该文档用于为新手简化操作。 方法有很多种,这里介绍几个常见的,本次的环境采用 `Ubuntu 18.04 LTS` 系统进行说明:方法一:通过密码方式登录点击 SSH等待上传私钥登录成功执行命涉及命令如下:修改 sshd 配置# 提权 sudo -i # 允许root登录 sed -i 's/PermitRootLogin no/PermitRootLogin yes/' /etc/ssh/sshd_config # 允许密码认证 sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config 检查配置是否修改# 查看修改是否生效 egrep --color '(PermitRootLogin|PasswordAuthentication)' /etc/ssh/sshd_config 确保如下的配置取消注释:PermitRootLo...

Sui全节点安装教程
硬件要求CPU:>= 2RAM: >= 8GStorages: >= 50GTips: 按照官方说法,每两周会重置一次数据软件要求操作系统建议采用Linux,发行版建议采用 Debian 或 Ubuntu,官方测试的版本是:Ubuntu version 18.04 (Bionic Beaver),建议使用 Ubunt 18.04。依赖包(可选:需要本地构建则安装)$ apt-get update \ && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC && \ apt-get install -y --no-install-recommends \ tzdata \ git \ ca-certificates \ curl \ build-essential \ libssl-dev \ pkg-config \ libclang-dev \ cmake 配置全节点配置全节点有两种方式,第一种方式是通过 Docker,第二种方式采用 源码编译Docker方式下面介绍采用docker的方式运行全节点安装 ...

【埋伏空投】Vertex Protocol 测试网交互教程
欢迎大家关注 0xFish,专注挖掘精品空投项目,相互交流持续学习免责声明: 所有分享内容仅做学习交流,不构成任何投资建议背景提醒:官方未说明有空投!!!官方未说明有空投!!!官方未说明有空投!!! 酌情埋伏官方信息官网:https://vertexprotocol.io/ Twtiter:https://twitter.com/vertex_protocol Discord:https://discord.gg/vertexprotocol项目介绍Vertex Protocol 将通过创建一个垂直整合的交易所 (VERT-EX) 来解决这个问题,该交易所具有订单簿和高级风险引擎,以促进现货和衍生品的交叉保证金交易,并通过货币市场促进杠杆和收益产品。用户体验将通过提供集成解决方案来简化,例如:进出匝道;高效桥接;Web2 风格的注册集成与自我托管;和多个用户界面,以适应具有不同需求的不同交易者。项目融资2022年4月拿到了850万美元的种子轮投资,本轮由Hack VC和Dexterity Capital领投,Collab +Currency、GSR、Jane St.、Hudson...
Twitter: https://twitter.com/9xFish
Move开发环境构建常规有两种方式,第一种是通过源码的方式构建,第二种是通过 docker 的方式构建。本文主要介绍 第一种方式
建议采用如下的操作系统:
MacOS
Ubuntu
cargo
Move-cli
Move-analyzer
VSCode
VSCode Move插件
curl https://sh.rustup.rs -sSf | sh
Tip: 等待安装完成即可
这里的工作目录是 ~/workspace/github/
拉取move最新代码
~# git clone https://github.com/move-language/move.git
安装Move-cli
~# cargo install --path move/language/tools/move-cli
验证安装结果
~# move -h
move-cli 0.1.0
Diem Association <opensource@diem.com>
MoveCLI is the CLI that will be executed by the `move-cli` command The `cmd` argument is added here
rather than in `Move` to make it easier for other crates to extend `move-cli`
USAGE:
move [OPTIONS] <SUBCOMMAND>
OPTIONS:
--abi Generate ABIs for packages
--arch <ARCHITECTURE>
-d, --dev Compile in 'dev' mode. The 'dev-addresses' and
'dev-dependencies' fields will be used if this flag is set.
This flag is useful for development of packages that expose
named addresses that are not set to a specific value
--doc Generate documentation for packages
--fetch-deps-only Only fetch dependency repos to MOVE_HOME
--force Force recompilation of all packages
-h, --help Print help information
--install-dir <INSTALL_DIR> Installation directory for compiled artifacts. Defaults to
current directory
-p, --path <PACKAGE_PATH> Path to a package which the command should be run with
respect to
--test Compile in 'test' mode. The 'dev-addresses' and
'dev-dependencies' fields will be used along with any code in
the 'tests' directory
-v Print additional diagnostics if available
-V, --version Print version information
SUBCOMMANDS:
build Build the package at `path`. If no path is provided defaults to current
directory
coverage Inspect test coverage for this package. A previous test run with the
`--coverage` flag must have previously been run
disassemble Disassemble the Move bytecode pointed to
docgen Generating javadoc style documentation for packages using the Move Prover
errmap Generate error map for the package and its dependencies at `path` for use by
the Move explanation tool
experimental (Experimental) Run static analyses on Move source or bytecode
help Print this message or the help of the given subcommand(s)
info Print address information
movey-login
new Create a new Move package with name `name` at `path`. If `path` is not
provided the package will be created in the directory `name`
prove Run the Move Prover on the package at `path`. If no path is provided
defaults to current directory. Use `.. prove .. -- <options>` to pass on
options to the prover
sandbox Execute a sandbox command
test Run Move unit tests in this package
moe-analyzer 主要提供语法检查、高亮等功能,vscode的插件也需要用到该命令,否则会报错。
~# cargo install --path move/language/tools/move-analyzer
目前用到的插件有2个,一个是 move-analyzer 和 move syntax
!image-20220812155330720
!image-20220812155406299
代码目录结构如下:
├── Move.toml # move 配置文件,存放项目信息、依赖、命名地址等内容
└── sources # 源码目录,用于存放模块、脚本等内容
├── modules # 模块目录
│ └── Coin.move # 具体模块
└── scripts # 脚本目录
└── test-coin.move # 具体脚本
Move.toml 配置内容
[package]
name = "example1"
version = "0.0.0"
[addresses]
std="0x1"
[dependencies]
MoveNursery = { git = "https://github.com/move-language/move.git", subdir="language/move-stdlib/nursery", rev = "main"}
MoveStdlib = { git = "https://github.com/move-language/move.git", subdir="language/move-stdlib", rev = "main"}
Coin.move 代码内容
address 0x2 {
module Coin {
struct Coin {
value: u64,
}
public fun mint(value: u64): Coin {
Coin { value }
}
public fun value(coin: &Coin): u64 {
coin.value
}
public fun burn(coin: Coin): u64 {
let Coin { value } = coin;
value
}
}
}
test-coin.move 代码内容
script {
use std::debug;
use 0x2::Coin;
fun main() {
let coin = Coin::mint(1000000);
debug::print(&Coin::value(&coin));
Coin::burn(coin);
}
}
构建测试
# move sandbox publish
# move sandbox run sources/scripts/test-coin.move
[debug] 1000000
Mov社区成员:欢迎大家加入 Move 社区共建 Move社区,加入 Discord Move社区
Twitter: Follow Me

GCP 如何采用第三方工具 ssh 连接
GCP(Google Cloud Platform)是 Google 自研的云计算平台,当购买云主机后会碰到如何远程 SSH连接的问题,因此编写该文档用于为新手简化操作。 方法有很多种,这里介绍几个常见的,本次的环境采用 `Ubuntu 18.04 LTS` 系统进行说明:方法一:通过密码方式登录点击 SSH等待上传私钥登录成功执行命涉及命令如下:修改 sshd 配置# 提权 sudo -i # 允许root登录 sed -i 's/PermitRootLogin no/PermitRootLogin yes/' /etc/ssh/sshd_config # 允许密码认证 sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config 检查配置是否修改# 查看修改是否生效 egrep --color '(PermitRootLogin|PasswordAuthentication)' /etc/ssh/sshd_config 确保如下的配置取消注释:PermitRootLo...

Sui全节点安装教程
硬件要求CPU:>= 2RAM: >= 8GStorages: >= 50GTips: 按照官方说法,每两周会重置一次数据软件要求操作系统建议采用Linux,发行版建议采用 Debian 或 Ubuntu,官方测试的版本是:Ubuntu version 18.04 (Bionic Beaver),建议使用 Ubunt 18.04。依赖包(可选:需要本地构建则安装)$ apt-get update \ && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC && \ apt-get install -y --no-install-recommends \ tzdata \ git \ ca-certificates \ curl \ build-essential \ libssl-dev \ pkg-config \ libclang-dev \ cmake 配置全节点配置全节点有两种方式,第一种方式是通过 Docker,第二种方式采用 源码编译Docker方式下面介绍采用docker的方式运行全节点安装 ...

【埋伏空投】Vertex Protocol 测试网交互教程
欢迎大家关注 0xFish,专注挖掘精品空投项目,相互交流持续学习免责声明: 所有分享内容仅做学习交流,不构成任何投资建议背景提醒:官方未说明有空投!!!官方未说明有空投!!!官方未说明有空投!!! 酌情埋伏官方信息官网:https://vertexprotocol.io/ Twtiter:https://twitter.com/vertex_protocol Discord:https://discord.gg/vertexprotocol项目介绍Vertex Protocol 将通过创建一个垂直整合的交易所 (VERT-EX) 来解决这个问题,该交易所具有订单簿和高级风险引擎,以促进现货和衍生品的交叉保证金交易,并通过货币市场促进杠杆和收益产品。用户体验将通过提供集成解决方案来简化,例如:进出匝道;高效桥接;Web2 风格的注册集成与自我托管;和多个用户界面,以适应具有不同需求的不同交易者。项目融资2022年4月拿到了850万美元的种子轮投资,本轮由Hack VC和Dexterity Capital领投,Collab +Currency、GSR、Jane St.、Hudson...
Share Dialog
Share Dialog
Twitter: https://twitter.com/9xFish

Subscribe to 0xFish

Subscribe to 0xFish
<100 subscribers
<100 subscribers
No activity yet