← 返回命令列表

Linux command

aptos 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Initialize a new Aptos account

aptos init

Create a new account on chain

aptos account create --account [address]

Check account balance

aptos account balance --account [address]

Compile a Move module

aptos move compile --package-dir [path/to/package]

Publish a Move module

aptos move publish --package-dir [path/to/package]

Run a Move function

aptos move run --function-id [address::module::function]

Transfer APT tokens

aptos account transfer --account [recipient] --amount [amount]

Get transaction details

aptos transaction show --hash [transaction_hash]

说明

aptos is the official command-line interface for interacting with the Aptos blockchain. It provides tools for account management, smart contract development using the Move language, and blockchain interactions. The CLI supports the full development lifecycle: initializing projects, compiling Move modules, running tests, deploying to various networks (devnet, testnet, mainnet), and executing on-chain functions. It manages accounts, keys, and profiles for different environments. Move is Aptos's smart contract language, derived from Facebook's Diem project. The CLI's Move commands handle compilation, testing, and publishing of Move packages to the blockchain.

参数

init
Initialize configuration and create a new account.
account
Account-related operations (create, balance, transfer).
move
Move language operations (compile, publish, run, test).
node
Node operations (run, show-status).
key
Key management (generate, extract).
config
Configuration management.
--profile _name_
Use a specific profile from configuration.
--network _network_
Target network: mainnet, testnet, devnet, or custom URL.
--private-key _key_
Private key for signing transactions.
--assume-yes
Assume yes for all prompts.
--output _format_
Output format: json, text.

FAQ

What is the aptos command used for?

aptos is the official command-line interface for interacting with the Aptos blockchain. It provides tools for account management, smart contract development using the Move language, and blockchain interactions. The CLI supports the full development lifecycle: initializing projects, compiling Move modules, running tests, deploying to various networks (devnet, testnet, mainnet), and executing on-chain functions. It manages accounts, keys, and profiles for different environments. Move is Aptos's smart contract language, derived from Facebook's Diem project. The CLI's Move commands handle compilation, testing, and publishing of Move packages to the blockchain.

How do I run a basic aptos example?

Run `aptos init` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does init do in aptos?

Initialize configuration and create a new account.