# Backup/Restore a P12 KeyStore

| Table of Contents                               |
| ----------------------------------------------- |
| [Backup Procedure](#backup-p12-keystore-file)   |
| [Restore Procedure](#restore-p12-keystore-file) |

## 🔐Backup P12 Keystore File

Maintaining an up-to-date and secure backup of your `.p12` file is essential for protecting access to your Validator node and wallet. This guide will walk you through securely backing up and restoring your `.p12` file using a macOS or Windows system.

***

{% stepper %}
{% step %}

### Determine Cold Storage Medium

#### What and Why Cold Storage?

Cold storage refers to keeping your `.p12` file **offline**, minimizing exposure to unauthorized access or system vulnerabilities. Acceptable storage methods include:

* Encrypted USB drives
* Hardware wallets with secure storage
* Air-gapped systems
* Secured Encrypted Software Vaults
  {% endstep %}

{% step %}

### Open Terminal Application

{% tabs %}
{% tab title="Macintosh" %}
Macintosh MacOS Terminal   ![](/files/5Yulve6MQ0OewZeM9FRK)
{% endtab %}

{% tab title="Windows" %}
&#x20;Windows 11 Terminal App ![](/files/m5aI30hlDYOlc9KRdA5H)  and make sure the terminal session opens a PowerShell prompt.

![](/files/GLXAIgNtFBq7upRqeBJn)
{% endtab %}
{% endtabs %}
{% endstep %}

{% step %}

### Create Temporary Backup Directory

```bash
cd ~
mkdir constellation-backup
cd ~/constellation-backup
```

{% endstep %}

{% step %}

### **Start SFTP Session to Your Validator Node**

Replace values with your actual SSH key and node IP address:

```bash
sftp -i ~/.ssh/my-node-ssh-keyname nodeadmin@123.123.123.123
```

You'll be prompted to enter your SSH key passphrase.
{% endstep %}

{% step %}

### Locate your p12 KeyStore

```bash
cd /home/nodeadmin/tessellation
ls -l
```

Example output:

```
-rw-r--r-- 1 nodeadmin nodeadmin 31 Jun 11 14:28 my-p12file.p12
```

{% endstep %}

{% step %}

### Download your p12 KeyStore

Use the `get` command to download the file to your temporary directory:

```bash
get my-p12file.p12
```

You should see:

```
100% 31 0.3KB/s 00:00
```

{% endstep %}

{% step %}

### End the SFTP Session

```bash
exit
```

{% endstep %}

{% step %}

### Confirm p12 Keystore on Local System

{% tabs %}
{% tab title="Macintosh" %}

```bash
cd ~/constellation-backups
ls -l
```

{% endtab %}

{% tab title="Windows" %}

```bash
cd ~/constellation-backup
dir
```

{% endtab %}
{% endtabs %}

Confirm your p12 keystore is locally found on your system.
{% endstep %}

{% step %}

### **Transfer to Cold Storage**

Move your `.p12` file to a secure offline storage device.
{% endstep %}

{% step %}

### Remove p12 KeyStore from Local System

<mark style="color:orange;">**Once complete**</mark>, delete the p12 keystore file from your local system to maintain proper security practices.
{% endstep %}

{% step %}
{% tabs %}
{% tab title="Macintosh" %}

```bash
cd ~/constellation-backups
rm -f my-p12file.p12
```

{% endtab %}

{% tab title="Windows" %}

```bash
cd ~/constellation-backup
rm my-p12file.p12
```

{% endtab %}
{% endtabs %}
{% endstep %}
{% endstepper %}

***

## 🔄 Restore P12 Keystore File

{% stepper %}
{% step %}

### Obtain p12 keystore backup from cold storage

* Access your backup device
* Locate your backup p12 key store file
  {% endstep %}

{% step %}

### Transfer p12 keystore to local system

Copy your backed-up p12 keystore file to your local Macintosh or Windows system.

{% tabs %}
{% tab title="Macintosh" %}

```bash
mkdir ~/constellation-backup
cp /Volumes/ColdStorage/my-p12file.p12 ~/constellation-backup/
cd ~/constellation-backup
ls -l
```

{% endtab %}

{% tab title="Windows" %}

* Connect your backup device or connect to your backup medium to your Windows 11 system.
* Use File Explorer to copy the file into your constellation backup directory under your local user's home directory.

```
constellation-backup
```

<div align="left"><figure><img src="/files/R7aUQsmIsjADwgOOngAS" alt=""><figcaption></figcaption></figure></div>

<div align="left"><figure><img src="/files/Mb4ckZnCBlB2D5R7w1b6" alt=""><figcaption></figcaption></figure></div>
{% endtab %}
{% endtabs %}

Verify that you see your p12 file listed.
{% endstep %}

{% step %}

### Open Terminal Application

{% tabs %}
{% tab title="Macintosh" %}
Macintosh MacOS Terminal   ![](/files/5Yulve6MQ0OewZeM9FRK)
{% endtab %}

{% tab title="Windows" %}
&#x20;Windows 11 Terminal App ![](/files/m5aI30hlDYOlc9KRdA5H)  and make sure the terminal session opens a PowerShell prompt.

&#x20; ![](/files/GLXAIgNtFBq7upRqeBJn)
{% endtab %}
{% endtabs %}
{% endstep %}

{% step %}

### Connect to Your Node via SFTP

```bash
sftp -i ~/.ssh/my-node-ssh-keyname nodeadmin@123.123.123.123
```

{% endstep %}

{% step %}

### Navigate to Restore Location

We need to change directories to the location where we would like to place our p12 keystore file.

Change directories in your SFTP session:

```bash
cd /home/nodeadmin/tessellation
```

{% endstep %}

{% step %}

### Upload our P12 KeyStore

We will use the SFTP `put` command.

```bash
put my-p12file.p12
```

Expected output:

```
Uploading my-p12file.p12 to /home/nodeadmin/tessellation/my-p12file.p12
100% 31 0.6KB/s 00:00
```

{% endstep %}

{% step %}

### Exit SFTP Session

```bash
exit
```

{% endstep %}
{% endstepper %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.constellationnetwork.io/run-a-node/validator-node-guides/operational-guides/backup-restore-a-p12-keystore.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
