# Lineascan MCP

> Lineascan MCP Server connects your AI agent directly to the Linea blockchain data. Check ETH balances for multiple addresses, track ERC-20 and NFT transfers in real time, or fetch ABI and source code for smart contracts—all via tool calls. It lets you analyze complex L2 transactions without leaving your IDE.

## Overview
- **Category:** developer-tools
- **Price:** Free
- **Tags:** linea, ethereum-l2, block-explorer, smart-contracts, web3

## Description

Yo, listen up. The **Lineascan MCP Server** hooks your AI agent right into the Linea blockchain data. It gives you a ton of tools to read and inspect everything happening on the EVM—no leaving your IDE for this mess. You're gonna be able to track complex L2 transactions without breaking a sweat.

### Checking Balances and Supply
When you need to know who's got cash, you can use `get_balance` to grab the ETH balance for just one address. If ya gotta check multiple accounts at once, hit up `balance_multi`; it gets ETH balances for a list of addresses all in one go. For big picture stuff, `eth_supply` returns the total circulating supply amount of ETH on Linea. You can also see how much gas you're gonna spend by running `eth_estimate_gas`, which calculates the required gas for any specific transaction operation.

### Tracking Assets and Transfers
To follow token movements, use `token_tx` to list every ERC-20 standard token transfer event associated with an address. If you're tracking NFTs (those are ERC-721s), `token_nft_tx` lists all those specific NFT transfer events for a given address and includes full metadata. For general activity, `tx_list` gets a list of normal, successful transactions tied to an address, while `tx_list_internal` pulls in the internal calls that happened during execution.

### Analyzing Transactions Deeply
Need the nitty-gritty on a transaction? You can get full details about a single transfer using its hash with `eth_get_transaction_by_hash`. Once the transaction's done, you retrieve the final results—the receipt data—using `eth_get_transaction_receipt`. If you need to monitor something live, `get_status` checks the execution status of an ongoing transaction. To confirm a past transaction finished right, use `get_tx_receipt_status` to verify the final outcome and status from a previous receipt. You can also check event logs from any contract using `get_logs`, giving you filtering options like address or topic. For tracking general activity history on an account, `get_mined_blocks` lists every block mined by that specific wallet address.

### Understanding the Network State
If you wanna know what's going down with the network itself, you can grab the number of the most recent block using `eth_block_number`. Need data for a specific historical moment? Run `eth_get_block_by_number` to pull all info related to a specified block. You can also find out which block corresponds to a certain time stamp with `get_block_no_by_time`, or figure out the timestamp from a block number using `get_block_countdown`. For rewards, `get_block_reward` retrieves the block and uncle rewards for any given block number. If you wanna know what's going on right now, `eth_price` gives you the current market price of ETH in both USD and BTC.

### Reading Smart Contract Code
When you need to understand how a contract works, these tools are your ticket. To read its logic, you can fetch the Application Binary Interface (ABI) using `get_abi`. If you wanna see the original code, `get_source_code` retrieves the source for verified smart contracts. You also have control over submitting new code by running `verify_source_code`, which sends a contract's source to Lineascan for official verification. When that submission is in progress, you can check its live status using `check_verify_status`.

### Advanced Data Retrieval and Calls
Sometimes ya don't wanna send a transaction just to read data. For that, run `eth_call`; it executes a read-only message call without spending gas or creating any actual transaction. You can also get all the event logs from a contract using `get_logs`, giving you filtering options like address or topic.

This server gives ya everything: tracking assets with **`token_tx`** and **`token_nft_tx`**, checking balances with **`balance_multi`** and **`get_balance`**, pulling code with **`get_source_code`** and **`get_abi`**, analyzing transaction history using **`eth_get_transaction_by_hash`** and **`get_status`**, and monitoring the network state using **`eth_block_number`** and **`eth_price`**. It's everything you need, period.

## Tools

### balance_multi
Gets ETH balances for a list of multiple addresses at once.

### check_verify_status
Checks the current status of a contract verification request.

### eth_block_number
Returns the number of the most recent block on the network.

### eth_call
Executes a read-only message call without spending gas or creating a transaction.

### eth_estimate_gas
Calculates an estimate of the gas required for a specific transaction operation.

### eth_get_block_by_number
Retrieves all information associated with a specified block number.

### eth_get_transaction_by_hash
Returns full details about a single transaction using its hash.

### eth_get_transaction_receipt
Retrieves the receipt data for a completed transaction using its hash.

### eth_price
Gets the current market price of ETH in both USD and BTC.

### eth_supply
Returns the total circulating supply amount of ETH on Linea.

### get_abi
Fetches the Application Binary Interface (ABI) for a verified smart contract.

### get_balance
Gets the ETH balance for one specific address.

### get_block_countdown
Provides an estimate of time until the next block is mined.

### get_block_no_by_time
Finds the corresponding block number given a specific timestamp.

### get_block_reward
Retrieves block and uncle rewards for a given block number.

### get_logs
Gets event logs from a contract with filtering options like address or topic.

### get_mined_blocks
Lists all blocks that were mined by a specific wallet address.

### get_source_code
Retrieves the original source code for a verified smart contract.

### get_status
Checks the live execution status of an ongoing transaction.

### get_tx_receipt_status
Verifies the final outcome and status of a past transaction receipt.

### token_nft_tx
Lists all ERC-721 (NFT) token transfer events for a specified address.

### token_tx
Lists all ERC-20 standard token transfer events for a specified address.

### tx_list_internal
Retrieves internal transactions that occurred during the execution flow for an address.

### tx_list
Gets a list of normal, successful transactions associated with an address.

### verify_source_code
Submits a contract's source code to Lineascan for official verification.

## Prompt Examples

**Prompt:** 
```
What is the ETH balance of the address 0x1234567890abcdef1234567890abcdef12345678?
```

**Response:** 
```
I've checked the balance for that address on Linea. It currently holds 1.25 ETH.
```

**Prompt:** 
```
List the last 5 ERC-20 token transfers for address 0xabc...123.
```

**Response:** 
```
I found the recent ERC-20 transfers for that address. The most recent ones include transfers of USDC and WETH. Would you like the specific transaction hashes?
```

**Prompt:** 
```
Get the ABI and source code for the contract at 0x789...def.
```

**Response:** 
```
I've retrieved the data for the contract. It is a verified 'LiquidityPool' contract. I have the ABI ready for function calls and the Solidity source code for your review.
```

## Capabilities

### Check Balances
Get ETH balances for single or multiple addresses on the Linea network.

### Track Token Movements
Retrieve lists of ERC-20 and ERC-721 (NFT) transfers associated with an address, including full metadata.

### Examine Contract Code
Fetch the ABI or Solidity source code for verified smart contracts to understand their logic.

### Analyze Transactions
Query specific transaction details, including normal transfers, internal calls, and full receipt status via hash.

### Estimate Network Costs
Generate estimates for required gas to prevent failed transactions during execution planning.

## Use Cases

### Auditing a DeFi Pool
A security auditor needs to know if an address dumped funds recently. They ask their agent: 'Show me all ERC-20 and NFT transfers for 0x...'. The agent runs `token_tx` and `token_nft_tx`, giving the auditor a single, filtered list of all asset movements across time.

### Monitoring Investor Holdings
A data analyst needs to check the holdings of five major venture funds. Instead of running five manual balance checks, they use `balance_multi` to get the ETH balances for all five addresses instantly, building a quick overview.

### Debugging Smart Contract Logic
A developer runs into an unexpected function call. They ask their agent: 'What is the source code and ABI for contract 0x...?' The agent executes `get_source_code` and `get_abi`, allowing the developer to debug the logic without leaving their IDE.

### Tracing Failed Transactions
A user submitted a transaction that failed. They ask: 'Why did this fail?'. The agent first runs `eth_get_transaction_by_hash` for context, then uses `get_tx_receipt_status` to pinpoint the exact failure state and potential cause.

## Benefits

- Automated Balance Checks: Use `balance_multi` to check the ETH balances of dozens of addresses in one query. No need to paste them into a spreadsheet and check them manually.
- Deep Transaction History: Get full records by running `token_tx` or `token_nft_tx`. This goes beyond basic transaction hashes, giving you every associated token transfer event metadata.
- Code Inspection on Demand: Need to know what a contract does? Use `get_source_code` or `get_abi`. Your agent pulls the Solidity code directly into your workspace for review.
- Pre-Flight Gas Checks: Run `eth_estimate_gas` before submitting anything. This stops failed transactions due to unexpected gas costs, saving you time and Ether.
- Comprehensive Status Tracking: Don't trust a simple 'success' flag. Use `get_tx_receipt_status` to confirm the final outcome of any transaction hash.

## How It Works

The bottom line is: you write natural language instructions, and your AI client converts them into precise blockchain data queries.

1. Subscribe to the Lineascan server and provide your API key.
2. Instruct your AI client (like Cursor or Claude) to use a specific tool, like `balance_multi`, providing the target addresses.
3. The agent executes the call; the server returns the requested ETH balances directly.

## Frequently Asked Questions

**How do I find out what tokens were transferred? (using token_tx)**
The `token_tx` tool lists all ERC-20 transfers for a given address. This is the right tool if you are tracking standard, fungible tokens like USDC or WETH.

**What's the difference between `get_balance` and `balance_multi`?**
`get_balance` checks one single address. Use `balance_multi` when you need to check ETH balances for a list of multiple addresses at once.

**Can I see the source code without leaving my IDE? (using get_source_code)**
Yes, that's exactly what this tool does. You ask your agent to run `get_source_code` for a contract hash, and it pulls the Solidity code directly into your environment.

**Which tool should I use to see all transaction types? (using tx_list)**
`tx_list` gives you normal transactions. However, if you are looking for token movements, you must use `token_tx` or `token_nft_tx` instead.

**How do I check the status of a transaction that failed? (using get_tx_receipt_status)**
You run `get_tx_receipt_status` using the hash. This provides final confirmation on whether the contract completed, failed, or reverted, giving you more detail than just viewing the raw transaction.

**How do I estimate the required gas for a transaction using `eth_estimate_gas`?**
It generates an accurate cost prediction. You pass in the function parameters, and the tool returns the estimated amount of gas needed. This lets you plan your budget before running a live transaction.

**How can I find out what block was mined at a specific time using `get_block_no_by_time`?**
It takes a Unix timestamp and returns the corresponding block number. This is critical for historical analysis when you only have a date, not a transaction hash.

**What kind of data can I pull for an entire block using `eth_get_block_by_number`?**
You provide the block number, and it returns comprehensive details about that specific block. This includes timestamps, parent hashes, and a list of all transactions confirmed within it.

**Can I check the ETH balance of multiple wallet addresses at once?**
Yes! Use the `balance_multi` tool and provide a comma-separated list of addresses. The agent will return the current ETH balance for each one in a single request.

**How can I see the history of NFT transfers for a specific address?**
You can use the `token_nft_tx` tool. Just provide the wallet address, and optionally a contract address, to list all ERC-721 token transfer events associated with that account.

**Is it possible to read the source code of a verified smart contract?**
Absolutely. Use the `get_source_code` tool with the contract's address. If the contract is verified on Lineascan, the agent will retrieve the full source code for your inspection.