Skip to content

How do I execute a Move script on Aptos using the Rust SDK? #24

Answered by 0xaptosj
0xaptosj asked this question in Questions
Discussion options

You must be logged in to vote

First, you need to compile the script, as you did above. Imagine you have a project layout like this:

src/
    main.rs
move/
    Move.toml
    sources/
        top_up.mv

You would want to go in to move/ and run aptos move compile, like you said above. From there, you can depend on the compiled script in your code (see below).

With that complete, here is a minimal code example demonstrating how to execute a Move script using the Rust SDK. You can install rust sdk following this doc.

src/main.rs:

use aptos_sdk::{
    crypto::ed25519::{Ed25519PublicKey, PrivateKey},
    rest_client::Client,
    transaction_builder::TransactionFactory,
    types::{
        account_address::AccountAddress,

Replies: 2 comments

Comment options

0xaptosj
Mar 7, 2024
Maintainer Author

You must be logged in to vote
0 replies
Answer selected by 0xaptosj
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
move Questions related to the Move Language rust-sdk Questions related to the Rust SDK
2 participants