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

# createDelegatedEvmWalletClient

> Creates a delegated EVM wallet client for server-side signing operations

## Function Signature

```typescript theme={"system"}
createDelegatedEvmWalletClient(config: {
  environmentId: string;
  apiKey: string;
  baseApiUrl?: string;
  baseMPCRelayApiUrl?: string;
  debug?: boolean;
}): DelegatedEvmWalletClient
```

## Description

Creates a delegated EVM wallet client instance that can be used to perform signing operations on behalf of users who have granted delegation permission. The client uses your server API key for authentication and can work with multiple wallets by accepting wallet-specific credentials for each operation.

This function follows a functional programming paradigm where you create the client once and reuse it for multiple signing operations across different users.

## Parameters

### Required Parameters

* **`environmentId`** (`string`) - Your Dynamic environment ID from the [Dynamic dashboard](/overview/developer-dashboard/tokens-api-keys)
* **`apiKey`** (`string`) - Your server API key for server-to-server authentication

### Optional Parameters

* **`baseApiUrl`** (`string`) - Custom Dynamic API URL. Defaults to `https://app.dynamic.xyz`
* **`baseMPCRelayApiUrl`** (`string`) - Custom MPC relay service URL. Defaults to `https://mpc-relay.dynamic.xyz`
* **`debug`** (`boolean`) - Enable debug logging. Defaults to `false`

## Returns

**`DelegatedEvmWalletClient`** - A client instance that can be used with delegated signing functions. The client has the following properties:

* `chainName`: Always `'EVM'` for this client type
* `environmentId`: Your environment ID
* `apiKey`: Your server API key (used internally)
* Additional internal properties for API communication

## Example

### Basic Usage

```typescript theme={"system"}
import { createDelegatedEvmWalletClient } from '@dynamic-labs-wallet/node-evm';

const delegatedClient = createDelegatedEvmWalletClient({
  environmentId: 'your-environment-id',
  apiKey: 'your-server-api-key',
});
```

### With All Options

```typescript theme={"system"}
import { createDelegatedEvmWalletClient } from '@dynamic-labs-wallet/node-evm';

const delegatedClient = createDelegatedEvmWalletClient({
  environmentId: process.env.DYNAMIC_ENVIRONMENT_ID!,
  apiKey: process.env.DYNAMIC_API_KEY!,
  baseApiUrl: 'https://custom-api.example.com',
  baseMPCRelayApiUrl: 'https://custom-mpc-relay.example.com',
  debug: process.env.NODE_ENV === 'development',
});
```

### Singleton Pattern

```typescript theme={"system"}
import { createDelegatedEvmWalletClient } from '@dynamic-labs-wallet/node-evm';
import type { DelegatedEvmWalletClient } from '@dynamic-labs-wallet/node-evm';

let clientInstance: DelegatedEvmWalletClient | null = null;

export function getDelegatedClient(): DelegatedEvmWalletClient {
  if (!clientInstance) {
    clientInstance = createDelegatedEvmWalletClient({
      environmentId: process.env.DYNAMIC_ENVIRONMENT_ID!,
      apiKey: process.env.DYNAMIC_API_KEY!,
    });
  }
  return clientInstance;
}
```

## Type Definitions

```typescript theme={"system"}
type DelegatedEvmWalletClient = DelegatedWalletClient & {
  readonly chainName: 'EVM';
};

type DelegatedEvmClientConfig = {
  environmentId: string;
  baseApiUrl?: string;
  baseMPCRelayApiUrl?: string;
  apiKey: string;
  debug?: boolean;
};
```

## Security Considerations

* **API Key Protection**: Never expose your server API key in client-side code or public repositories
* **Environment Variables**: Store API keys in secure environment variables
* **Key Rotation**: Implement regular API key rotation policies
* **Access Control**: Limit API key permissions to only what's necessary

## Error Handling

```typescript theme={"system"}
try {
  const delegatedClient = createDelegatedEvmWalletClient({
    environmentId: process.env.DYNAMIC_ENVIRONMENT_ID!,
    apiKey: process.env.DYNAMIC_API_KEY!,
  });
  console.log('Client created successfully');
} catch (error) {
  console.error('Failed to create delegated client:', error);
}
```

## Related Functions

* [`delegatedSignMessage()`](/node/reference/evm/delegated-sign-message) - Sign messages using the delegated client
* [`delegatedSignTransaction()`](/node/reference/evm/delegated-sign-transaction) - Sign transactions using the delegated client
* [Delegated Access Guide](/node/evm/delegated-access) - Complete guide on using delegated access
