---
# System prepended metadata

title: Pinned contents validation command

---

# Pinned contents validation command

The new `validate-pin` command validates the chunks that belong to pinned content. It produces a csv file where each lines contains a reference and its associated statistics about missing and invalid chunks.

## Example use

> bee db validate-pin --data-dir ~/node/testnet-4 --output /tmp/stats.csv
> 
```
"time"="2024-01-31 16:57:32.783982" "level"="info" "logger"="node" "msg"="performing chunk validation"
"time"="2024-01-31 16:57:32.785943" "level"="info" "logger"="node" "msg"="got a total number of pins" "size"=0
"time"="2024-01-31 16:57:32.785977" "level"="info" "logger"="node" "msg"="done" "duration"="1.981373ms" "read"=0 "invalid"=0 "total"=0
```

If there's pinned content it will produce a csv file in the following form:

```
invalid missing total   address
0       0       6       4df08cb74850f64f7ce58a1469fb2422a87903297e03fdd6cdcae131683835cb
```

These statistics can be used to see if any of the pinned references have invalid (or missing) chunks:

```
awk '$1 >0 || $2>0' /tmp/stats.csv > ~/invalid.csv
```

## Arguments

- `--data-dir`
mandatory argument that must point to a valid localstore directory.

- `--pin` 
optional argument that can be used to specify a single pinned reference. If provided the validation will be limited to this particular reference.

- `--output` 
optional argument that can be used to specify a path to save the stats to. If the path does not end with a filename the default `address.csv` will be used.

When no `--pin` argument is provided the validation will be performed against ALL pinned references.
