Bitcoin Forum
April 05, 2026, 02:53:15 AM *
News: Latest Bitcoin Core release: 30.2 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 [2]  All
  Print  
Author Topic: ImportPrivKey Safe?  (Read 524 times)
hosemary
Legendary
*
Offline Offline

Activity: 3094
Merit: 6892



View Profile
May 11, 2025, 09:44:00 PM
 #21

@Hosemary yeah I know the address, there where no transactions from it to a other address
The computer was on for weeks 24/7 mining with cpu so it's worth the trouble to find out
You didn't answer my question. I didn't talk about outgoing transactions, but incoming transactions.
Have you checked the balance of the address through any block explorer? Do you see any incoming transaction?

As I said in my previous post, many of block explorers display the transactions sent to the public key assosiated with your legacy address, if there's any.
A good example is blockchair.com. Just go to blockchair.com and search your address. If you have any bitcoin sent to that address or any bitcoin sent to the public key assosiated with that, blockchair.com will show you the transaction and the balance. If you don't see any transaction, you are wasting your time.

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







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

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







██
██
██████

  CHECK MORE > 
Forsyth Jones
Legendary
*
Offline Offline

Activity: 1862
Merit: 2030


I love Bitcoin!


View Profile WWW
May 12, 2025, 12:08:48 AM
 #22

May I ask, why you don't know it exactly and have to be a bit fuzzy?

As most Electrum servers won't return a transaction history for coins sent to public keys (P2PK transactions, like a lot of the very early coinbase transactions), I would stick to Bitcoin Core which has no issues with such transactions.

For a watch-only wallet you can import one or more combo(public key) descriptor(s) where you derive the public key(s) from each of the private key(s) you have in a safe disposable offline environment (live linux started from read-only media or USB-stick which only runs in RAM with no network connection and doesn't save any persistent data without your consent).

combo() descriptors cover most common address types which can be derived from a private or public key, in particular coins are recognized which have been sent via P2PK, P2PKH and the Segwit variants when the public key is compressed. As far as I remember Taproot isn't covered, but that irrelevant for OP. Of course for a spending wallet, it's possible to use the combo() descriptors with private keys.

Once you have imported such combo() descriptors you can tell Bitcoin Core to rescan from beginning of blockchain.
Quote from: type help rescanblockchain in Bitcoin Core console window
rescanblockchain ( start_height stop_height )

Rescan the local blockchain for wallet related transactions.
Note: Use "getwalletinfo" to query the scanning progress.
The rescan is significantly faster when used on a descriptor wallet
and block filters are available (using startup option "-blockfilterindex=1").

Arguments:
1. start_height    (numeric, optional, default=0) block height where the rescan should start
2. stop_height     (numeric, optional) the last block height that should be scanned. If none is provided it will rescan up to the tip at return time of this call.
...

You can ask more specific questions if you can't wrap you head around how to properly setup a descriptor wallet for your specific needs. If you're have trouble with English language, Google translator usually does a quite decent job. You can post with your current English skills and maybe add a Google translator output, too.


More details on descriptors are here: https://github.com/bitcoin/bitcoin/blob/master/doc/descriptors.md
OP, see if my tutorial on importing privkeys into Bitcoin Core's descriptor wallet will help you. There is a step-by-step guide on how to import private keys into Bitcoin Core and specify the block height.

You didn't answer my question. I didn't talk about outgoing transactions, but incoming transactions.
Have you checked the balance of the address through any block explorer? Do you see any incoming transaction?

As I said in my previous post, many of block explorers display the transactions sent to the public key assosiated with your legacy address, if there's any.
A good example is blockchair.com. Just go to blockchair.com and search your address. If you have any bitcoin sent to that address or any bitcoin sent to the public key assosiated with that, blockchair.com will show you the transaction and the balance. If you don't see any transaction, you are wasting your time.
Additionally, you can follow hosemary's tip: search for your P2PK address in a block explorer and see if there is an incoming transaction at this address.

If there is, check the block height in which it was mined and after importing, specify (replace the numbers below within the range of the block in which the transaction was validated):

Code:
rescanblockchain 111222 111333

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







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

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







██
██
██████

  CHECK MORE > 
nc50lc
Legendary
*
Offline Offline

Activity: 3108
Merit: 8543


Self-proclaimed Genius


View Profile
May 12, 2025, 07:45:04 AM
 #23

@nc50lc so not to my own server, that's the problem?
it has the romanz/electrs instead of the mempool/electrs
Not necessarily, that's only a case of false-negative if you already checked if the public key in the P2PK UTXO that you're trying to spend is actually the pair of your private key.
It's simple to check since the scriptPubKey has the public key itself.

There are many ways to do that.
For example:
  • Go to Blockstream and search for the specific transaction ID that has your P2PK output. (not an address)
  • Expand "Details+" Then take note of the hex character string in the "scriptPubKey (asm)" of that specific output.
  • Then in your offline machine, import your private key to Electrum via "Import Bitcoin Addresses or Private keys" to create an imported wallet.
  • Enable its "Addresses" tab (View->Show Addresses) then open it, find the imported address, right-click on it and select "Details".
  • There you can find its public key, check if it matches the P2PK output's public key.

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







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

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







██
██
██████

  CHECK MORE > 
Cricktor
Legendary
*
Offline Offline

Activity: 1456
Merit: 3819



View Profile
May 12, 2025, 10:14:09 PM
Merited by hosemary (1)
 #24

Have you checked the balance of the address through any block explorer? Do you see any incoming transaction?

As I said in my previous post, many of block explorers display the transactions sent to the public key assosiated with your legacy address, if there's any.
...
If you don't see any transaction, you are wasting your time.
While it's true that some block explorers might show P2PK and P2PKH related UTXOs, I would explicitly try to probe the balance with the public key (for possible P2PK outputs) and the legacy uncompressed and compressed public address (for possible P2PKH outputs). It doesn't hurt to check both even when the private key starts with 5... which indicates an uncompressed key.

mempool.space block explorer does retrieve an address history for P2PK transactions outputs. I haven't checked with blockchair.com as I don't like their UI, only use it for complex queries where it still shines.

Handling the private key should of course only be done in an offline and verifiable secure environment (known and verified live Linux is nice and as it only runs in RAM, it's easily disposable without leaving persistent data without user's consent). Tails e.g. is nice for this, too.

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







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

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







██
██
██████

  CHECK MORE > 
junior_clk (OP)
Jr. Member
*
Offline Offline

Activity: 31
Merit: 2


View Profile
June 11, 2025, 12:14:05 AM
 #25

So I did my homework this time.
When I did getaddressinfo on my "address" starting with a 3
it gave scriptPubKey a914 ****87 so I know now that belongs to a P2SH legacy address, used in the first 3 years, just what I said.

When I went over the programming from the early version of bitcoin core they mention secretKey like I said
but that is just a other name for scriptSig, and so it is needed for the SH from the legacy address.

My question remains, how can I make a descriptor for this, to put in my new legacy wallet, or new wallet in 0.29?
Or how to make a transaction with sendall? because they are all mined bitcoins, so coinbase, and I don't know the UTXO.
nc50lc
Legendary
*
Offline Offline

Activity: 3108
Merit: 8543


Self-proclaimed Genius


View Profile
June 11, 2025, 05:26:08 AM
Merited by ABCbits (2), Cricktor (2)
 #26

My question remains, how can I make a descriptor for this, to put in my new legacy wallet, or new wallet in 0.29?
For P2SH descriptor: it depends on the script "wrapped" in that p2sh.
One simple example for Nested-SegWit: sh(wpkh(<pubKey>)) or instead of pubKey, use the private key WIF.

But it should be specific to the script that your address represents and getaddressinfo's result using an unrelated wallet is too limited to be able to get any clue.
Since you're asking for the descriptor of it, you must have used an unrelated wallet since otherwise, there should already be a descriptor among the results.
If you have the correct wallet, specify it with --rpc-wallet (for cli) or select it in the GUI's console "Wallet:" drop-down menu first before using the command.

Once you have the descriptor, import it using importdescriptors command: bitcoincore.org/en/doc/29.0.0/rpc/wallet/importdescriptors

For non-descriptor wallet: Just import the private key via importprivkey command and Bitcoin Core will derive P2SH-P2WPKH alongside with P2PKH and P2WPKH.

Quote from: junior_clk
it gave scriptPubKey a914 ****87 so I know now that belongs to a P2SH legacy address, used in the first 3 years, just what I said.
That scriptPubKey shows 0xA9 which is OP_HASH160 then 0x14 (length of a 160-bit hash) suggesting that it could be anything that's hashed with RIPEMD160[SHA256()].
P2SH-P2WPKH usually has that scriptPubKey result with getaddressinfo command.

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







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

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







██
██
██████

  CHECK MORE > 
junior_clk (OP)
Jr. Member
*
Offline Offline

Activity: 31
Merit: 2


View Profile
June 20, 2025, 11:26:38 PM
 #27

@nc50lc
According to Gavin Andresen at 18-10-2011 when he suggested BIP13
Complexity in this context is defined as what information is needed by the recipient to respend the received coins, in contrast to needing a single ECDSA private key as in current implementations of Bitcoin.
When I used Base64 at my secretkey/scriptsig it gave me ECA.........CD..... the dots are numbers a total of 24 characters 
I got the 20 byte hash of script and the # with 8 characters
the wallet states ismine:true
nc50lc
Legendary
*
Offline Offline

Activity: 3108
Merit: 8543


Self-proclaimed Genius


View Profile
June 21, 2025, 06:45:13 AM
 #28

According to Gavin Andresen at 18-10-2011 when he suggested BIP13
Complexity in this context is defined as what information is needed by the recipient to respend the received coins, in contrast to needing a single ECDSA private key as in current implementations of Bitcoin.
Looks like it's pertaining to the "redeem script" which should be in the wallet where that P2SH address belongs.
And it's not the scriptSig which is just the hash of the redeem script.

You may check the getaddressinfo result for that redeem script which is the value of "hex:" then use: decodescript command to check its human-readable encoding.
It should be able to tell what kind of script that P2SH address represents, you may post the "asm" part but you may snip the public keys in it if necessary.

the wallet states ismine:true
Good, then try to sync the wallet and spend your bitcoins.

If it's not a watch-only import of a p2sh redeem script nor a forged wallet, you should be able to spend from it once it synced.
Otherwise, there's "something" in that wallet of yours.

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







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

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







██
██
██████

  CHECK MORE > 
junior_clk (OP)
Jr. Member
*
Offline Offline

Activity: 31
Merit: 2


View Profile
July 06, 2025, 08:37:59 PM
Last edit: July 06, 2025, 11:12:46 PM by junior_clk
 #29

@nc50lc
Using the console in BitcoinCore 29 with the option assumevallid=0 in bitcoin.conf so it downloads all blocks
scriptpubkey belonging to my address starting with a 3 from 2011 starts with a914 "20byte hash of script" 87
the redeemscript I believe is 0014 "20 byte"
when I enter decopdescript "the 20 byte hash of script" it gives me

asm "0 77***********
desc "addr(bc1**********
address that same bc1
type "witness_v0_keyhash"

and a new p2sh "3*****

when I validate the bc1 address
is valid "true"
scriptpubkey "the 20 byte hash"
is script "false"
is witness "true"
witness_version 0
witness_programm "the 20 bytee hash"

when I validate the "new" p2sh 3 address
is valid "true"
address and scriptpubkey with the for mentioned values
is script "true"
iswitness "false"

am I on the right track? ad does that 16 character secret key starting with a 7 and then all capital (base64 or whatever becouse the is a capital i in it) makes more sense now?

reading https://github.com/bitcoin/bips/blob/master/bip-0016/qa.mediawiki
it mentions P2SH as early as 0.3.19 so that matches my 0.3.24
nc50lc
Legendary
*
Offline Offline

Activity: 3108
Merit: 8543


Self-proclaimed Genius


View Profile
July 07, 2025, 05:02:01 AM
Merited by ABCbits (3)
 #30

Using the console in BitcoinCore 29 with the option assumevallid=0 in bitcoin.conf so it downloads all blocks
This will just make you node verify all scripts, it'll download all the blocks regardless.

Quote from: junior_clk
when I enter decopdescript "the 20 byte hash of script" it gives me
That's a useless result since you've just provided it with a "scriptPubKey" instead of a "redeem script".
The results just show the derived addresses from that scriptPubKey.

Quote from: junior_clk
when I validate the bc1 address
is valid "true"
This just shows that the address has the correct checksum, obviously since it's derived from the scriptPubKey in your previous command.
It's not something that tells that it's included to an existing wallet or something.

Quote from: junior_clk
am I on the right track?
No, you'll still need to the private key to spend it.
Finding the correct redeem script will just help you find the correct address and possibly the required unlocking script (if it's non-standard).
Otherwise, most standard scripts can be easily reproduced with the private key on hand.

Look for the private key, that should be your main goal.

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







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

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







██
██
██████

  CHECK MORE > 
junior_clk (OP)
Jr. Member
*
Offline Offline

Activity: 31
Merit: 2


View Profile
July 09, 2025, 12:18:00 AM
 #31

The secret key is refered to the public key in BitcoinJ
Back then AES was considered very secure
When I use Base64 to hex on the key it gives me ECA like in the eckey in java
And that uses openssl 0.9 so I need to figure out how to convert that key that java made
to a WIF or something bitcoincore or electrum can use
Pages: « 1 [2]  All
  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!