import {
  DocBlock,
  DocSideBySide,
  CodeParams,
  Parameter,
  Field,
  Values,
  CodeSnippets,
} from "../../../components/CodeDocBlock";

<DocBlock>

## rootSubscribe

Subscribe to receive notification anytime a new root is set by the validator.

<DocSideBySide>
<CodeParams>

### Parameters:

**None**

### Result:

`integer` - subscription id \(needed to unsubscribe\)

</CodeParams>

<CodeSnippets>

### Code sample:

```json
{ "jsonrpc": "2.0", "id": 1, "method": "rootSubscribe" }
```

### Response:

```json
{ "jsonrpc": "2.0", "result": 0, "id": 1 }
```

</CodeSnippets>
</DocSideBySide>

#### Notification Format:

The result is the latest root slot number.

```json
{
  "jsonrpc": "2.0",
  "method": "rootNotification",
  "params": {
    "result": 42,
    "subscription": 0
  }
}
```

</DocBlock>
