---
description: Gets the nonce of an account or wallet
---

## `getNonce`

### Signature

```solidity
function getNonce(address account) external view returns (uint64 nonce);
function getNonce(Wallet memory wallet) external returns (uint64 nonce);
```

### Description

Gets the nonce of the given account or [`Wallet`](/reference/cheatcodes/create-wallet).

### Parameters

| Parameter | Type      | Description                         |
|-----------|-----------|-------------------------------------|
| `account` | `address` | The account to get the nonce for    |
| `wallet`  | `Wallet`  | The wallet to get the nonce for     |

### Returns

| Parameter | Type     | Description                    |
|-----------|----------|--------------------------------|
| `nonce`   | `uint64` | The current nonce of the account |

### Examples

```solidity [test/GetNonce.t.sol]
function testGetNonce() public {
    uint64 nonce = vm.getNonce(address(100));
    assertEq(nonce, 0);
}
```

```solidity [test/GetNonceWallet.t.sol]
function testGetNonceWallet() public {
    Wallet memory alice = vm.createWallet("alice");
    uint64 nonce = vm.getNonce(alice);
    assertEq(nonce, 0);
}
```

### Related Cheatcodes

- [`setNonce`](/reference/cheatcodes/set-nonce) - Sets the nonce of an account
- [`createWallet`](/reference/cheatcodes/create-wallet) - Creates a new wallet
