Last active
November 25, 2025 01:20
-
-
Save dermetfan/916a87b105e8567ccc4499ad39e3b20b to your computer and use it in GitHub Desktop.
Keystone 25th word addresses
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env nu | |
| # Generates addresses like the Keystone 3 Pro does | |
| # when using a passcode (aka 25th word). | |
| def main [ | |
| --mnemonic-file: path | |
| --passphrase-file: path | |
| --account: int = 0 | |
| --index: int = 0 | |
| ] { | |
| let mnemonic = if $mnemonic_file == null { | |
| print --stderr --no-newline 'Enter mnemonic: ' | |
| let result = input --suppress-output | |
| print --stderr '' | |
| $result | |
| } else { | |
| open --raw $mnemonic_file | |
| } | |
| let passphrase = if $passphrase_file == null { | |
| print --stderr --no-newline 'Enter passphrase (25th word): ' | |
| let result = input --suppress-output | |
| print --stderr '' | |
| $result | |
| } else { | |
| open --raw $passphrase_file | |
| } | |
| let root_xsk = $"($mnemonic)\n($passphrase)\n" | cardano-address key from-recovery-phrase Shelley --passphrase from-utf8 --silent e> /dev/null | |
| let payment_xsk = $root_xsk | cardano-address key child 1852H/1815H/($account)H/0/($index) | |
| let payment_vk = $payment_xsk | cardano-address key public --without-chain-code | |
| let stake_xsk = $root_xsk | cardano-address key child 1852H/1815H/($account)H/2/0 | |
| let stake_vk = $stake_xsk | cardano-address key public --without-chain-code | |
| let payment_addr = $payment_vk | cardano-address address payment --network-tag mainnet | |
| let base_addr = $payment_addr | cardano-address address delegation $stake_vk | |
| $base_addr | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment