# record

Description: record cheatcode documentation

Note: This document was authored using MDX

  Source: https://github.com/NomicFoundation/hardhat-website/tree/main/src/content/docs/docs/reference/cheatcodes/Environment/record.mdx

  Components used in this page:
    - :::note: An informational callout block. Supports custom title `:::note[Title]` and icon `:::note{icon="name"}` syntax.

{/* This document contains content copied/adapted from the Foundry Book (MIT licensed). See LICENSE in the parent directory. */}

### Signature

```solidity
function record() external;
```

### Description

Tell the VM to start recording all storage reads and writes. To access the reads and writes, use [`accesses`](/docs/reference/cheatcodes/environment/accesses).

:::note
Every write also counts as an additional read.
:::

### Examples

```solidity
/// contract NumsContract {
///     uint256 public num1 = 100; // slot 0
///     uint256 public num2 = 200; // slot 1
/// }

vm.record();
numsContract.num2();
(bytes32[] memory reads, bytes32[] memory writes) = vm.accesses(
  address(numsContract)
);
emit log_uint(uint256(reads[0])); // 1
```

### SEE ALSO

Forge Standard Library

[Std Storage](https://getfoundry.sh/reference/forge-std/std-storage)
