> For the complete documentation index, see [llms.txt](https://services.validexis.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://services.validexis.com/validator-security-our-approach-and-protection-measures/tmkms-for-remote-signing/tmkms-update-for-celestia.md).

# TMKMS Update for Celestia

This guide provides the necessary steps to update TMKMS for the Celestia. The update includes moving the configuration and keys to a dedicated hidden folder (`~/.tmkms`), updating the systemd service, and installing the new TMKMS binary from the official Celestia repository.

#### **Create Hidden TMKMS Directory**

```bash
mkdir -p $HOME/.tmkms/celestia
```

#### Stop the existing TMKMS service

```bash
sudo systemctl stop celestia-tmkmsd.service
```

#### Make a backup (recommended)

```bash
cp -r $HOME/tmkms $HOME/tmkms_backup_$(date +%Y%m%d)
```

#### **Copy Existing Keys, State, and Config**

```bash
cp -r $HOME/tmkms/celestia/secrets $HOME/.tmkms/celestia/
cp -r $HOME/tmkms/celestia/state $HOME/.tmkms/celestia/
cp $HOME/tmkms/celestia/tmkms.toml $HOME/.tmkms/celestia/
```

#### **Update Paths in `tmkms.toml`**

```bash
sed -i "s|state_file = .*|state_file = \"$HOME/.tmkms/celestia/state/celestia-consensus.json\"|" $HOME/.tmkms/celestia/tmkms.toml
sed -i "s|path = .*|path = \"$HOME/.tmkms/celestia/secrets/celestia-consensus.key\"|" $HOME/.tmkms/celestia/tmkms.toml
sed -i "s|secret_key = .*|secret_key = \"$HOME/.tmkms/celestia/secrets/kms-identity.key\"|" $HOME/.tmkms/celestia/tmkms.toml
sed -i 's|protocol_version = "v0\.34"|protocol_version = "v0.38"|' $HOME/.tmkms/celestia/tmkms.toml
```

#### **Update Systemd Service**

```bash
sudo tee /etc/systemd/system/celestia-tmkmsd.service > /dev/null << EOF
[Unit]
Description=TMKMS for Celestia
After=network.target
StartLimitIntervalSec=0

[Service]
Type=simple
Restart=always
RestartSec=10
User=$USER
ExecStart=$(which tmkms) start -c $HOME/.tmkms/celestia/tmkms.toml
LimitNOFILE=1024

[Install]
WantedBy=multi-user.target
EOF
```

#### **Remove Old TMKMS Source Directory (Optional)**

```bash
rm -rf $HOME/tmkms
```

#### **Clone the Official Celestia TMKMS Repository**

```bash
git clone https://github.com/iqlusioninc/tmkms.git $HOME/tmkms
cd $HOME/tmkms
git checkout v0.15.0
```

#### **Build and Install TMKMS**

```bash
cargo build --release --features=softsign
cargo install --path . --features=softsign
```

#### **Reload Systemd and Restart TMKMS**

```bash
sudo systemctl daemon-reload
sudo systemctl enable celestia-tmkmsd.service
sudo systemctl restart celestia-tmkmsd.service
sudo journalctl -u celestia-tmkmsd.service -f -o cat
```

***

**Note:** Ensure that the paths in the `tmkms.toml` file are correctly set to the new locations. This guide assumes the use of the `$HOME` environment variable for user-specific directories.
