In this tutorial, you will learn how to build a dapp on the Aptos blockchain. dapps usually consist of a graphical user interface and one or more Move modules. This tutorial will use the Move module described in Your First Move Modulehello_blockchain
, and focus on building the user interface around the module. We will use the following tools and resources:
- TypeScript SDK
- Petra Wallet
- Aptos CLI
- Full source code
Before you begin, you will need a Chrome extension wallet that interacts with the dapp, such as the Petra wallet extension. If you haven't installed the Petra wallet extension before, follow these steps:
- Open your wallet and click "Create a new wallet".
- Click "Create account" to create an Aptos account.
- Copy the private key, which you will use in the next step to set up the Aptos CLI.
- Refer to the user guide on petra.app for help.
- In the wallet, switch to Devnet network, click "Settings", "Network", and then select "devnet".
- Click on the "faucet" button to make sure you can receive the test tokens.
If you already have a Petra wallet installed, create a new one for this tutorial. In the extension, click on "Settings", "Switch account", "Add account", "Create new account" to create a new account. Then switch to the Devnet network and click the "faucet" button to make sure you can receive test tokens.
Next, we will install the Aptos CLI in order to publish and interact with the Move module. Please follow the steps below:
- Install the Aptos CLI.
- (of a computer) run
aptos init --profile my-first-nft
The - Select Network
devnet
The - When prompted for a private key, paste the private key from the Petra wallet and press Enter.
This will initialize the Aptos CLI to use the same accounts as the Aptos wallet. Run theaptos account list --profile my-first-nft
To verify that the setup was successful, you should add the following to all events of theaddr
field to see your account land.
Next, we will set up the front-end user interface of dapp. In this tutorial, we will use thecreate-react-app
to set up the application. Please follow the steps below:
- Go to your project root directory and create a new
move
Catalog. - Access to the project
move
directory and runaptos move init --name my_todo_list
The
This command will be executed in themove
directory to create asources/
directory and aMove.toml
Documentation. Yourmove
The catalog should now look like the following:
move
├── Move.toml
└── sources
└─ YOUR_CONTRACT_FILE.move
Now you can edit theMove.toml
files and Move module files, Move modules are smart contracts written in the Move language, and you can compile and publish Move modules using the Aptos CLI and then interact with them using the Remix IDE plug-in.
All of the above content is reproduced from the Internet, does not represent the position of AptosNews, is not investment advice, investment risk, the market need to be cautious, such as infringement, please contact the administrator to delete.