Bitcoin Forum
April 02, 2026, 02:52:42 PM *
News: Latest Bitcoin Core release: 30.2 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Cant seem to get my private key into Bitcoin Core or Electrum  (Read 186 times)
Ferguson1337 (OP)
Newbie
*
Offline Offline

Activity: 7
Merit: 0


View Profile
March 09, 2025, 05:19:04 PM
 #1

I have a private key that begins with 5. It's uncompressed WIF.

I tried importprivkey "5xxxxxxxxxxxxxxxxxxxxxx" and it nulls.
I tried to add it to Electrum but it says 0 balance.

However when I take my private key and generate the public key, it does work, and it shows a balance.

Any ideas? Thanks!
hosemary
Legendary
*
Offline Offline

Activity: 3094
Merit: 6890



View Profile
March 09, 2025, 05:26:01 PM
 #2

However when I take my private key and generate the public key, it does work, and it shows a balance.
What software/tool did you use for generating the pair of pirvate key and address?
Maybe, your fund is at the address associated with the compressed format of your private key.

You can use iancoleman compression tool to derive the compressed format of your private key.
For more security, it's recommended to use iancoleman offline (preferably on an air-gapped device). Scroll down to read the guide on how to use the tool offline.

███████████████████████████
███████▄████████████▄██████
████████▄████████▄████████
███▀█████▀▄███▄▀█████▀███
█████▀█▀▄██▀▀▀██▄▀█▀█████
███████▄███████████▄███████
███████████████████████████
███████▀███████████▀███████
████▄██▄▀██▄▄▄██▀▄██▄████
████▄████▄▀███▀▄████▄████
██▄███▀▀█▀██████▀█▀███▄███
██▀█▀████████████████▀█▀███
███████████████████████████
.
.Duelbits PREDICT..
█████████████████████████
█████████████████████████
███████████▀▀░░░░▀▀██████
██████████░░▄████▄░░████
█████████░░████████░░████
█████████░░████████░░████
█████████▄▀██████▀▄████
████████▀▀░░░▀▀▀▀░░▄█████
██████▀░░░░██▄▄▄▄████████
████▀░░░░▄███████████████
█████▄▄█████████████████
█████████████████████████
█████████████████████████
.
.WHERE EVERYTHING IS A MARKET..
█████
██
██







██
██
██████
Will Bitcoin hit $200,000
before January 1st 2027?

    No @1.15         Yes @6.00    
█████
██
██







██
██
██████

  CHECK MORE > 
Ferguson1337 (OP)
Newbie
*
Offline Offline

Activity: 7
Merit: 0


View Profile
March 09, 2025, 05:32:16 PM
 #3

Confused but I'll try the compressed address thanks lol
Forsyth Jones
Legendary
*
Offline Offline

Activity: 1862
Merit: 2022


I love Bitcoin!


View Profile WWW
March 09, 2025, 05:49:23 PM
 #4

Confused but I'll try the compressed address thanks lol
Is your Bitcoin Core wallet legacy or descriptor? Please read this topic to understand what I'm referring to, it also contains instructions on how to import public and private keys into Bitcoin Core if the wallet is descriptor-based:  How to import an xpriv to a descriptor wallet in bitcoin core? and [HOW-TO] Import privkeys into a Bitcoin Core descriptor wallet

In Bitcoin Core, the only way to import an uncompressed private key is through the legacy script, it doesn't let you import an uncompressed private key with other scripts like (wpkh), sh(wpkh), etc. only pkh (legacy address).

So if this address has a balance, the import should occur with the corresponding address that has a balance.

The same goes for Electrum, which will import this uncompressed key from the legacy address. Something is wrong, check if you imported the private key/address that has a balance.

What software/tool did you use for generating the pair of pirvate key and address?
Maybe, your fund is at the address associated with the compressed format of your private key.

You can use iancoleman compression tool to derive the compressed format of your private key.
For more security, it's recommended to use iancoleman offline (preferably on an air-gapped device). Scroll down to read the guide on how to use the tool offline.
this is the most likely scenario.

███████████████████████████
███████▄████████████▄██████
████████▄████████▄████████
███▀█████▀▄███▄▀█████▀███
█████▀█▀▄██▀▀▀██▄▀█▀█████
███████▄███████████▄███████
███████████████████████████
███████▀███████████▀███████
████▄██▄▀██▄▄▄██▀▄██▄████
████▄████▄▀███▀▄████▄████
██▄███▀▀█▀██████▀█▀███▄███
██▀█▀████████████████▀█▀███
███████████████████████████
.
.Duelbits PREDICT..
█████████████████████████
█████████████████████████
███████████▀▀░░░░▀▀██████
██████████░░▄████▄░░████
█████████░░████████░░████
█████████░░████████░░████
█████████▄▀██████▀▄████
████████▀▀░░░▀▀▀▀░░▄█████
██████▀░░░░██▄▄▄▄████████
████▀░░░░▄███████████████
█████▄▄█████████████████
█████████████████████████
█████████████████████████
.
.WHERE EVERYTHING IS A MARKET..
█████
██
██







██
██
██████
Will Bitcoin hit $200,000
before January 1st 2027?

    No @1.15         Yes @6.00    
█████
██
██







██
██
██████

  CHECK MORE > 
Ferguson1337 (OP)
Newbie
*
Offline Offline

Activity: 7
Merit: 0


View Profile
March 09, 2025, 06:58:26 PM
 #5

success=true but there's still a zero balance. i feel doomed.

I added the compressed private key to bitcoin core using import descriptor but it's zero balance. I think I have to rescan the blockchain? Not sure how it works.
hosemary
Legendary
*
Offline Offline

Activity: 3094
Merit: 6890



View Profile
March 09, 2025, 07:04:52 PM
Last edit: March 09, 2025, 08:02:21 PM by hosemary
 #6

I added the compressed private key to bitcoin core using import descriptor but it's zero balance. I think I have to rescan the blockchain? Not sure how it works.
Did you try importing the private key in electrum?
Electrum is a SPV wallet and it will display the correct balance without any need to download/rescan the blockchain.

You can also use block explorers to first make sure the address has a balance.

███████████████████████████
███████▄████████████▄██████
████████▄████████▄████████
███▀█████▀▄███▄▀█████▀███
█████▀█▀▄██▀▀▀██▄▀█▀█████
███████▄███████████▄███████
███████████████████████████
███████▀███████████▀███████
████▄██▄▀██▄▄▄██▀▄██▄████
████▄████▄▀███▀▄████▄████
██▄███▀▀█▀██████▀█▀███▄███
██▀█▀████████████████▀█▀███
███████████████████████████
.
.Duelbits PREDICT..
█████████████████████████
█████████████████████████
███████████▀▀░░░░▀▀██████
██████████░░▄████▄░░████
█████████░░████████░░████
█████████░░████████░░████
█████████▄▀██████▀▄████
████████▀▀░░░▀▀▀▀░░▄█████
██████▀░░░░██▄▄▄▄████████
████▀░░░░▄███████████████
█████▄▄█████████████████
█████████████████████████
█████████████████████████
.
.WHERE EVERYTHING IS A MARKET..
█████
██
██







██
██
██████
Will Bitcoin hit $200,000
before January 1st 2027?

    No @1.15         Yes @6.00    
█████
██
██







██
██
██████

  CHECK MORE > 
Ferguson1337 (OP)
Newbie
*
Offline Offline

Activity: 7
Merit: 0


View Profile
March 09, 2025, 07:30:05 PM
 #7

Ah I definately donated some bitcoin to the emptiness

thanks all.
LoyceV
Legendary
*
Offline Offline

Activity: 4004
Merit: 21519


Thick-Skinned Gang Leader and Golden Feather 2021


View Profile WWW
March 09, 2025, 07:32:51 PM
 #8

Ah I definately donated some bitcoin to the emptiness
Does that mean your private key doesn't belong to the address you have?

¡uʍop ǝpᴉsdn pɐǝɥ ɹnoʎ ɥʇᴉʍ ʎuunɟ ʞool no⅄
Ferguson1337 (OP)
Newbie
*
Offline Offline

Activity: 7
Merit: 0


View Profile
March 09, 2025, 09:39:04 PM
 #9

Yes sent to the wrong address. I think something like this happened.

Got a private key in compressed WIF. Generated a public key but it didn't remove the 0x01 on the end that signifies compression.

Id send you the private key if you want to take a look at it. If you're really good at stuff maybe you can recover it. Seems like it's reverse engineering to me.
odolvlobo
Legendary
*
Offline Offline

Activity: 4970
Merit: 3764



View Profile
March 09, 2025, 09:52:48 PM
 #10

Got a private key in compressed WIF. Generated a public key but it didn't remove the 0x01 on the end that signifies compression.

Your explanation lacks crucial details, but you should be able to recover the funds. The 0x01 added to the end only determines the public key type. There is no reason why you can't generate and access both compressed and uncompressed addresses associated with the same private key.

Join an anti-signature campaign: Click ignore on the members of signature campaigns.
PGP Fingerprint: 6B6BC26599EC24EF7E29A405EAF050539D0B2925 Signing address: 13GAVJo8YaAuenj6keiEykwxWUZ7jMoSLt
LoyceV
Legendary
*
Offline Offline

Activity: 4004
Merit: 21519


Thick-Skinned Gang Leader and Golden Feather 2021


View Profile WWW
March 09, 2025, 10:00:37 PM
 #11

Got a private key in compressed WIF. Generated a public key but it didn't remove the 0x01 on the end that signifies compression.
How exactly did you generate this key?

¡uʍop ǝpᴉsdn pɐǝɥ ɹnoʎ ɥʇᴉʍ ʎuunɟ ʞool no⅄
nc50lc
Legendary
*
Offline Offline

Activity: 3108
Merit: 8540


Self-proclaimed Genius


View Profile
March 10, 2025, 04:06:08 AM
 #12

Yes sent to the wrong address. I think something like this happened.

Got a private key in compressed WIF. Generated a public key but it didn't remove the 0x01 on the end that signifies compression.
This will just "correctly" encode it into WIF that starts with "L" or "K" unlike your description in the OP that it starts with "5".
That compression flag byte is the only difference, the 'network byte', the private key's length and method of computing the 'checksum' remain the same.

Or are you talking about a compression flag byte at the end of the public key itself?
That doesn't exist in the pubKey, it's only used to encode a private key to WIF for its compressed pubKey pair.

Or are you talking about the private key that still has the compressed flag byte?
That will make its length incorrect with that additional byte.

However when I take my private key and generate the public key, it does work, and it shows a balance.
Got a private key in compressed WIF. Generated a public key but it didn't remove the 0x01 on the end that signifies compression.
Are you talking about your own script script in these replies?
Can you share the code or snippet of the part where it decodes WIF to private key, computes the public key from the private key, and where it does pubKey->Pubkeyhash->Address.

███████████████████████████
███████▄████████████▄██████
████████▄████████▄████████
███▀█████▀▄███▄▀█████▀███
█████▀█▀▄██▀▀▀██▄▀█▀█████
███████▄███████████▄███████
███████████████████████████
███████▀███████████▀███████
████▄██▄▀██▄▄▄██▀▄██▄████
████▄████▄▀███▀▄████▄████
██▄███▀▀█▀██████▀█▀███▄███
██▀█▀████████████████▀█▀███
███████████████████████████
.
.Duelbits PREDICT..
█████████████████████████
█████████████████████████
███████████▀▀░░░░▀▀██████
██████████░░▄████▄░░████
█████████░░████████░░████
█████████░░████████░░████
█████████▄▀██████▀▄████
████████▀▀░░░▀▀▀▀░░▄█████
██████▀░░░░██▄▄▄▄████████
████▀░░░░▄███████████████
█████▄▄█████████████████
█████████████████████████
█████████████████████████
.
.WHERE EVERYTHING IS A MARKET..
█████
██
██







██
██
██████
Will Bitcoin hit $200,000
before January 1st 2027?

    No @1.15         Yes @6.00    
█████
██
██







██
██
██████

  CHECK MORE > 
Ferguson1337 (OP)
Newbie
*
Offline Offline

Activity: 7
Merit: 0


View Profile
March 10, 2025, 03:26:20 PM
 #13

You're right. I was just flustered.

I can't show you the code but I kind of recreated it.

Quote
import os
import ecdsa
import hashlib
import base58
import bech32

# Convert hex private key to WIF (compressed)
def hex_to_wif(hex_private_key, compressed=True):
    # Add the version byte (0x80 for Bitcoin mainnet)
    versioned_key = b'\x80' + bytes.fromhex(hex_private_key)

    # If the key is compressed, add 0x01 at the end
    if compressed:
        versioned_key += b'\x01'

    # Perform SHA256 twice to get the checksum
    checksum = hashlib.sha256(hashlib.sha256(versioned_key).digest()).digest()[:4]

    # Add the checksum to the end
    wif_key = versioned_key + checksum

    # Encode the result using Base58Check
    wif = base58.b58encode(wif_key).decode('utf-8')

    return wif

# Generate random Bitcoin private key and SegWit address (compressed)
def generate_bitcoin_keys():
    # Generate a random private key (32 bytes)
    private_key = os.urandom(32)

    # Convert private key to hex
    private_key_hex = private_key.hex()

    # Generate the public key using the private key
    sk = ecdsa.SigningKey.from_string(private_key, curve=ecdsa.SECP256k1)
    public_key = sk.get_verifying_key().to_string()

    # Create a compressed public key (append 0x01 at the end)
    compressed_public_key = public_key + b'\x01'

    # Perform SHA256 and RIPEMD160 hash on the compressed public key to get the Bitcoin address format
    sha256_public_key = hashlib.sha256(compressed_public_key).digest()
    ripemd160_public_key = hashlib.new('ripemd160', sha256_public_key).digest()

    # SegWit address generation (P2WPKH)
    # Bech32 format expects the public key hash as the payload
    segwit_address = bech32.encode("bc", 0, ripemd160_public_key)

    # Convert the private key to WIF format (compressed key)
    private_key_wif = hex_to_wif(private_key_hex, compressed=True)

    # Return the private key (WIF), SegWit address, and public key (hex)
    return {
        "private_key_wif": private_key_wif,
        "segwit_address": segwit_address,
    }

# Generate the keys
keys = generate_bitcoin_keys()

# Output the results
print("Private Key (WIF):", keys["private_key_wif"])
print("SegWit Address:", keys["segwit_address"])

# Pause the script to allow time to view the output
input("Press Enter to exit...")

Something like that. I don't know if you can see it but it doesn't generate the correct public key.
nc50lc
Legendary
*
Offline Offline

Activity: 3108
Merit: 8540


Self-proclaimed Genius


View Profile
March 11, 2025, 04:48:18 AM
Merited by ABCbits (3)
 #14

I can't show you the code but I kind of recreated it.

Code:
-snip-
    # Create a compressed public key (append 0x01 at the end)
    compressed_public_key = public_key + b'\x01'

    # Perform SHA256 and RIPEMD160 hash on the compressed public key to get the Bitcoin address format
    sha256_public_key = hashlib.sha256(compressed_public_key).digest()
    ripemd160_public_key = hashlib.new('ripemd160', sha256_public_key).digest()
-snip-
This is where it went wrong. (matched one of my guesses above)

Compressed public key doesn't have to be appended with 0x01 at the end.
Since the "wrong pubKey" is used to generate the pubKeyhash, the outputs sent to the address is basically non-spendable
Unless a HASH160 result of a valid public key (with known prvKey pair) collides with that.

BTW, do not just send your private key, at least ask the person if he's willing to receive it.

███████████████████████████
███████▄████████████▄██████
████████▄████████▄████████
███▀█████▀▄███▄▀█████▀███
█████▀█▀▄██▀▀▀██▄▀█▀█████
███████▄███████████▄███████
███████████████████████████
███████▀███████████▀███████
████▄██▄▀██▄▄▄██▀▄██▄████
████▄████▄▀███▀▄████▄████
██▄███▀▀█▀██████▀█▀███▄███
██▀█▀████████████████▀█▀███
███████████████████████████
.
.Duelbits PREDICT..
█████████████████████████
█████████████████████████
███████████▀▀░░░░▀▀██████
██████████░░▄████▄░░████
█████████░░████████░░████
█████████░░████████░░████
█████████▄▀██████▀▄████
████████▀▀░░░▀▀▀▀░░▄█████
██████▀░░░░██▄▄▄▄████████
████▀░░░░▄███████████████
█████▄▄█████████████████
█████████████████████████
█████████████████████████
.
.WHERE EVERYTHING IS A MARKET..
█████
██
██







██
██
██████
Will Bitcoin hit $200,000
before January 1st 2027?

    No @1.15         Yes @6.00    
█████
██
██







██
██
██████

  CHECK MORE > 
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!