Created
May 16, 2022 02:11
-
-
Save doingthisalright/9229cc2064502b3f0005ebc953982138 to your computer and use it in GitHub Desktop.
Convert String Private Keys exported from wallets like Phantom to File Based Private Key
This file contains 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
# Taken from https://stackoverflow.com/a/69256259 | |
# Usage: python3 PrivateKeyStringToFile.py <String Private Key> | |
import base58 | |
import sys | |
byte_array = base58.b58decode(sys.argv[1]) | |
json_string = "[" + ",".join(map(lambda b: str(b), byte_array)) + "]" | |
print(json_string) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment