aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2020-08-20 00:20:17 -0400
committerDeterminant <[email protected]>2020-08-20 00:20:17 -0400
commit069e181cc935dc626802e5dc43983b4b0f6319f9 (patch)
treef89a4b3e54838878375386df408db0c3b28ac79d
parente1f70934ca4d0f195008da7a6eac1635e1bc624e (diff)
allow custom hrp string
-rwxr-xr-xkeytree.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/keytree.py b/keytree.py
index 721324a..ebfaf46 100755
--- a/keytree.py
+++ b/keytree.py
@@ -217,6 +217,7 @@ if __name__ == '__main__':
parser.add_argument('--lang', type=str, default="english", help='language for mnemonic words')
parser.add_argument('--start-idx', type=int, default=0, help='the start index for keys')
parser.add_argument('--end-idx', type=int, default=1, help='the end index for keys (exclusive)')
+ parser.add_argument('--hrp', type=str, default="avax", help='HRP (Human Readable Prefix, defined by Bech32)')
args = parser.parse_args()
@@ -247,7 +248,7 @@ if __name__ == '__main__':
if args.show_private:
print("{}.priv(raw) {}".format(i, priv.to_string().hex()))
print("{}.priv(BTC) {}".format(i, get_privkey_btc(priv)))
- print("{}.addr(AVAX) X-{}".format(i, bech32.bech32_encode('avax', bech32.convertbits(ripemd160(sha256(cpub)), 8, 5))))
+ print("{}.addr(AVAX) X-{}".format(i, bech32.bech32_encode(args.hrp, bech32.convertbits(ripemd160(sha256(cpub)), 8, 5))))
print("{}.addr(BTC) {}".format(i, get_btc_addr(pub)))
print("{}.addr(ETH) {}".format(i, get_eth_addr(pub)))
except KeytreeError as e: