# AIR GAPPED Midnight Claim Shell Script

**URL:** <https://forum.midnight.network/t/air-gapped-midnight-claim-shell-script/319>\
**Category:** Glacier Drop/Scavenger Mine\
**Created:** [August 25, 2025, 6:39pm UTC](https://forum.midnight.network/t/air-gapped-midnight-claim-shell-script/319 "2025-08-25T18:39:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![CardanoVerve](https://avatars.discourse-cdn.com/v4/letter/c/d2c977/32.png) [@CardanoVerve](https://forum.midnight.network/u/CardanoVerve)\
**Post date:** [August 25, 2025, 6:39pm UTC](https://forum.midnight.network/t/air-gapped-midnight-claim-shell-script/319/1 "2025-08-25T18:39:52Z")

</div>

## **AIR GAPPED - Midnight Airdrop Claim Guide**

This guide provides a complete set of instructions, from prerequisites to the  
final signing process, based on the successful steps taken.

### — 1. Prerequisites ---------------------------------------------------------

The following binaries are required to run the process. The versions used  
successfully were:

- cardano-signer-1.27.0\_linux-x64.tar.gz

- cardano-cli-10.11.1.0-x86\_64-linux.tar.gz

- cardano-address-4.0.0-linux.tar.gz

- jq (JSON processor)

### — 2. Setup Instructions ----------------------------------------------------

This section details how to set up the required tools on your Linux machine.

First, create a new directory and download the binaries.

```auto
mkdir midnight_tools
cd midnight_tools

```

Download and extract each binary. You will need to find the correct download  
URLs for the versions listed above or newer, stable versions.

```auto
wget <url_to_cardano-signer-tar.gz>
tar -xzf cardano-signer-1.27.0_linux-x64.tar.gz

```

```auto
wget <url_to_cardano-cli-tar.gz>
tar -xzf cardano-cli-10.11.1.0-x86_64-linux.tar.gz

```

```auto
wget <url_to_cardano-address-tar.gz>
tar -xzf cardano-address-4.0.0-linux.tar.gz

```

Next, install jq

```auto
sudo apt update
sudo apt install jq

```

Check jq installation

`jq --version`

Finally, copy the extracted binaries to a location in your system’s PATH  
and make them executable.

```auto
sudo cp cardano-signer /usr/local/bin/
sudo chmod +x /usr/local/bin/cardano-signer

```

```auto
sudo cp cardano-cli /usr/local/bin/
sudo chmod +x /usr/local/bin/cardano-cli

```

```auto
sudo cp cardano-address /usr/local/bin/
sudo chmod +x /usr/local/bin/cardano-address

```

### NOW CUT THE MACHINE FROM THE INTERNET.

### — 3. Process of Using an Air-Gapped Machine --------------------------------

This is a critical security step. All sensitive operations must be  
performed on a cold (offline) machine.

On your COLD (Offline) Machine:

- Run the signing script.
- The script will take your mnemonic and the challenge message as input.
- It will perform all key derivations and signing operations.
- The final output (the COSE\_Sign1\_hex string) will be printed to the terminal.
- This machine should have never touched the internet.

On your ONLINE Machine:

- Get the challenge message from the Midnight portal.
- Copy the final signature string from the offline machine.
- Submit the signature to the Midnight portal to claim your airdrop.

### — 4. Required Files --------------------------------------------------------

You need to create 3 text files on your cold machine. Use a reliable  
text editor (like VS Code or Sublime Text) to ensure there are no hidden  
characters or extra newlines.

In ‘mnemonic.txt’:

- Put your 15 or 24-word Yoroi mnemonic phrase on a single line.
- Example: word1 word2 word3 …

In ‘Midnight\_Claim\_Challenge\_Message.txt’:

- Put the exact text string provided by the Midnight portal.
- This is the text string, NOT the hex string. It often starts with “STAR…”.

In ‘Stake\_Address.txt’:

- Put the stake address.

### — 5. Final Script and Usage ------------------------------------------------

This is the final, working script that was used successfully. Save it as  
‘midnight\_claim\_response.sh’ and make it executable.

```auto
#!/bin/bash

# ==============================================================================
# Midnight Airdrop - Raw Output Script - AIR GAPPED
# ==============================================================================
#
# Description:
# This script performs the full signing process and prints the raw JSON output
# from cardano-signer directly to the terminal, without any processing.
#
# ==============================================================================

set -e

# --- Configuration ---
MNEMONIC_FILE="mnemonic.txt"
CHALLENGE_FILE="Midnight_Claim_Challenge_Message.txt"
STAKE_ADDRESS_FILE="Stake_Address.txt"

# --- Temporary File Names ---
ROOT_KEY_FILE="root.xprv"
STAKE_SKEY_FILE="stake.skey"

# --- Cleanup Function ---
cleanup() {
  echo "---"
  echo "🧹 Cleaning up temporary files..."
  rm -f "$ROOT_KEY_FILE" "$STAKE_SKEY_FILE"
  echo "✅ Cleanup complete."
}
trap cleanup EXIT

# --- Main Logic ---

echo "---"
echo "🚀 Starting Midnight claim signing process..."
echo "---"
echo "🔎 Performing sanity checks..."
if ! command -v cardano-cli &> /dev/null || ! command -v cardano-address &> /dev/null || ! command -v cardano-signer &> /dev/null || ! command -v jq &> /dev/null; then
    echo "❌ Error: Missing a required command-line tool."
    exit 1
fi
if [! -f "$MNEMONIC_FILE"] || [! -f "$CHALLENGE_FILE"] || [! -f "$STAKE_ADDRESS_FILE"]; then
    echo "❌ Error: A required input file (mnemonic.txt, Midnight_Claim_Challenge_Message.txt, or Stake_Address.txt) was not found."
    exit 1
fi
echo "✅ Sanity checks passed."
echo "---"

echo "📄 Reading inputs from files..."
MNEMONIC_WORDS=$(cat "$MNEMONIC_FILE")
CHALLENGE_MESSAGE_TEXT=$(cat "$CHALLENGE_FILE")
STAKE_ADDRESS=$(cat "$STAKE_ADDRESS_FILE")
echo "✅ Inputs read successfully."
echo "---"

echo "🔑 Deriving root private key from mnemonic..."
echo "$MNEMONIC_WORDS" | cardano-address key from-recovery-phrase Shelley > "$ROOT_KEY_FILE"
echo "✅ Root key derived."
echo "---"

echo "🔑 Deriving staking signing key from path: m/1852'/1815'/0'/2/0"
cat "$ROOT_KEY_FILE" | cardano-address key child 1852H/1815H/0H/2/0 | cardano-cli key convert-cardano-address-key --shelley-stake-key --signing-key-file /dev/stdin --out-file "$STAKE_SKEY_FILE"
echo "✅ Staking signing key ('$STAKE_SKEY_FILE') created."
echo "---"

echo "✍️ Executing cardano-signer and showing raw output..."
# This command will print the full, unprocessed JSON output directly.
cardano-signer sign --cip8 --data-text "$CHALLENGE_MESSAGE_TEXT" --secret-key "$STAKE_SKEY_FILE" --address "$STAKE_ADDRESS" --json-extended

echo "--- End of Raw Output ---"
echo "---"

# The cleanup function is called automatically at the end of the script

```

Keep the 3 text files mentioned above in the same folder of this shell script  
Run the Shell Script  
The Output will be directly generated on the terminal  
Copy the output in the text editor  
Copy the text from “COSE\_Sign1\_hex” and the “publicKey” in a clean PEN Drive and take it to the HOT Machine  
Put it in the Mid Night Claim Portal

If you are successful let me know.

Feel Free to donate some ADA for my guitar to this address 🙂

`addr1q9th8x00v6usr2y4t8wq5cw3gecvmxzrxvyly7xm30gv7kcslrh4889e0xym8mgx0nh88rjmnf50jftxpz6yj0ndzdjqt0hfgc`
