# Stake key

First thing required is extracting the stake key hardware signing file (".hwsfile") and the stake key verification key (".vkey") from the hardware wallet. For this, the `cardano-hw-cli` binary file is required (<https://github.com/vacuumlabs/cardano-hw-cli/releases/latest>).

Create the following script as `hw-keys.sh` and save it in the `keys` folder, where the `wallet.sh` script is also stored:

```bash
#!/bin/bash


cardano-hw-cli address key-gen \
--path 1852H/1815H/0H/2/0 \
--verification-key-file hw-stake.vkey \
--hw-signing-file hw-stake.hwsfile

#cardano-hw-cli address key-gen \
#--path 1852H/1815H/0H/0/0 \
#--verification-key-file hw-payment.vkey \
#--hw-signing-file hw-payment.hwsfile
```

Only the first command is required for the stake key, the second command is included as an example for extracting the hardware signing file for the first payment address of the hardware wallet.

The `hw-stake.hwsfile` file will be required for witnessing transactions with the hardware wallet, and the `hw-stake.vkey` file will be required when creating the new stake pool registration certificate.

The script must be executed with the hardware wallet connected to the computer and unlocked, and with the Cardano application started. It will be required to confirm the key export on the hardware wallet.


---

# 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://apexpool.gitbook.io/stake-pool-scripts/hardware-wallet-for-pledge/stake-key.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.
