Bitcoin Forum
May 07, 2024, 07:13:54 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: importing question - solved  (Read 189 times)
tainted_love (OP)
Newbie
*
Offline Offline

Activity: 16
Merit: 9


View Profile
July 04, 2022, 06:24:19 PM
Last edit: July 08, 2022, 04:17:39 AM by tainted_love
Merited by o_e_l_e_o (4), ABCbits (1)
 #1

Hello forum,

When I import private keys into my core wallet I get three receiving addresses for each private key.  I only want the one receiving address that I used from my old hierarchical wallets.  Is there a way to import only the segwit or only the legacy or only the p2sh-p2wpkh without the other two?
1715066034
Hero Member
*
Offline Offline

Posts: 1715066034

View Profile Personal Message (Offline)

Ignore
1715066034
Reply with quote  #2

1715066034
Report to moderator
The Bitcoin software, network, and concept is called "Bitcoin" with a capitalized "B". Bitcoin currency units are called "bitcoins" with a lowercase "b" -- this is often abbreviated BTC.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715066034
Hero Member
*
Offline Offline

Posts: 1715066034

View Profile Personal Message (Offline)

Ignore
1715066034
Reply with quote  #2

1715066034
Report to moderator
o_e_l_e_o
In memoriam
Legendary
*
Offline Offline

Activity: 2268
Merit: 18510


View Profile
July 04, 2022, 07:19:25 PM
Merited by ABCbits (2), mocacinno (1), PawGo (1)
 #2

Use importmulti instead.

In the console on Bitcoin Core, use the following command, replacing the "address" field with either the P2PKH or P2WPKH address you want to import, and the "key" field with the relevant private key:
Code:
importmulti '[{ "scriptPubKey": { "address": "1DJzqVWae3V7Qff8B5ep5BK9TJf9r9ayT9" }, "timestamp":1656962234, "keys": [ "KwFvTne8vjodvyGm8RdDFFsqdnQC2fxi4F7yJtvj2WbSnDBJXWGb" ]}]'

You'll want to change the timestamp field to a Unix epoch time before those keys were created so Core knows how far back to rescan. If you aren't sure, just set it to 0 to perform a full rescan.

If you want to import a P2SH or P2SH-P2WPKH address, then you'll also need  to include the redeemscript field, as explained in https://bitcoincore.org/en/doc/22.0.0/rpc/wallet/importmulti/
tainted_love (OP)
Newbie
*
Offline Offline

Activity: 16
Merit: 9


View Profile
July 04, 2022, 09:13:00 PM
 #3

Use importmulti instead.

In the console on Bitcoin Core, use the following command, replacing the "address" field with either the P2PKH or P2WPKH address you want to import, and the "key" field with the relevant private key:
Code:
importmulti '[{ "scriptPubKey": { "address": "1DJzqVWae3V7Qff8B5ep5BK9TJf9r9ayT9" }, "timestamp":1656962234, "keys": [ "KwFvTne8vjodvyGm8RdDFFsqdnQC2fxi4F7yJtvj2WbSnDBJXWGb" ]}]'

You'll want to change the timestamp field to a Unix epoch time before those keys were created so Core knows how far back to rescan. If you aren't sure, just set it to 0 to perform a full rescan.

If you want to import a P2SH or P2SH-P2WPKH address, then you'll also need  to include the redeemscript field, as explained in https://bitcoincore.org/en/doc/22.0.0/rpc/wallet/importmulti/

Thank you for the help I hope I did it right.  I have each type of address to import.  For redeemscript I used the address as the string, is that correct?  Here is the example of what I did.

Code:
bitcoin-cli importmulti '[{ "scriptPubKey": { "address": "1DJzqVWae3V7Qff8B5ep5BK9TJf9r9ayT9" }, "label": "The Pit and the Pendulum", "timestamp":0, "keys": [ "KwFvTne8vjodvyGm8RdDFFsqdnQC2fxi4F7yJtvj2WbSnDBJXWGb" ]}, { "scriptPubKey": { "address": "bc1qel5xqtf3eqn5qx6awmxkq6znspcsn24s3slssv" }, "label": "The Tell-Tale Heart", "timestamp":0, "keys": [ "L4PcFcFYJwsLmGWzerApmLFnwRzzS8VUC2xhJJjLap5QcHaNr77G" ]}, { "scriptPubKey": { "address": "3E1cyAbo6X3QG8RmpF7vNUn2sWSxaFVZck" }, "redeemscript": "3E1cyAbo6X3QG8RmpF7vNUn2sWSxaFVZck", "label": "The Mureders in the Rue Morgue", "timestamp":0, "keys": [ "KyvxDGMHHPf5aomJowLENyHtgpVjbz8gsmmxgbaQ6U2BXfdjp4w2" ]}]'

Core is rescanning now, so I'll know if a few hours.  I don't know the time stamps for the addresses so I used 0.
nc50lc
Legendary
*
Online Online

Activity: 2408
Merit: 5588


Self-proclaimed Genius


View Profile
July 05, 2022, 04:27:24 AM
Merited by o_e_l_e_o (4), ABCbits (1)
 #4

-snip- For redeemscript I used the address as the string, is that correct?
No, it should be a hex string, some wallets have an option to export it alongside the PrvKey.

There should be a message showing "success: false" along with a message regarding the redeem script when you tried to import it, but only for that specific address.
The other two should be successful.

.
.HUGE.
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
DireWolfM14
Copper Member
Legendary
*
Offline Offline

Activity: 2170
Merit: 4238


Join the world-leading crypto sportsbook NOW!


View Profile WWW
July 05, 2022, 04:49:58 AM
Merited by o_e_l_e_o (4), ABCbits (3)
 #5

For redeemscript I used the address as the string, is that correct?

I don't think that will work.  The only way I know of to find the redeemscript is from Electrum.  On the address tab, right click on the address you want and click "Details," here's what I found for the address in your example above:



Using the script below I was able to import your example address.  I used a very recent time stamp to accelerate synchronization time.  If you want to speed up synch time, use a time stamp that's just a few minutes before the first transaction that address received. 

Code:
importmulti '[{ "scriptPubKey": { "address": "3E1cyAbo6X3QG8RmpF7vNUn2sWSxaFVZck" }, "label": "The Mureders in the Rue Morgue", "timestamp": 1656995753, "redeemscript": "0014756d4690fa13589cac0d0790178e9562acb18be2", "keys": [ "KyvxDGMHHPf5aomJowLENyHtgpVjbz8gsmmxgbaQ6U2BXfdjp4w2" ]}]'




PS; I like the Edgar Allen Poe references.

  ▄▄███████▄███████▄▄▄
 █████████████
▀▀▀▀▀▀████▄▄
███████████████
       ▀▀███▄
███████████████
          ▀███
 █████████████
             ███
███████████▀▀               ███
███                         ███
███                         ███
 ███                       ███
  ███▄                   ▄███
   ▀███▄▄             ▄▄███▀
     ▀▀████▄▄▄▄▄▄▄▄▄████▀▀
         ▀▀▀███████▀▀▀
░░░████▄▄▄▄
░▄▄░
▄▄███████▄▀█████▄▄
██▄████▌▐█▌█████▄██
████▀▄▄▄▌███░▄▄▄▀████
██████▄▄▄█▄▄▄██████
█░███████░▐█▌░███████░█
▀▀██▀░██░▐█▌░██░▀██▀▀
▄▄▄░█▀░█░██░▐█▌░██░█░▀█░▄▄▄
██▀░░░░▀██░▐█▌░██▀░░░░▀██
▀██
█████▄███▀▀██▀▀███▄███████▀
▀███████████████████████▀
▀▀▀▀███████████▀▀▀▀
▄▄██████▄▄
▀█▀
█  █▀█▀
  ▄█  ██  █▄  ▄
█ ▄█ █▀█▄▄█▀█ █▄ █
▀▄█ █ ███▄▄▄▄███ █ █▄▀
▀▀ █    ▄▄▄▄    █ ▀▀
   ██████   █
█     ▀▀     █
▀▄▀▄▀▄▀▄▀▄▀▄
▄ ██████▀▀██████ ▄
▄████████ ██ ████████▄
▀▀███████▄▄███████▀▀
▀▀▀████████▀▀▀
█████████████LEADING CRYPTO SPORTSBOOK & CASINO█████████████
MULTI
CURRENCY
1500+
CASINO GAMES
CRYPTO EXCLUSIVE
CLUBHOUSE
FAST & SECURE
PAYMENTS
.
..PLAY NOW!..
o_e_l_e_o
In memoriam
Legendary
*
Offline Offline

Activity: 2268
Merit: 18510


View Profile
July 05, 2022, 07:21:11 AM
 #6

For redeemscript I used the address as the string, is that correct?  Here is the example of what I did.
As the above two posters have noted, redeemscript needs to be the actual script itself, and not just the address.

Since you've said that the script in question is a straight forward nested segwit script, then you can follow DireWolfM14's instructions to grab the script from Electrum. You could also import the private key in to another Core wallet using importprivkey, and then get the script by using getaddressinfo on the P2SH address. Or if the address has ever been spent from, then you could look it up on mempool.space and extract the script from that transaction. Here's a recent example where if you click on details you can see the necessary data listed under "ScriptSig" on the left: https://mempool.space/tx/bb283826e76e5454d5e8bd26edbfe326aead40ca0af5393baf3b0790565a71d0

For nested segwit, the script will take the format 0x0014, followed by 20 bytes (40 characters) of hex.
HCP
Legendary
*
Offline Offline

Activity: 2086
Merit: 4316

<insert witty quote here>


View Profile
July 06, 2022, 10:56:08 PM
Merited by LoyceV (2)
 #7

I only want the one receiving address that I used from my old hierarchical wallets.
Can I ask way? Huh

I don't really see any issue with having the other types of addresses stored in your wallet... it's simple enough to add a label that says "do not use" if you're concerned about accidentally using the incorrect type.

At the end of the day, they're just different representations of the same private key.

█████████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████
█████████████████████████
.
BC.GAME
▄▄░░░▄▀▀▄████████
▄▄▄
██████████████
█████░░▄▄▄▄████████
▄▄▄▄▄▄▄▄▄██▄██████▄▄▄▄████
▄███▄█▄▄██████████▄████▄████
███████████████████████████▀███
▀████▄██▄██▄░░░░▄████████████
▀▀▀█████▄▄▄███████████▀██
███████████████████▀██
███████████████████▄██
▄███████████████████▄██
█████████████████████▀██
██████████████████████▄
.
..CASINO....SPORTS....RACING..
█░░░░░░█░░░░░░█
▀███▀░░▀███▀░░▀███▀
▀░▀░░░░▀░▀░░░░▀░▀
░░░░░░░░░░░░
▀██████████
░░░░░███░░░░
░░█░░░███▄█░░░
░░██▌░░███░▀░░██▌
░█░██░░███░░░█░██
░█▀▀▀█▌░███░░█▀▀▀█▌
▄█▄░░░██▄███▄█▄░░▄██▄
▄███▄
░░░░▀██▄▀


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
tainted_love (OP)
Newbie
*
Offline Offline

Activity: 16
Merit: 9


View Profile
July 08, 2022, 04:16:18 AM
 #8

I only want the one receiving address that I used from my old hierarchical wallets.
Can I ask way? Huh

I don't really see any issue with having the other types of addresses stored in your wallet... it's simple enough to add a label that says "do not use" if you're concerned about accidentally using the incorrect type.

At the end of the day, they're just different representations of the same private key.

You can ask.   Lips sealed

jaja j/k  Just because I don't want to make a mistake and breach my privacy.  I used labels and just thought to ask for a better way.

For redeemscript I used the address as the string, is that correct?  Here is the example of what I did.
As the above two posters have noted, redeemscript needs to be the actual script itself, and not just the address.

Since you've said that the script in question is a straight forward nested segwit script, then you can follow DireWolfM14's instructions to grab the script from Electrum. You could also import the private key in to another Core wallet using importprivkey, and then get the script by using getaddressinfo on the P2SH address. Or if the address has ever been spent from, then you could look it up on mempool.space and extract the script from that transaction. Here's a recent example where if you click on details you can see the necessary data listed under "ScriptSig" on the left: https://mempool.space/tx/bb283826e76e5454d5e8bd26edbfe326aead40ca0af5393baf3b0790565a71d0

For nested segwit, the script will take the format 0x0014, followed by 20 bytes (40 characters) of hex.

Thank you again.  I found it using tt]getaddressinfo[/tt] but it wasn't named "redeemscript" it was named "hex" and "scriptPubKey".  Good thing I first used the example address and matched the script to the one DireWolfM14 shows.

Thanks to everyone for the help, issue solved.
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!