githubEdit

Aptos (APT)

Aptos Network API Reference for seamless interaction with APT nodes, enabling fast, secure, and scalable transactions on a next-generation Layer 1 blockchain.

Overview of Aptos Network Methods

Aptos is a Layer 1 blockchain built with the Move programming languagearrow-up-right, designed to deliver a fast, secure, scalable, and upgradeable ecosystem. With its modular architecture, Aptos enables frequent upgrades, rapid adoption of new technologies, and strong support for emerging use cases. The Aptos API provides developers with the ability to interact with the blockchain seamlessly and possibly. You can do the following with the Aptos API:

  1. Query real-time blockchain data

  2. Manage and monitor accounts and balances

  3. Interact with smart contracts

  4. Submit and track transactions

  5. Monitor network activity in real-time

Each method will provide you with the following:

  1. Clear description of functionality and use cases

  2. Required input parameters

  3. Sample requests and responses

  4. Supported network

  5. Code example

  6. Integration

Note: This API is compatible only with Aptos Mainnet.

Quickstart

In this section, you will learn how to make your first call with either:

  • Axios

  • Python

Quickstart with Axios

Before you begin, you must have already installed npm or yarn on your local machine. If not, check out npmarrow-up-right or yarnarrow-up-right.

  1. Set up your project using this command:

    For npm:

Or yarn:

This creates a project directory named aptos-api-quickstart and initialises a Node.js project within it.

  1. Install Axios using this command: Using npm:

    Using yarn:

  2. Create a new file and name it index.js. This is where you will make your first call.

  3. Set ES module "type": "module" in your package.json.

  4. Add the following code to the file (index.js):

    Replace <ACCESS_TOKEN> with your actual access token from GetBlock.

  5. Run the script:

    The sequence number and authentication key log in your console like this:

Quickstart with Python and Requests

Before you begin, you must have installed Python and Pip on your local machine.

  1. Set up your project using this command:

  2. Set up a virtual environment to isolate dependencies:

  3. Install the requests library:

  4. Create a new file called main.pyarrow-up-right and insert the following code:

    Replace <ACCESS_TOKEN> with your actual access token from GetBlock.

  5. Run the script:

Endpoint Grouping

  1. Blockchain Information

    • /v1

  2. Account-Related

    • /v1/accounts/{account_hash}

    • /v1/accounts/{account_hash}/resources

    • /v1/accounts/{account_hash}/resource/{resource_type}

    • /v1/accounts/{account_hash}/modules

    • /v1/accounts/{account_hash}/module/{module_name}

    • /v1/accounts/{account_hash}/transactions

  3. Events

    • /v1/accounts/{account_hash}/events/{creation_number}

    • /v1/accounts/{account_hash}/events/{event_handle}/{field_name}

  4. Blocks

    • /v1/blocks/by_height/{block_height}

    • /v1/blocks/by_version/{version}

  5. Transactions

    • /v1/transactions

    • /v1/transactions/by_hash/{transaction_hash}

    • /v1/transactions/by_version/{version}

  6. Additional Utility

    • /v1/estimate_gas_price

Last updated

Was this helpful?