# Web3Wallet

The `Web3Wallet` object describes a Web3 wallet address. The address can be used as a proof of identification for users.

Web3 addresses must be verified to ensure that they can be assigned to their rightful owners. The verification is completed via Web3 wallet browser extensions, such as [Metamask](https://metamask.io/), [Coinbase Wallet](https://www.coinbase.com/wallet), [OKX Wallet](https://www.okx.com/help/section/faq-web3-wallet), or [Solana Wallet](https://solana.com/solana-wallets). The `Web3Wallet` object holds all the necessary state around the verification process.

The verification process always starts with the [Web3Wallet.prepareVerification()](https://clerk.com/docs/js-frontend/reference/types/web3-wallet.md#prepare-verification) or [signIn.prepareFirstFactor()](https://clerk.com/docs/js-frontend/reference/objects/sign-in.md#prepare-first-factor) method, which will send the wallet address to Clerk's [Frontend API](https://clerk.com/docs/reference/frontend-api){{ target: '_blank' }} and will receive a nonce that needs to be signed by the Web3 wallet browser extension. A signature is generated from the nonce and is returned in the `Verification.message` property of the returned `Web3Wallet` object.

The second and final step involves an attempt to complete the verification by calling [Web3Wallet.attemptVerification()](https://clerk.com/docs/js-frontend/reference/types/web3-wallet.md#attempt-verification) method, passing the signature that was generated from the `prepareVerification()`method as a parameter.

## Properties

| Name         | Type                 | Description                                                                                                                            |
| ------------ | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| id           | string               | The unique ID for the Web3 wallet.                                                                                                     |
| web3Wallet   | string               | The Web3 wallet address, made up of either 0x + 40 hexadecimal characters or a base58 encoded ed25519 public key (for Solana wallets). |
| verification | VerificationResource | An object holding information on the verification of this Web3 wallet.                                                                 |

## Methods

### `create()`

Creates a new Web3 wallet.

```typescript
function create(): Promise<Web3Wallet>
```

### `destroy()`

Deletes this Web3 wallet.

```typescript
function destroy(): Promise<void>
```

### `toString()`

Returns the `web3Wallet` address as a string.

```typescript
function toString(): string
```

## `prepareVerification()`

Starts the verification process for the Web3 wallet. The user will be prompted to sign a generated nonce by the browser extension. Returns a `Web3Wallet` object **with the signature in the `Verification.message` property.** The signature should then be passed to the [attemptVerification()](https://clerk.com/docs/js-frontend/reference/types/web3-wallet.md#attempt-verification) method.

```typescript
function prepareVerification(params: PrepareWeb3WalletVerificationParams): Promise<Web3Wallet>
```

### `PrepareWeb3WalletVerificationParams`

| Name                                                                                           | Type                                                                                                                     | Description |
| ---------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ | ----------- |
| 'web3\_base\_signature': User will need to sign a message and generate a signature using Base. | 'web3\_metamask\_signature': User will need to sign a message and generate a signature using MetaMask browser extension. |             |

## `attemptVerification()`

Attempts to verify the Web3 wallet by passing the signature generated from the [prepareVerification()](https://clerk.com/docs/js-frontend/reference/types/web3-wallet.md#prepare-verification) method. Returns a `Web3Wallet` object.

```typescript
function attemptVerification(params: AttemptWeb3WalletVerificationParams): Promise<Web3Wallet>
```

### `AttemptWeb3WalletVerificationParams`

| Name      | Type   | Description                                                            |
| --------- | ------ | ---------------------------------------------------------------------- |
| signature | string | The signature generated from calling the prepareVerification() method. |

## `Web3Provider`

A type represents the supported Web3 wallet providers to set the signagture type in `GenerateSignatureParams`.

```ts
type Web3Provider = EthereumWeb3Provider | SolanaWeb3Provider
```

## `EthereumWeb3Provider`

A type that represents the supported Ethereum Web3 wallet providers.

```ts
type EthereumWeb3Provider =
  | MetamaskWeb3Provider
  | BaseWeb3Provider
  | CoinbaseWalletWeb3Provider
  | OKXWalletWeb3Provider
```

## `SolanaWeb3Provider`

A type that represents the Solana Web3 provider. This is independent of the specific Solana wallet used as users can use any [Solana wallet](https://solana.com/solana-wallets) that supports signing messages.

```ts
type SolanaWeb3Provider = 'solana'
```

## `MetamaskWeb3Provider`

A type that represents the MetaMask Web3 wallet provider.

```ts
type MetamaskWeb3Provider = 'metamask'
```

## `BaseWeb3Provider`

A type that represents the Base Web3 wallet provider.

```ts
type BaseWeb3Provider = 'base'
```

## `CoinbaseWalletWeb3Provider`

A type that represents the Coinbase Wallet Web3 wallet provider.

```ts
type CoinbaseWalletWeb3Provider = 'coinbase_wallet'
```

## `OKXWalletWeb3Provider`

A type that represents the OKX Wallet Web3 wallet provider.

```ts
type OKXWalletWeb3Provider = 'okx_wallet'
```

---

## Sitemap

[Overview of all docs pages](https://clerk.com/docs/llms.txt)
