> For the complete documentation index, see [llms.txt](https://docs.bloclabs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.bloclabs.com/api/core-concepts/wallet-management.md).

# Wallet Management

## Overview

The BlocWise Wallet API enables you to create and manage different types of blockchain wallets through RESTful endpoints. This guide will help you understand the basics and get started with wallet integration.

### Quick Start

```bash
# Create a new wallet
curl -X POST https://api.bloclabs.com/v1/wallets/create \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "mpc",
    "network": "ethereum",
    "label": "My First Wallet"
  }'
```

### Wallet Types

We support four types of wallets, each designed for specific use cases:

#### 1. MPC Wallet (Recommended)

Best for applications requiring high security and institutional-grade features.

```bash
POST /v1/wallets/create
```

Request:

```json
{
    "type": "mpc",
    "network": "ethereum",
    "label": "Secure Trading Wallet",
    "environment": "mainnet"
}
```

Response:

```json
{
    "status": "success",
    "data": {
        "wallet_id": "wallet_123abc",
        "address": "0x123...abc",
        "type": "mpc",
        "network": "ethereum",
        "label": "Secure Trading Wallet",
        "created_at": "2024-03-15T10:30:00Z"
    }
}
```

**Key Features:**

* Distributed key generation
* No single point of failure
* Enterprise-grade security
* Multi-signature support

#### 2. HD Wallet

Ideal for personal wallets and standard cryptocurrency applications.

```bash
POST /v1/wallets/create
```

Request:

```json
{
    "type": "hd",
    "network": "polygon",
    "label": "Personal Wallet",
    "environment": "mainnet"
}
```

Response:

```json
{
    "status": "success",
    "data": {
        "wallet_id": "wallet_456def",
        "address": "0x456...def",
        "type": "hd",
        "network": "polygon",
        "label": "Personal Wallet",
        "created_at": "2024-03-15T10:35:00Z"
    }
}
```

#### 3. Watch Wallet

Perfect for portfolio tracking and monitoring addresses.

```bash
POST /v1/wallets/watch
```

Request:

```json
{
    "address": "0x789...ghi",
    "network": "ethereum",
    "label": "Portfolio Tracker",
    "notifications": {
        "large_transfers": true,
        "incoming_transactions": true
    }
}
```

Response:

```json
{
    "status": "success",
    "data": {
        "wallet_id": "watch_789ghi",
        "address": "0x789...ghi",
        "type": "watch",
        "network": "ethereum",
        "label": "Portfolio Tracker"
    }
}
```

### Common Operations

#### Checking Wallet Balance

```bash
GET /v1/wallets/{wallet_id}/balance
```

Response:

```json
{
    "status": "success",
    "data": {
        "balance": "1.5",
        "currency": "ETH",
        "usd_value": "3000.00",
        "updated_at": "2024-03-15T10:40:00Z"
    }
}
```

#### Sending Transactions

```bash
POST /v1/wallets/{wallet_id}/transfer
```

Request:

```json
{
    "to": "0x789...def",
    "amount": "1.5",
    "asset": "ETH",
    "gas_priority": "medium"
}
```

Response:

```json
{
    "status": "success",
    "data": {
        "transaction_id": "tx_123abc",
        "status": "pending",
        "hash": "0xabc...",
        "estimated_completion_time": "2024-03-15T10:45:00Z"
    }
}
```

#### Get Transaction Status

```bash
GET /v1/wallets/{wallet_id}/transactions/{transaction_id}
```

Response:

```json
{
    "status": "success",
    "data": {
        "transaction_id": "tx_123abc",
        "status": "confirmed",
        "hash": "0xabc...",
        "block_number": 15481234,
        "confirmations": 12
    }
}
```

### Error Handling

Common error responses:

```json
{
    "status": "error",
    "message": "Invalid network specified",
    "errors": [
        {
            "type": "validation_error",
            "message": "Network must be one of: ethereum, polygon, binance",
            "field": "network"
        }
    ]
}
```

### Best Practices

#### Security

1. Always verify transaction details
2. Implement proper error handling
3. Use appropriate authentication methods
4. Regular security audits

#### Performance

1. Cache wallet data when appropriate
2. Batch balance updates
3. Implement proper error handling
4. Use webhooks for real-time updates

### Next Steps

* Advanced Wallet Operations
* Transaction Management
* Security Best Practices
* API Reference
