> ## Documentation Index
> Fetch the complete documentation index at: https://docs.portalhq.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Enhance your wallets' security with Blockaid

> Learn how to integrate real-time transaction, address, token, and URL security scanning using Portal's Flutter SDK with Blockaid.

Portal's Flutter SDK integrates with Blockaid to provide real-time security scanning for transactions, addresses, tokens, and URLs. This integration helps detect malicious activity, phishing attempts, scam tokens, and suspicious interactions before users sign or submit transactions.

## Overview

The Blockaid integration enables you to:

* **Scan transactions** before signing or submission (EVM, Solana)
* **Scan addresses** for known malicious actors or compromised contracts
* **Validate tokens** to detect scams or security risks
* **Verify URLs** to prevent phishing attacks

## Prerequisites

Before using Blockaid security scanning, ensure you have:

* A properly initialized Portal client
* Blockaid integration enabled in your Portal Dashboard (see [Blockaid Integration](../../../integrations/Security/blockaid))

## Scanning EVM Transactions

Use `scanEvmTx` to analyze Ethereum transactions before signing or broadcasting them. This method scans EVM transactions for malicious contract interactions, risky approvals, phishing attempts, and other on-chain security threats.

```dart theme={null}
import 'package:portal_flutter/portal_flutter.dart';

final portal = Portal();

Future<void> scanEvmTransaction() async {
  final response = await portal.security.blockaid.scanEvmTx(
    chain: 'eip155:1',
    fromAddress: '0x7C01728004d3F2370C1BBC36a4Ad680fE6FE8729',
    toAddress: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
    txData: '0x095ea7b3...',
    value: '0x0',
    gas: '0x2dc6c0',
    gasPrice: '0x2dc6c0',
    options: ['simulation', 'validation'],
  );

  print('Blockaid EVM scan response: $response');
}
```

***

## Scanning Solana Transactions

Use `scanSolanaTx` to analyze Solana transactions before signing. This method detects malicious program invocations, suspicious token movements, and other Solana-specific risks.

```dart theme={null}
Future<void> scanSolanaTransaction() async {
  final response = await portal.security.blockaid.scanSolanaTx(
    accountAddress: '86xCnPeV69n6t3DnyGvkKobf9FdN2H9oiVDdaMpo2MMY',
    chain: 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp',
    transactions: const [
      'AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAQADCQkVR3SiiKbW0l4c3NBsEn6+zn1o0YsyypPwN0GUhg4K5HK0Tb5GckDLYW+MsovQASt5EZ3bSH3nluRJAE69H61w0BRUDTrpYQcXosUun6/z2BROkRoH/1bL7KLU9s4lCav6k3ZZgV6qeZFwu4pu89WoIGaqUxG4C93XwVmmDy81v8qBaCSP4/UZfdo3q1bud/W+ixymkH8IMe0laQZYrSx4Uhyxec67hYm1VqLV7JTSSYaC/fm7KvWtZOSRzEFT2gMGRm/lIRcy/+ytunLDm+e8jOW7xfcSayxDmzpAAAAAT4tlY/P4mFG1wDJl0ektVggHiZf73lTlHBVJ3fK0nDoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANG5fPtlMEOI/eXV7aPDlpcdLUKm8L3VoW6k/oJlCNLaBQYABQLARQQABgAJAwYAAAAAAAAABzwACQoLCwgyMzQMNQ0ONjcPEDg5EgETFBUWOhEXGBkaGxwdHh8gISI7IyQlJicCKCkqKywtAwQuLzAxPBFVCg8JAQcHBgYBAAAAAwHwCgYBExUbBgICAAAPAwIAAAYBISMoEQQBGQAPAwIAAAYBLjA2DwMCAAAGAgIAAAAIBgYICAADAQkGCQUFBgACBQAEBwEAAAgCAAUMAgAAADwaAAAAAAAABgAFBGDMBQAEPPm21Wu6wrmHu23/ZFNIumpp+ADooZjd4JQgvjnBxkUJAgEDBqWqCgmmCAUIBwu1tp+gcP/+Ri3C1tRXUbPdgqo6rVsj/qnqC959wTdC/mRARysLz9HS09TW19jZ2tsC1QYsNrdxMcm5Nq5FXZrM0IXpEA+ApFa+pz/JvkLz0+2vnwuztLW2t7i5uru8vgAPvBv8VUeRwDy9yD1NHIH5Ji6ZA+zrmpHejKOz4MP8SwrKy8zNzs/S09TVAdY=',
    ],
    encoding: 'base64',
    method: 'signAndSendTransaction',
    options: ['simulation', 'validation'],
  );

  print('Blockaid Solana scan response: $response');
}
```

***

## Scanning Addresses

Use `scanAddress` to analyze a single address for known security risks. This method can be used for both EVM and Solana addresses and detects malicious contracts, compromised wallets, sanctioned addresses, and other flagged entities.

### EVM Address Scan

```dart theme={null}
Future<void> scanEvmAddress() async {
  final response = await portal.security.blockaid.scanAddress(
    chain: 'eip155:1',
    address: '0x31c05d73f2333b5a176cfdbb7c5ef96ec7bb04ac',
  );

  print('Blockaid EVM address scan response: $response');
}
```

### Solana Address Scan

```dart theme={null}
Future<void> scanSolanaAddress() async {
  final response = await portal.security.blockaid.scanAddress(
    chain: 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp',
    address: 'BBQUMqaFELxTFh8r1xSttYMHX6ZKzLWhsmGod2vuxgEc',
  );

  print('Blockaid Solana address scan response: $response');
}
```

***

## Scanning Tokens

Use `scanTokens` to analyze multiple tokens in a single request for known security risks. This method detects scam tokens, honeypots, compromised contracts, and other malicious token behavior.

```dart theme={null}
Future<void> scanTokens() async {
  final response = await portal.security.blockaid.scanTokens(
    chain: 'eip155:1',
    tokens: const [
      '0x66587563e933bbf3974b89156b47bb82b921eb35',
      '0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d',
    ],
  );

  print('Blockaid token scan response: $response');
}
```

***

## Scanning URLs

Use `scanUrl` to detect phishing sites and malicious domains before users navigate to them. This method helps protect users from social engineering attacks and malicious off-chain activity.

```dart theme={null}
Future<void> scanUrl() async {
  final response = await portal.security.blockaid.scanUrl(
    url: 'https://ethlen.com',
  );

  print('Blockaid URL scan response: $response');
}
```

***

## Error Handling

All Blockaid scan methods are async functions that throw a `PortalException` on failure. Wrap calls in a `try`/`catch` block to handle errors gracefully.

```dart theme={null}
import 'package:portal_flutter/portal_flutter.dart';

try {
  final response = await portal.security.blockaid.scanEvmTx(
    chain: 'eip155:1',
    fromAddress: '0x7C01728004d3F2370C1BBC36a4Ad680fE6FE8729',
    toAddress: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
  );
  // Handle successful response
} on PortalException catch (e) {
  print('Blockaid scan failed: ${e.code} - ${e.message}');
}
```

***

## Next Steps

* Learn about [signing transactions](./sign-a-transaction)
* Explore [transaction evaluation](./evaluate-a-transaction)
* Check out the [Blockaid Integration setup](../../../integrations/Security/blockaid)
