### Full E2E Test Setup Example Source: https://github.com/aptos-labs/aptos-core/blob/main/crates/aptos-telemetry-service/e2e-test/test-client/README.md Example of running the telemetry test client with a full E2E test setup, including sourcing environment variables and specifying all parameters. ```bash # Source the test environment source /path/to/aptos-core/crates/aptos-telemetry-service/e2e-test/test-data/.env # Run with the test account key cargo run -p telemetry-test-client -- \ -u http://localhost:8082 \ -c e2e_test_contract \ -p $TEST_ACCOUNT_KEY_HEX \ --chain-id 4 \ all -i 5 -d 1 ``` -------------------------------- ### Run All Move Example Tests Source: https://github.com/aptos-labs/aptos-core/blob/main/aptos-move/move-examples/README.md Execute tests for all Move examples in the repository. Ensure the Aptos CLI is installed and configured. ```bash cargo test -- --nocapture ``` -------------------------------- ### Start Pepper Client Locally Source: https://github.com/aptos-labs/aptos-core/blob/main/keyless/pepper/README.md Run the Pepper Client example to interact with the Pepper Service. Follow the on-screen instructions to complete the session. ```bash cd keyless/pepper/scripts ./start-pepper-client.sh ``` -------------------------------- ### Start Pepper Client with Firestore Source: https://github.com/aptos-labs/aptos-core/blob/main/keyless/pepper/README.md Run the Pepper Client example when the Pepper Service is configured with Firestore. Provide all necessary connection details for the emulator, service account, Pepper Service, and GCP project. ```bash cd keyless/pepper/scripts ./start-pepper-client-with-firestore.sh ``` -------------------------------- ### Run REST Client Example Source: https://github.com/aptos-labs/aptos-core/blob/main/crates/aptos-rest-client/examples/README.md Execute a specific REST client example from the parent directory. Replace `` with the example's directory name. ```bash cargo run --example ``` -------------------------------- ### Install Dependencies Source: https://github.com/aptos-labs/aptos-core/blob/main/protos/README.md Execute this script from the current directory to install necessary dependencies if they haven't been installed yet. ```bash ./scripts/install_deps.sh ``` -------------------------------- ### Complete Cargo.toml Example Source: https://github.com/aptos-labs/aptos-core/blob/main/scripts/binary_release/CARGO_BINSTALL.md A full example of a Cargo.toml file including package information and cargo-binstall metadata for the aptos-node crate. ```toml [package] name = "aptos-node" version = "1.2.3" edition = "2021" repository = "https://github.com/aptos-labs/aptos-core" [package.metadata.binstall] pkg-url = "{ repo }/releases/download/{ bin }-v{ version }/{ bin }-v{ version }-{ target }.zip" bin-dir = "{ bin }{ binary-ext }" pkg-fmt = "zip" [package.metadata.binstall.overrides.x86_64-pc-windows-msvc] pkg-url = "{ repo }/releases/download/{ bin }-v{ version }/{ bin }-v{ version }-{ target }.zip" ``` -------------------------------- ### Install Aptos Faucet Client Package Source: https://github.com/aptos-labs/aptos-core/blob/main/crates/aptos-faucet/ts-client/README.md Install the Aptos Faucet client package using pnpm. ```bash pnpm add @aptos-labs/aptos-faucet-client ``` -------------------------------- ### Install Aptos Binary (Unix/Linux/macOS) Source: https://github.com/aptos-labs/aptos-core/blob/main/scripts/binary_release/QUICKSTART.md Installs a binary release using curl and a shell script. Replace `` with the desired tool. ```bash curl -fsSL https://raw.githubusercontent.com/aptos-labs/aptos-core/main/scripts/binary_release/install_binary.sh | sh -s -- ``` -------------------------------- ### Debug Binary Installation Source: https://github.com/aptos-labs/aptos-core/blob/main/scripts/binary_release/CARGO_BINSTALL.md Use the --log-level debug flag with cargo binstall to get detailed output, useful for troubleshooting installation issues. ```bash cargo binstall your-crate-name --log-level debug ``` -------------------------------- ### Install Aptos Binary (Windows PowerShell) Source: https://github.com/aptos-labs/aptos-core/blob/main/scripts/binary_release/QUICKSTART.md Installs a binary release using PowerShell. Replace `` with the desired tool. ```powershell iwr https://raw.githubusercontent.com/aptos-labs/aptos-core/main/scripts/binary_release/install_binary.ps1 -OutFile install.ps1; .\install.ps1 -BinaryName ``` -------------------------------- ### Install Aptos CLI with Homebrew Source: https://github.com/aptos-labs/aptos-core/blob/main/crates/aptos/homebrew/README.md Use this command to install the Aptos command line interface. Ensure Homebrew is installed first. ```bash brew install aptos ``` -------------------------------- ### Install Java with Homebrew Source: https://github.com/aptos-labs/aptos-core/blob/main/third_party/README.md Installs OpenJDK using Homebrew. Ensure Java is in your PATH after installation by following the printed instructions. ```shell brew update brew install java ``` -------------------------------- ### Install Project Dependencies with Poetry Source: https://github.com/aptos-labs/aptos-core/blob/main/crates/aptos-faucet/integration-tests/README.md After installing Poetry, run this command to install the project's dependencies. This ensures all necessary libraries are available for the testing framework. ```bash poetry install ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/aptos-labs/aptos-core/blob/main/crates/aptos-faucet/ts-client/README.md Install all project dependencies using pnpm. ```bash pnpm install ``` -------------------------------- ### Verify Aptos CLI Installation Source: https://github.com/aptos-labs/aptos-core/blob/main/crates/aptos/homebrew/README.md After installation, run this command to verify that the Aptos CLI is installed correctly and to see its version and description. ```bash aptos --help ``` -------------------------------- ### Start Claude with Local Plugin Source: https://github.com/aptos-labs/aptos-core/blob/main/aptos-move/flow/README.md Starts the Claude AI assistant, pointing it to the locally generated plugin directory. ```bash claude --plugin-dir ./gen/claude ``` -------------------------------- ### Install move-flow on Unix/Linux/macOS Source: https://github.com/aptos-labs/aptos-core/blob/main/aptos-move/flow/RELEASE.md Use this command to quickly install the move-flow binary on Unix-like systems by piping the installation script to sh. ```bash curl -fsSL https://raw.githubusercontent.com/aptos-labs/aptos-core/main/scripts/binary_release/install_binary.sh | sh -s -- move-flow ``` -------------------------------- ### Install Aptos Node Binary (Linux/macOS) Source: https://github.com/aptos-labs/aptos-core/blob/main/scripts/binary_release/README.md Installs the aptos-node binary using a curl script. Specify --bin-dir to install to a custom directory. ```bash curl -fsSL https://raw.githubusercontent.com/aptos-labs/aptos-core/main/scripts/binary_release/install_binary.sh | sh -s -- aptos-node --bin-dir /usr/local/bin ``` -------------------------------- ### Install cargo-binstall Source: https://github.com/aptos-labs/aptos-core/blob/main/scripts/binary_release/CARGO_BINSTALL.md Use this command to install cargo-binstall globally on your system. ```bash cargo binstall aptos-node ``` -------------------------------- ### Install Bazel with Homebrew Source: https://github.com/aptos-labs/aptos-core/blob/main/third_party/README.md Installs the Bazel build tool using Homebrew, a prerequisite for compiling the Aptos Core project. ```shell brew install bazel ``` -------------------------------- ### Install Aptos Node using cargo-binstall Source: https://github.com/aptos-labs/aptos-core/blob/main/scripts/binary_release/README.md Installs the aptos-node binary using cargo-binstall, which downloads pre-built binaries instead of compiling. Requires cargo-binstall to be installed first. ```bash cargo install cargo-binstall ``` ```bash cargo binstall aptos-node ``` -------------------------------- ### Release Tag Example Source: https://github.com/aptos-labs/aptos-core/blob/main/scripts/binary_release/QUICKSTART.md Example of a release tag format for a tool named 'my-tool' version '1.2.3'. ```text my-tool-v1.2.3 ``` -------------------------------- ### Install Aptos CLI using Specific Rust Version and Build Script Source: https://github.com/aptos-labs/aptos-core/blob/main/crates/aptos/homebrew/README.md The install method sets up the required Rust toolchain (v1.64), prepends the cargo cache to the PATH, and executes a build script to compile the Aptos CLI release binary. The compiled binary is then installed. ```ruby def install system "#{Formula["rustup-init"].bin}/rustup-init", "-qy", "--no-modify-path", "--default-toolchain", "1.64" ENV.prepend_path "PATH", HOMEBREW_CACHE/"cargo_cache/bin" system "./scripts/cli/build_cli_release.sh", "homebrew" bin.install "target/cli/aptos" end ``` -------------------------------- ### Get Creator Address from GUID ID Source: https://github.com/aptos-labs/aptos-core/blob/main/third_party/move/move-stdlib/nursery/docs/guid.md Retrieves the account address that originally created a given GUID ID. No specific setup is required. ```move public fun id_creator_address(id: &guid::ID): address { id.addr } ``` -------------------------------- ### Example AptosDB Bootstrap Command Source: https://github.com/aptos-labs/aptos-core/blob/main/storage/README.md This example demonstrates how to use the `aptos node bootstrap-db-from-backup` command with specific options for metadata caching, configuration path, and target database directory. It also shows how to set the RUST_LOG environment variable for logging. ```bash RUST_LOG=info ./aptos \ node bootstrap-db-from-backup \ --metadata-cache-dir ./mc \ --config-path s3.yaml \ --target-db-dir data/db ``` -------------------------------- ### Get GUID ID Source: https://github.com/aptos-labs/aptos-core/blob/main/third_party/move/move-stdlib/nursery/docs/guid.md Retrieves the non-privileged ID associated with a GUID. ```APIDOC ## GET /guid/id ### Description Retrieves the non-privileged ID associated with a GUID. ### Method GET ### Endpoint /guid/id ### Parameters #### Path Parameters - None #### Query Parameters - None #### Request Body - **guid** (&guid::GUID) - Required - The GUID to get the ID from. ### Request Example ```json { "guid": { "id": { "creation_num": 1, "addr": "0x1" } } } ``` ### Response #### Success Response (200) - **ID** (guid::ID) - The ID associated with the GUID. #### Response Example ```json { "id": { "creation_num": 1, "addr": "0x1" } } ``` ``` -------------------------------- ### Run Account REST Client Example Source: https://github.com/aptos-labs/aptos-core/blob/main/crates/aptos-rest-client/examples/README.md Run the 'account' example, specifying the API URL. Ensure an Aptos API is accessible at the provided address. ```bash cargo run --example account -- --api-url http://127.0.0.1:8080 ``` -------------------------------- ### Build, Serve, and Deploy Aptos Framework Docs Source: https://github.com/aptos-labs/aptos-core/blob/main/third_party/move/documentation/framework-book/README.md These commands are used to manage the Aptos Framework documentation. Use `./build.sh` to generate module docs, `mdbook serve` for a live preview, and `./deploy.sh` to publish the documentation. ```bash ./build.sh # generate per-package module docs and render to ./html mdbook serve # live preview at http://localhost:3000 ./deploy.sh # publish to https://aptos-labs.github.io/framework-book/ ``` -------------------------------- ### Get GUID ID Source: https://github.com/aptos-labs/aptos-core/blob/main/third_party/move/move-stdlib/nursery/docs/guid.md Retrieves the non-privileged ID associated with a GUID. ```move public fun id(guid: &guid::GUID): guid::ID { *&guid.id } ``` -------------------------------- ### Get Event Handle GUID Source: https://github.com/aptos-labs/aptos-core/blob/main/third_party/move/move-stdlib/nursery/docs/event.md Retrieves the GUID associated with an EventHandle. ```APIDOC ## GET /guid ### Description Returns the GUID associated with this EventHandle. ### Method GET ### Endpoint /guid ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **handle_ref** (EventHandle) - Required - A reference to an EventHandle. ### Request Example ```json { "handle_ref": "" } ``` ### Response #### Success Response (200) - **guid** (GUID) - The GUID associated with the EventHandle. #### Response Example ```json { "guid": "" } ``` ``` -------------------------------- ### Install move-flow on Windows Source: https://github.com/aptos-labs/aptos-core/blob/main/aptos-move/flow/RELEASE.md Use this PowerShell command to download and execute the installation script for move-flow on Windows. ```powershell iwr https://raw.githubusercontent.com/aptos-labs/aptos-core/main/scripts/binary_release/install_binary.ps1 -OutFile install.ps1 . install.ps1 -BinaryName move-flow ``` -------------------------------- ### Artifact Filename Examples Source: https://github.com/aptos-labs/aptos-core/blob/main/scripts/binary_release/QUICKSTART.md Examples of artifact filenames for a release of 'my-tool' version '1.2.3' across different platforms. ```text my-tool-v1.2.3-x86_64-unknown-linux-gnu.zip my-tool-v1.2.3-aarch64-unknown-linux-gnu.zip my-tool-v1.2.3-x86_64-apple-darwin.zip my-tool-v1.2.3-aarch64-apple-darwin.zip my-tool-v1.2.3-x86_64-pc-windows-msvc.zip ``` -------------------------------- ### Get Creation Number from GUID Source: https://github.com/aptos-labs/aptos-core/blob/main/third_party/move/move-stdlib/nursery/docs/guid.md Extracts the creation number associated with a GUID. Ensure the GUID structure is correctly passed. ```move public fun creation_num(guid: &guid::GUID): u64 { guid.id.creation_num } ``` -------------------------------- ### Get Creator Address from GUID Source: https://github.com/aptos-labs/aptos-core/blob/main/third_party/move/move-stdlib/nursery/docs/guid.md Returns the account address that originally created the GUID. ```move public fun creator_address(guid: &guid::GUID): address { guid.id.addr } ``` -------------------------------- ### Install Dependencies with Move Prover Source: https://github.com/aptos-labs/aptos-core/blob/main/CLAUDE.md Install build dependencies and include Move Prover tools like Z3 and Boogie for formal verification. ```bash ./scripts/dev_setup.sh -y ``` -------------------------------- ### Build, Serve, and Deploy Move Book Source: https://github.com/aptos-labs/aptos-core/blob/main/third_party/move/documentation/book/README.md Commands to build the documentation locally, serve it for live preview, or deploy it to a GitHub Pages site. ```bash mdbook build # render to ./html ``` ```bash mdbook serve # live preview at http://localhost:3000 ``` ```bash ./deploy.sh # publish to https://aptos-labs.github.io/move-book/ ``` -------------------------------- ### Get GUID from EventHandle Source: https://github.com/aptos-labs/aptos-core/blob/main/third_party/move/move-stdlib/nursery/docs/event.md Retrieves the GUID associated with an EventHandle. This function takes an immutable reference to an EventHandle and returns a reference to its GUID. ```move public fun guid<T: drop, store>(handle_ref: &event::EventHandle<T>): &guid::GUID ``` ```move public fun guid<T: drop + store>(handle_ref: &EventHandle<T>): &GUID { &handle_ref.guid.guid } ``` -------------------------------- ### GUID Get Next Creation Number Source: https://github.com/aptos-labs/aptos-core/blob/main/third_party/move/move-stdlib/nursery/docs/guid.md Retrieves the number for the next GUID to be created by a specific address. ```APIDOC ## GET /guid/get_next_creation_num ### Description Return the number of the next GUID to be created by the specified address. ### Method GET ### Endpoint /guid/get_next_creation_num ### Parameters #### Query Parameters - **addr** (address) - Required - The address for which to get the next creation number. ### Response #### Success Response (200) - **next_creation_num** (u64) - The next creation number. #### Response Example { "next_creation_num": 54321 } ``` -------------------------------- ### Install Basic Build Tools and Prover Tools Source: https://github.com/aptos-labs/aptos-core/blob/main/third_party/move/move-prover/doc/user/install.md Use this command for a fresh Diem enlistment to install basic build tools like Rust along with prover tools. Remember to source your ~/.profile to load environment variables. ```shell ./scripts/dev_setup.sh -typ . ~/.profile ``` -------------------------------- ### Get Creation Number from GUID ID Source: https://github.com/aptos-labs/aptos-core/blob/main/third_party/move/move-stdlib/nursery/docs/guid.md Returns the creation number for a specific GUID ID. This function directly accesses the creation number field. ```move public fun id_creation_num(id: &ID): u64 { id.creation_num } ``` -------------------------------- ### AptosDB Bootstrap from Backup Tool Usage Source: https://github.com/aptos-labs/aptos-core/blob/main/storage/README.md This command-line tool is used to bootstrap an AptosDB from a backup. It requires a configuration file path and a target directory for the database. Options include controlling concurrent downloads and metadata caching. ```bash aptos-node-bootstrap-db-from-backup 0.3.5 Tool to bootstrap DB from backup USAGE: aptos node bootstrap-db-from-backup [OPTIONS] --config-path --target-db-dir OPTIONS: --concurrent-downloads Number of concurrent downloads from the backup storage. This covers the initial metadata downloads as well. Speeds up remote backup access. [Defaults to number of CPUs] --config-path Config file for the source backup, pointing to local files or cloud storage and commands needed to access them. -h, --help Print help information --metadata-cache-dir Metadata cache dir. If specified and shared across runs, metadata files in cache won't be downloaded again from backup source, speeding up tool boot up significantly. Cache content can be messed up if used across the devnet, the testnet and the mainnet, hence it [Defaults to temporary dir]. --replay-concurrency-level concurrency_level used by the transaction executor, applicable when replaying transactions after a state snapshot. [Defaults to number of CPUs] --target-db-dir Target dir where the tool recreates a AptosDB with snapshots and transactions provided in the backup. The data folder can later be used to start an Aptos node. e.g. /opt/ aptos/data/db -V, --version Print version information ``` -------------------------------- ### Get Creator Address Source: https://github.com/aptos-labs/aptos-core/blob/main/third_party/move/move-stdlib/nursery/docs/guid.md Returns the account address that created the GUID. ```APIDOC ## GET /guid/creator_address ### Description Returns the account address that created the GUID. ### Method GET ### Endpoint /guid/creator_address ### Parameters #### Path Parameters - None #### Query Parameters - None #### Request Body - **guid** (&guid::GUID) - Required - The GUID to get the creator address from. ### Request Example ```json { "guid": { "id": { "creation_num": 1, "addr": "0x1" } } } ``` ### Response #### Success Response (200) - **address** (address) - The address of the account that created the GUID. #### Response Example ```json { "address": "0x1" } ``` ``` -------------------------------- ### Indexer GRPC Configuration Example Source: https://github.com/aptos-labs/aptos-core/blob/main/ecosystem/indexer-grpc/indexer-grpc-file-checker/README.md Example configuration for the Indexer GRPC file checker. Specify the health check port and the names of the buckets to compare, along with the starting version for the comparison. ```yaml health_check_port: 8081 server_config: existing_bucket_name: bucket_being_used new_bucket_name: bucket_with_new_sharding starting_version: 123123 ``` -------------------------------- ### Example Aptos DB Continuous Backup Command Source: https://github.com/aptos-labs/aptos-core/blob/main/storage/README.md An example command to run the Aptos DB backup coordinator with specific configurations for metadata cache, snapshot interval, concurrent downloads, and command adapter. ```bash $ cargo run -p aptos-debugger aptos-db backup continuously \ --metadata-cache-dir ./mc \ --state-snapshot-interval-epochs 1 \ --concurrent-downloads 4 \ --command-adapter-config s3.yaml ``` -------------------------------- ### Run Bytecode Dump Example Source: https://github.com/aptos-labs/aptos-core/blob/main/third_party/move/move-prover/tests/xsources/design/README.md Use this command to run an individual Move example and dump its bytecode. The `-k` option additionally preserves the generated Boogie output. ```bash mvp -k --v2 --dump-bytecode .move ``` -------------------------------- ### Signer Address Of Operator Source: https://github.com/aptos-labs/aptos-core/blob/main/third_party/move/documentation/book/src/primitive-types.md Example usage of the 'signer::address_of' function to get the address associated with a signer. ```move signer::address_of(&s) ``` -------------------------------- ### Signer Borrow Address Operator Source: https://github.com/aptos-labs/aptos-core/blob/main/third_party/move/documentation/book/src/primitive-types.md Example usage of the 'signer::borrow_address' function to get a reference to the address associated with a signer. ```move signer::borrow_address(&s) ``` -------------------------------- ### Prover Configuration File Example Source: https://github.com/aptos-labs/aptos-core/blob/main/third_party/move/documentation/book/src/prover-guide.md Example TOML file for configuring the Move Prover. Shows default values for verbosity, tracing, reporting, solver timeouts, and concurrency. ```toml # Verbosity level # Possible values: "ERROR", "WARN", "INFO", "DEBUG". Each level subsumes the output of the previous one. verbosity_level = "INFO" [prover] # Set auto-tracing level, which enhances the diagnosis the prover produces on verification errors. # Possible values: "Off", "VerifiedFunction", "AllFunctions" auto_trace_level = "Off" # Minimal severity level for diagnosis to be reported. # Possible values: "Error", "Warning", "Note" report_severity = "Warning" [backend] # Timeout in seconds for the solver backend. Note that this is a soft timeout and may not always # be respected. vc_timeout = 40 # Random seed for the solver backend. Different seeds can result in different verification run times, # as the solver uses heuristics. random_seed = 1 # The number of processor cores to assume for concurrent checking of verification conditions. proc_cores = 4 ``` -------------------------------- ### Get Next Creation Number for Address Source: https://github.com/aptos-labs/aptos-core/blob/main/third_party/move/move-stdlib/nursery/docs/guid.md Returns the next available creation number for a GUID generator associated with a specific address. Acquires the Generator resource. ```move public fun get_next_creation_num(addr: address): u64 acquires Generator { if (!exists<Generator>(addr)) { 0 } else { borrow_global<Generator>(addr).counter } } ``` -------------------------------- ### Run API Sanity Checks Source: https://github.com/aptos-labs/aptos-core/blob/main/api/README.md Navigate to the 'api/' directory and run 'make serve' to start a local server for sanity checking the API. Access the spec at http://127.0.0.1:8888/spec.html. ```bash cd api/ make serve ``` -------------------------------- ### Run Indexer GRPC Server with Example Configuration Source: https://github.com/aptos-labs/aptos-core/blob/main/ecosystem/indexer-grpc/indexer-grpc-server-framework/README.md This Rust code defines a sample configuration struct `ExampleConfig` that implements the `RunnableConfig` trait. It shows how to initialize and run the server with this custom configuration. ```rust #[derive(Clone, Debug, Deserialize, Serialize)] #[serde(deny_unknown_fields)] pub struct ExampleConfig { pub name: String, } impl RunnableConfig for ExampleConfig { fn run(&self) -> Result<()> { println!("Hello, {}!", self.name); Ok(()) } fn get_server_name(&self) -> String { "srv_exp".to_string() } } #[tokio::main] async fn main() -> anyhow::Result<()> { let args = ServerArgs::parse(); args.run::().await } ``` -------------------------------- ### Valid Function Naming Conventions Source: https://github.com/aptos-labs/aptos-core/blob/main/third_party/move/documentation/book/src/functions.md Shows examples of valid function names in Move, adhering to the rules that names must start with a letter and can contain letters, digits, and underscores. ```move module 0x42::example { // all valid fun FOO() {} fun bar_42() {} fun bAZ19() {} // invalid fun _bAZ19() {} // Function names cannot start with '_' } ``` -------------------------------- ### Standard Move.toml with Addresses and Dependencies Source: https://github.com/aptos-labs/aptos-core/blob/main/third_party/move/documentation/book/src/modules-and-packages.md An example Move.toml including license, named addresses, local and git dependencies, and dev addresses. ```toml [package] name = "AName" version = "0.0.0" license = "Apache 2.0" [addresses] address_to_be_filled_in = "_" specified_address = "0xB0B" [dependencies] # Local dependency LocalDep = { local = "projects/move-awesomeness", addr_subst = { "std" = "0x1" } } # Git dependency MoveStdlib = { git = "https://github.com/aptos-labs/aptos-framework", subdir="move-stdlib", rev = "mainnet" } [dev-addresses] # For use when developing this module address_to_be_filled_in = "0x101010101" ``` -------------------------------- ### Initialize State for Benchmarking Source: https://github.com/aptos-labs/aptos-core/blob/main/aptos-move/replay-benchmark/README.md The 'initialize' command prepares the input states for benchmarking by executing downloaded transactions and capturing read-sets. Specify the transaction file, output file, and the REST endpoint used for downloading. ```shell aptos-replay-benchmark initialize \ --transactions-file T \ --inputs-file I \ --rest-endpoint E ``` -------------------------------- ### Custom Contract Only Configuration Example Source: https://github.com/aptos-labs/aptos-core/blob/main/crates/aptos-telemetry-service/SPEC.md Configuration for a setup that relies solely on custom contracts for authentication, specifying on-chain authentication methods and metrics sinks. It allows unknown nodes and configures Victoria Metrics. ```yaml address: "0.0.0.0:443" # No standard node configuration - custom contracts only custom_contract_configs: - name: "storage_providers" on_chain_auth: chain_id: 1 method: view_function resource_path: "0x123::registry::get_providers" address_list_field: "[0].address" allow_unknown_nodes: true metrics_sinks: - type: victoria_metrics endpoint_url: "https://vm.example.com/api/v1/import/prometheus" key_env_var: "VM_STORAGE_TOKEN" ``` -------------------------------- ### Valid and Invalid Variable Names Source: https://github.com/aptos-labs/aptos-core/blob/main/third_party/move/documentation/book/src/variables.md Shows examples of valid and invalid variable names according to Move's naming conventions. Names can include underscores, letters, and digits, but must start with a letter or underscore. ```move script { fun example() { // all valid let x = e; let _x = e; let _A = e; let x0 = e; let xA = e; let foobar_123 = e; // all invalid let X = e; // ERROR! let Foo = e; // ERROR! } } ``` -------------------------------- ### Move Script Syntax Example Source: https://github.com/aptos-labs/aptos-core/blob/main/third_party/move/documentation/book/src/modules-and-packages.md Demonstrates the structure of a Move script, including use declarations, constants, and the main function. Scripts are ephemeral and do not access global storage. ```move script { // Import the debug module published at the named account address std. use std::debug; const ONE: u64 = 1; fun main(x: u64) { let sum = x + ONE; debug::print(&sum) } } ``` -------------------------------- ### Module Naming Conventions Source: https://github.com/aptos-labs/aptos-core/blob/main/third_party/move/documentation/book/src/modules-and-packages.md Provides examples of valid module names, adhering to character restrictions and typical naming conventions. Module names often start with a lowercase letter and correspond to the source file name. ```move module my_module {} ``` ```move module foo_bar_42 {} ``` -------------------------------- ### Indexer GRPC File Store Backfiller Configuration Source: https://github.com/aptos-labs/aptos-core/blob/main/ecosystem/indexer-grpc/indexer-grpc-file-store-backfiller/README.md Example configuration for the Indexer GRPC file store backfiller. Ensure 'your.node.address', 'your-gcs-bucket-name', and '/secrets/your-service-account-key' are replaced with your specific details. The 'chain_id' and 'starting_version' should be set according to your network and desired backfill start point. ```yaml health_check_port: 8081 server_config: fullnode_grpc_address: >- http://your.node.address:50051 file_store_config: file_store_type: GcsFileStore gcs_file_store_bucket_name: your-gcs-bucket-name gcs_file_store_service_account_key_path: /secrets/your-service-account-key enable_compression: true progress_file_path: /path-to-file/progress_tracker.json chain_id: 2 starting_version: 0 transactions_count: 100000000 enable_cache_compression: true ``` -------------------------------- ### Build Documentation with latexmk Source: https://github.com/aptos-labs/aptos-core/blob/main/third_party/move/documentation/safety26/CLAUDE.md Use this command to build the main documentation PDF. Intermediate files are stored in the build directory. ```bash latexmk main.tex ``` -------------------------------- ### Install cargo-binstall Source: https://github.com/aptos-labs/aptos-core/blob/main/scripts/binary_release/CARGO_BINSTALL.md Command to install the cargo-binstall tool. This is a prerequisite for testing binary installations. ```bash cargo install cargo-binstall ``` -------------------------------- ### Unit Test Output Example Source: https://github.com/aptos-labs/aptos-core/blob/main/aptos-move/move-examples/move-tutorial/README.md Example output from running `aptos move test`, showing the status of various unit tests for the basic_coin module. ```text INCLUDING DEPENDENCY MoveStdlib BUILDING basic_coin Running Move unit tests [ PASS ] 0xcafe::basic_coin::can_withdraw_amount [ PASS ] 0xcafe::basic_coin::init_check_balance [ PASS ] 0xcafe::basic_coin::init_non_owner [ PASS ] 0xcafe::basic_coin::publish_balance_already_exists [ PASS ] 0xcafe::basic_coin::publish_balance_has_zero [ PASS ] 0xcafe::basic_coin::withdraw_dne [ PASS ] 0xcafe::basic_coin::withdraw_too_much Test result: OK. Total tests: 7; passed: 7; failed: 0 ``` -------------------------------- ### Install cargo-criterion-means Source: https://github.com/aptos-labs/aptos-core/blob/main/crates/aptos-crypto/benches/README.md Install the cargo-criterion-means tool, which is used for running and analyzing benchmarks. Ensure you have Rust and Cargo installed. ```bash cargo install cargo-criterion-means ``` -------------------------------- ### Entry Function Invocation Examples Source: https://github.com/aptos-labs/aptos-core/blob/main/third_party/move/documentation/book/src/functions.md Demonstrates how `entry` functions can be called from modules, scripts, and other entry functions. It highlights that `entry` functions can be invoked from various contexts. ```move address 0x42 { module m { public entry fun foo() {} fun calls_foo() { foo(); } // valid! } module n { fun calls_m_foo() { 0x42::m::foo(); // valid! } } module other { public entry fun calls_m_foo() { 0x42::m::foo(); // valid! } } } script { fun calls_m_foo() { 0x42::m::foo(); // valid! } } ``` -------------------------------- ### Run Standalone Indexer Fullnode Source: https://github.com/aptos-labs/aptos-core/blob/main/ecosystem/indexer-grpc/README.md This command sequence starts a single aptos-node in test mode, creates a data directory, and then restarts it with Indexer GRPC enabled via configuration. ```bash mkdir test_indexer_grpc cargo run -p aptos-node -- --test --test-dir test_indexer_grpc ``` ```bash cargo run -p aptos-node -- --test --test-dir test_indexer_grpc ``` -------------------------------- ### Run Simple Faucet Service Source: https://github.com/aptos-labs/aptos-core/blob/main/testsuite/forge-cli/src/README.md Starts a local faucet service for minting coins in a test network. Requires the root key and node URL obtained from the swarm startup. ```bash cargo run -p aptos-faucet-service -- run-simple --key --node-url ``` -------------------------------- ### Minimal Move.toml Example Source: https://github.com/aptos-labs/aptos-core/blob/main/third_party/move/documentation/book/src/modules-and-packages.md A basic Move.toml file demonstrating the minimum required package metadata. ```toml [package] name = "AName" version = "0.0.0" ``` -------------------------------- ### Download Aptos Framework Bytecode Source: https://github.com/aptos-labs/aptos-core/blob/main/terraform/aptos-node/gcp/README.md Download the Aptos Framework release and unzip it into a `framework` folder. This step is necessary for test mode. ```bash $ unzip framework.zip ``` -------------------------------- ### Install Specific Version of move-flow on Windows Source: https://github.com/aptos-labs/aptos-core/blob/main/aptos-move/flow/RELEASE.md Install a specific version of move-flow on Windows by providing the -Version flag to the install script. ```powershell . install.ps1 -BinaryName move-flow -Version 0.1.0 ``` -------------------------------- ### Install move-flow using cargo-binstall Source: https://github.com/aptos-labs/aptos-core/blob/main/aptos-move/flow/RELEASE.md If the aptos-move-flow crate is published to crates.io, you can install it using cargo-binstall. Ensure cargo-binstall is installed first. ```bash # Install cargo-binstall if you haven't already ``` ```bash cargo install cargo-binstall ``` ```bash # Install move-flow (downloads pre-built binary) ``` ```bash cargo binstall aptos-move-flow ``` -------------------------------- ### Run AMM Example with Move Prover Source: https://github.com/aptos-labs/aptos-core/blob/main/third_party/move/move-prover/doc/higher-order-paper-26/CLAUDE.md Execute the AMM example through the Move Prover with specific configurations. The `--split-vcs-by-assert` flag is recommended for performance. Language version 2.4 is required for certain syntax. ```bash cargo run -p move-prover -- \ --language-version 2.4 \ -d third_party/move/move-stdlib/sources \ -a std=0x1 \ --split-vcs-by-assert \ third_party/move/move-prover/doc/higher-order-paper-26/examples/sources/amm_example.move ``` -------------------------------- ### Build and Publish Aptos Protos Package Source: https://github.com/aptos-labs/aptos-core/blob/main/protos/python/CONTRIBUTING.md Builds the package and publishes it to PyPi using Poetry. Ensure the changelog is updated and the version is bumped before publishing. ```bash poetry publish --build ``` -------------------------------- ### Internal GUID Creation Implementation Source: https://github.com/aptos-labs/aptos-core/blob/main/third_party/move/move-stdlib/nursery/docs/guid.md Internal implementation for creating a GUID. It borrows the Generator resource mutably, increments its counter, and constructs the GUID. ```move fun create_impl(addr: address): guid::GUID acquires Generator { let generator = borrow_global_mut<Generator>(addr); let creation_num = generator.counter; generator.counter = creation_num + 1; GUID { id: ID { creation_num, addr } } } ``` -------------------------------- ### Check Aptos CLI Version Source: https://github.com/aptos-labs/aptos-core/blob/main/aptos-move/move-examples/move-tutorial/README.md Verify that the installed Aptos CLI version is compatible with the tutorial. A specific version (e.g., 1.0.7) is recommended. ```shell > aptos --version aptos 1.0.7 ``` -------------------------------- ### Start Validator Testnet Node Source: https://github.com/aptos-labs/aptos-core/blob/main/docker/compose/indexer-grpc/README.md Use this command to start the validator node in detached mode. Ensure it is running before starting the Indexer GRPC. ```bash docker-compose up -d ``` -------------------------------- ### Example Module Loading Source: https://github.com/aptos-labs/aptos-core/blob/main/third_party/move/mono-move/loader/DESIGN.md Demonstrates eager lowering of a function when a module is loaded, assuming string layout is available. This is relevant for framework module dependencies. ```move module 0x23::a { struct A { x: 0x1::std::String, y: u64 } public fun f(x: &A): u64 { x.y } } ``` -------------------------------- ### Add a New Benchmark Project Source: https://github.com/aptos-labs/aptos-core/blob/main/aptos-move/aptos-vm-benchmarks/README.md Steps to add a new benchmark project by creating a directory, initializing a Move project within it, and navigating to the correct directory. ```Bash cd aptos-vm-benchmarks/samples mkdir proj-name cd proj-name cargo run -p aptos -- move init --name proj-name ``` -------------------------------- ### Debug Aptos Homebrew Installation Source: https://github.com/aptos-labs/aptos-core/blob/main/crates/aptos/homebrew/README.md Use these flags with the 'brew install' command for interactive debugging or to enable debug mode when encountering installation problems. ```bash brew install aptos --interactive ``` ```bash brew install aptos -d ``` -------------------------------- ### Dockerfile FROM Statement Examples Source: https://github.com/aptos-labs/aptos-core/blob/main/docker/builder/README.md When creating a new Dockerfile, use these FROM statements to reference the required builder images. These are injected as build contexts. ```dockerfile FROM node-builder ``` ```dockerfile FROM tools-builder ``` -------------------------------- ### Install Specific Version of move-flow on Unix/Linux/macOS Source: https://github.com/aptos-labs/aptos-core/blob/main/aptos-move/flow/RELEASE.md Install a specific version of move-flow on Unix-like systems by providing the --version flag to the installation script. ```bash curl -fsSL https://raw.githubusercontent.com/aptos-labs/aptos-core/main/scripts/binary_release/install_binary.sh | sh -s -- move-flow --version 0.1.0 ``` -------------------------------- ### Run Aptos Faucet Service (Simple Mode) Source: https://github.com/aptos-labs/aptos-core/blob/main/crates/aptos-faucet/README.md Use this command to run the faucet in a simplified mode, suitable for local testing. It requires a private key, node URL, and chain ID. ```bash cargo run -p aptos-faucet-service -- run-simple --key --node-url --chain-id TESTING ``` -------------------------------- ### Docker Image Tagging Examples Source: https://github.com/aptos-labs/aptos-core/blob/main/docker/IMAGE_TAGGING.md Illustrates various combinations of build profiles and features applied to the image tag prefix, showing the resulting tag format. ```shell aptos-node-v1.2.3 ``` ```shell aptos-node-v1.2.3_performance ``` ```shell aptos-node-v1.2.3_failpoints ``` ```shell aptos-node-v1.2.3_performance_failpoints ``` -------------------------------- ### Importing Modules with Aliases Source: https://github.com/aptos-labs/aptos-core/blob/main/third_party/move/documentation/book/src/modules-and-packages.md Demonstrates importing modules and creating aliases for them. `use
::;` is equivalent to `use
:: as ;`. ```move script { use std::vector; use std::vector as V; } ``` -------------------------------- ### Initialize Terraform with Backend Configuration Source: https://github.com/aptos-labs/aptos-core/blob/main/terraform/fullnode/gcp/README.md Initializes Terraform, configuring it to use the specified backend storage for state management. This downloads necessary providers. ```bash terraform init -backend-config ~/$WORKSPACE/backend.tfvars ```