• LOGIC
  • STATE
  • ERROR
  • HUMAN

How to debug Aptos smart contracts with your AI

Connect Aptoscan to your AI client to pull live blockchain data. Your agent can then analyze code and state to find bugs.

Ask AI about this page

Short answer

How can I debug Aptos smart contracts using AI?

Your AI uses Aptoscan to pull Move modules and account resources. It compares the on-chain state against your expected logic to find where things broke. You get a clear view of the mismatch.

Where findings land.

Debugging outcomes.

The AI categorizes what it finds based on the blockchain data.

LOGIC

Code mismatches

The AI compares published modules to your local code. It finds where the on-chain logic deviates from your intent.

STATE

Resource errors

The agent checks account resources to find missing or incorrect data. This shows why a contract requirement failed.

ERROR

Root causes

The AI maps transaction reverts to specific resource states. You get a direct explanation of the failure.

HUMAN

Manual fixes

The AI flags complex state issues that you must fix manually. It tells you which resources need updating.

The workflow

What your AI does when a failure occurs.

Your agent pulls the data so you don't have to hunt through an explorer.

  1. Fetch module code

    The agent pulls the Move bytecode and module structure from the chain.

    get_account_modules
  2. Inspect account state

    The agent looks at the data stored in an account to check for required resources.

    get_account_resources
  3. Compare logic and data

    The agent cross-references module logic with current resource values to find the break point.

    get_account_modulesget_account_resources
  4. Report the bug

    The agent explains the mismatch in plain English, pointing to the specific constraint that caused the revert.

    get_account_modulesget_account_resources

Try it

Copy these to start.

Use these prompts to begin your debugging session.

Starting points

Swap the account addresses and module names for your own data.

Aptoscan Connector

You're all set. Choose your MCP client and follow the setup instructions.

Connector linkhttps://edge.vinkius.com/vk_preview_AJDAKtI9KbTNthRPjchKPh8F2JivrqoEQtxbJRTs/mcp

Claude Desktop

Follow the steps below to connect in seconds.

  1. 1In Claude Desktop, open Settings → Connectors.
  2. 2Click “Add custom connector” and paste the connector link above as the remote MCP server URL.
  3. 3Click Add and start a new chat — Aptoscan capabilities are ready to use.
Configuration · claude_desktop_config.jsonCopy
{
  "mcpServers": {
    "aptoscan-aptos-blockchain-explorer-api-mcp": {
      "url": "https://edge.vinkius.com/vk_preview_AJDAKtI9KbTNthRPjchKPh8F2JivrqoEQtxbJRTs/mcp"
    }
  }
}
Copy into chat04
  • Check the resources for account 0x123... and tell me if the required storage is present.

  • Look at the modules for 0xabc... and explain why this specific function might be failing.

  • Compare the account resources at 0x456... with the logic in the published module.

  • Analyze the state of account 0x789... to find why my transaction is reverting.

  • Claude
  • ChatGPT
  • Cursor
  • VS Code
  • Windsurf
  • Claude Code
  • JetBrains
  • Cline

Start here

Connect Aptoscan once, then ask.

Link the MCP to your client. Your credentials stay encrypted, and you can start querying the chain immediately.

Connect Aptoscan to your AI

FAQ

How this task behaves.

  • 01

    Can the AI fix my smart contract?

    No. The AI identifies the bug and suggests code, but you must deploy the fix yourself.

  • 02

    Can the AI send transactions?

    No. This MCP only provides read access to modules and resources. It cannot sign or send transactions.

  • 03

    Does the AI see my private keys?

    No. The AI only accesses public on-chain data through the Aptoscan tools.

  • 04

    Can it debug my local files?

    The AI can debug local files if you provide them in chat, but it uses Aptoscan to verify them against the chain.

  • 05

    How does it know which module to check?

    You tell the AI which account or module to look at, and it uses the tools to fetch that data.

  • More questions about Aptoscan? See everything the Aptoscan Connector can do

Connect Aptoscan to Claude, Cursor, ChatGPT & more