pull down to refresh
0 sats \ 5 replies \ @bren 9 Jan \ parent \ on: Shill me your lnbits instance bitcoin_beginners
All I have is the format the backup key was stored in Armory's style, so I need that to get the private key for another wallet.
I've tried old versions of Debian and within a python virtual environment, but keep getting dependency errors.
Did you read the guide I sent you?
https://bitcointalk.org/index.php?topic=4746784.msg43255691#msg43255691
reply
reply
I got Armory running thanks. Do you know how I can convert the backup format I saved as Hash160 to PrivBase58, or restore the wallet from my Hash160 backup. @DarthCoin @jimmysong
reply
What backup version do you have? Armory used a proprietary backup format (the wallet was created before BIP39), and it uses the backup to generate the private keys in a deterministic fashion. IIRC, they are all letters, no numbers. Anyway, it's been a while, but I used to work on that code base so message me on Nostr if you want help.
reply
Well I just learned the private key is not derived from HASH160, instead the HASH160 is derived from the public key.
import hashlib
def hash160_to_base58(hash160):
# Step 1: Add version byte (0x00 for mainnet)
versioned_payload = b'\x00' + hash160
# Step 2: Calculate checksum
checksum = hashlib.sha256(hashlib.sha256(versioned_payload).digest()).digest()[:4]
# Step 3: Concatenate versioned payload and checksum
binary_address = versioned_payload + checksum
# Step 4: Convert to Base58
base58_alphabet = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
num = int.from_bytes(binary_address, 'big')
base58 = ''
while num > 0:
num, remainder = divmod(num, 58)
base58 = base58_alphabet[remainder] + base58
# Add leading '1's for each leading 0 byte in the binary address
for byte in binary_address:
if byte == 0:
base58 = '1' + base58
else:
break
return base58
hash160 = bytes.fromhex('2cf75d92e22635a46e181b1c7b355252dd08fa28') # Replace with your actual HASH160
base58_address = hash160_to_base58(hash160)
print(base58_address)
reply