Bitcoin Forum
October 31, 2024, 04:46:30 PM *
News: Bitcoin Pumpkin Carving Contest
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: P2SH-P2WSH in Electrum  (Read 98 times)
Jason Brendon (OP)
Member
**
Offline Offline

Activity: 162
Merit: 65


View Profile
May 02, 2024, 09:44:37 AM
 #1

By default, a new wallet is configured to p2wpkh or p2wsh addresses. How in electrum am I able to see the p2sh-p2wsh or p2sh-p2wpkh addresses?
(I don't mind doing it in the console) Just let me know how. Thank you.
Zaguru12
Hero Member
*****
Offline Offline

Activity: 868
Merit: 945



View Profile WWW
May 02, 2024, 10:05:18 AM
 #2

Yes since from electrum version 4.1.0 the default address has been a p2wpkh, but I think you can still restore other addresses from same private key when you prephend.

p2pkh:private key for legacy address ( address starting with 1), p2wpkh-p2sh: for nests SegWit addresses (address starting with 3) and p2wpkh: for Native SegWit addresses (addresses starting with bc1)

Here is also how to use console on it

# Release 4.1.0 - Kangaroo (March 30, 2021)
-snip-
 * The wallet creation wizard no longer asks for a seed type, and
   creates segwit wallets with bech32 addresses. Older seed types can
   still be created with the command line.
-snip-

To create a Legacy address, open the Console Tab (View Menu -> Show Console). Type the following command line:

Quote
make_seed(128,"","standard")
https://github.com/spesmilo/electrum/blob/master/electrum/commands.py#L320-L325

For example:



Then create a new wallet using the seed generated through the Console. Here is an example of the results:



███████████████████████████
███████▄████████████▄██████
████████▄████████▄████████
███▀█████▀▄███▄▀█████▀███
█████▀█▀▄██▀▀▀██▄▀█▀█████
███████▄███████████▄███████
███████████████████████████
███████▀███████████▀███████
████▄██▄▀██▄▄▄██▀▄██▄████
████▄████▄▀███▀▄████▄████
██▄███▀▀█▀██████▀█▀███▄███
██▀█▀████████████████▀█▀███
███████████████████████████
.
.Duelbits.
..........UNLEASH..........
THE ULTIMATE
GAMING EXPERIENCE
DUELBITS
FANTASY
SPORTS
████▄▄█████▄▄
░▄████
███████████▄
▐███
███████████████▄
███
████████████████
███
████████████████▌
███
██████████████████
████████████████▀▀▀
███████████████▌
███████████████▌
████████████████
████████████████
████████████████
████▀▀███████▀▀
.
▬▬
VS
▬▬
████▄▄▄█████▄▄▄
░▄████████████████▄
▐██████████████████▄
████████████████████
████████████████████▌
█████████████████████
███████████████████
███████████████▌
███████████████▌
████████████████
████████████████
████████████████
████▀▀███████▀▀
/// PLAY FOR  FREE  ///
WIN FOR REAL
..PLAY NOW..
Jason Brendon (OP)
Member
**
Offline Offline

Activity: 162
Merit: 65


View Profile
May 02, 2024, 10:25:12 AM
 #3

To create a Legacy address, open the Console Tab (View Menu -> Show Console). Type the following command line:
Quote
make_seed(128,"","standard")
Thank you for putting things together. I don't want to create a new wallet in order to have p2sh wrapped addresses. I was meaning to ask if there exists a command that can turn my existing p2wsh or p2wpkh into p2sh wrapped of them.
Thank you anyway.
Charles-Tim
Legendary
*
Offline Offline

Activity: 1722
Merit: 5190


Leading Crypto Sports Betting & Casino Platform


View Profile
May 02, 2024, 10:35:28 AM
 #4

By default, a new wallet is configured to p2wpkh or p2wsh addresses. How in electrum am I able to see the p2sh-p2wsh or p2sh-p2wpkh addresses?
(I don't mind doing it in the console) Just let me know how. Thank you.
Electrum does not generate these type of addresses. You can use BIP39 seed phrase instead for it on Electum and you do not need to use console. You will only just need to select the script type as p2wpkh-p2sh which is referred to as p2sh-segwit for single signature. For multisig, you will select p2sh-segwit multisig (p2wsh-p2sh).

..Stake.com..   ▄████████████████████████████████████▄
   ██ ▄▄▄▄▄▄▄▄▄▄            ▄▄▄▄▄▄▄▄▄▄ ██  ▄████▄
   ██ ▀▀▀▀▀▀▀▀▀▀ ██████████ ▀▀▀▀▀▀▀▀▀▀ ██  ██████
   ██ ██████████ ██      ██ ██████████ ██   ▀██▀
   ██ ██      ██ ██████  ██ ██      ██ ██    ██
   ██ ██████  ██ █████  ███ ██████  ██ ████▄ ██
   ██ █████  ███ ████  ████ █████  ███ ████████
   ██ ████  ████ ██████████ ████  ████ ████▀
   ██ ██████████ ▄▄▄▄▄▄▄▄▄▄ ██████████ ██
   ██            ▀▀▀▀▀▀▀▀▀▀            ██ 
   ▀█████████▀ ▄████████████▄ ▀█████████▀
  ▄▄▄▄▄▄▄▄▄▄▄▄███  ██  ██  ███▄▄▄▄▄▄▄▄▄▄▄▄
 ██████████████████████████████████████████
▄▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▄
█  ▄▀▄             █▀▀█▀▄▄
█  █▀█             █  ▐  ▐▌
█       ▄██▄       █  ▌  █
█     ▄██████▄     █  ▌ ▐▌
█    ██████████    █ ▐  █
█   ▐██████████▌   █ ▐ ▐▌
█    ▀▀██████▀▀    █ ▌ █
█     ▄▄▄██▄▄▄     █ ▌▐▌
█                  █▐ █
█                  █▐▐▌
█                  █▐█
▀▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▀█
▄▄█████████▄▄
▄██▀▀▀▀█████▀▀▀▀██▄
▄█▀       ▐█▌       ▀█▄
██         ▐█▌         ██
████▄     ▄█████▄     ▄████
████████▄███████████▄████████
███▀    █████████████    ▀███
██       ███████████       ██
▀█▄       █████████       ▄█▀
▀█▄    ▄██▀▀▀▀▀▀▀██▄  ▄▄▄█▀
▀███████         ███████▀
▀█████▄       ▄█████▀
▀▀▀███▄▄▄███▀▀▀
..PLAY NOW..
nc50lc
Legendary
*
Offline Offline

Activity: 2590
Merit: 6309


Self-proclaimed Genius


View Profile
May 02, 2024, 11:12:31 AM
 #5

Thank you for putting things together. I don't want to create a new wallet in order to have p2sh wrapped addresses. I was meaning to ask if there exists a command that can turn my existing p2wsh or p2wpkh into p2sh wrapped of them.
Thank you anyway.
Do you mean "new seed"?
Because Electrum doesn't have any feature to generate other script types to existing HD wallets aside from what's set during wallet creation. (defaults to Native SegWit)

If so, you can "force" Electrum to use your existing seed to make a new wallet with P2SH-P2WPKH addresses by toggling "BIP39 seed" option to enable the script type options.
But that's not following the standards so you wont be able to restore it using BIP39 wallets or wallets that supports Electrum seed.
You'll also have to do the exact same steps to restore it and hope that Electrum devs wont "fix" Electrum's behavior to let the user proceed despite having an invalid BIP39 seed phrase.
And since your Electrum seed is restored as a BIP39 seed, it'll restore a different set of private keys even if you use the same derivation path as the original wallet.

It's safer to use a real BIP39 seed created elsewhere if you really need Nested SegWit addresses in Electrum.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
Charles-Tim
Legendary
*
Offline Offline

Activity: 1722
Merit: 5190


Leading Crypto Sports Betting & Casino Platform


View Profile
May 02, 2024, 11:53:26 AM
 #6

It's safer to use a real BIP39 seed created elsewhere if you really need Nested SegWit addresses in Electrum.
There are many bitcoin wallets that are open source that can be used and this is what I would have gone for which is easy.

Generating it on Sparrow wallet will be good. There are other wallets that can be used for it like Passport if it is for airgapped. Or other wallets like Bluewallet, Unstoppable if it is on mobile.

Cold wallets are the safest but off-topic to tthis discussion.

..Stake.com..   ▄████████████████████████████████████▄
   ██ ▄▄▄▄▄▄▄▄▄▄            ▄▄▄▄▄▄▄▄▄▄ ██  ▄████▄
   ██ ▀▀▀▀▀▀▀▀▀▀ ██████████ ▀▀▀▀▀▀▀▀▀▀ ██  ██████
   ██ ██████████ ██      ██ ██████████ ██   ▀██▀
   ██ ██      ██ ██████  ██ ██      ██ ██    ██
   ██ ██████  ██ █████  ███ ██████  ██ ████▄ ██
   ██ █████  ███ ████  ████ █████  ███ ████████
   ██ ████  ████ ██████████ ████  ████ ████▀
   ██ ██████████ ▄▄▄▄▄▄▄▄▄▄ ██████████ ██
   ██            ▀▀▀▀▀▀▀▀▀▀            ██ 
   ▀█████████▀ ▄████████████▄ ▀█████████▀
  ▄▄▄▄▄▄▄▄▄▄▄▄███  ██  ██  ███▄▄▄▄▄▄▄▄▄▄▄▄
 ██████████████████████████████████████████
▄▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▄
█  ▄▀▄             █▀▀█▀▄▄
█  █▀█             █  ▐  ▐▌
█       ▄██▄       █  ▌  █
█     ▄██████▄     █  ▌ ▐▌
█    ██████████    █ ▐  █
█   ▐██████████▌   █ ▐ ▐▌
█    ▀▀██████▀▀    █ ▌ █
█     ▄▄▄██▄▄▄     █ ▌▐▌
█                  █▐ █
█                  █▐▐▌
█                  █▐█
▀▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▀█
▄▄█████████▄▄
▄██▀▀▀▀█████▀▀▀▀██▄
▄█▀       ▐█▌       ▀█▄
██         ▐█▌         ██
████▄     ▄█████▄     ▄████
████████▄███████████▄████████
███▀    █████████████    ▀███
██       ███████████       ██
▀█▄       █████████       ▄█▀
▀█▄    ▄██▀▀▀▀▀▀▀██▄  ▄▄▄█▀
▀███████         ███████▀
▀█████▄       ▄█████▀
▀▀▀███▄▄▄███▀▀▀
..PLAY NOW..
promise444c5
Sr. Member
****
Offline Offline

Activity: 462
Merit: 288


Learning never stops!


View Profile
May 02, 2024, 12:20:01 PM
 #7

You can only use the Bip39 options  while importing your address
By default  you will be having a Bench32 wallet address type I.e p2wpkh

Here's a simple guide :
You can view your wallet  script type  from wallet > information, it should look like this by default.


Using testnet mode for this:
Open your Electrum
 > create new wallet
> standard wallet or your type of wallet
> I already have a seed
> paste your seed  , click on options  you should  see BIP 39 seed
Select It  

Note: there should   a Warning!!! importing is only advice for lock fund on other  wallets, Electrum does not generate BiP 39 seed.
You should definitely read and understand before you continue.


However, if you wish to continue click next
You should  see this prompt


Select your  choice and continue
You should create your desire wallet type with this pattern.
After this your wallet will have  the choice to export Private keys as well as  well Wallet Backup but no seed Tongue

Now to back it up just  do a  save backup From your File>SaveBackup choose a safeplace to do this and make sure you encrypt it with a password.

Whenever you need to restore go to File> Open, you should  be able to open the backed up wallet.

At the end, it's just safer to use other wallets that support what you want than going through all this, you can try the recommended wallets  suggested above from the replies



██
██
██████
R


▀▀██████▄▄
████████████████
▀█████▀▀▀█████
████████▌███▐████
▄█████▄▄▄█████
████████████████
▄▄██████▀▀
LLBIT
██████
██
██
██████
██
██
██
██
██
██
██
██
██
██
██
██████
██████████████
 
 TH#1 SOLANA CASINO 
██████████████
██████
██
██
██
██
██
██
██
██
██
██
██
██████
████████████▄
▀▀██████▀▀███
██▄▄▀▀▄▄████
████████████
██████████
███▀████████
▄▄█████████
████████████
████████████
████████████
████████████
█████████████
████████████▀
████████████▄
▀▀▀▀▀▀▀██████
████████████
███████████
██▄█████████
████▄███████
████████████
█░▀▀████████
▀▀██████████
█████▄█████
████▀▄▀████
▄▄▄▄▄▄▄██████
████████████▀
[
[
5,000+
GAMES
INSTANT
WITHDRAWALS
][
][
HUGE
   REWARDS   
VIP
PROGRAM
]
]
████
██
██
██
██
██
██
██
██
██
██
██
████
████████████████████████████████████████████████
 
PLAY NOW
 

████████████████████████████████████████████████
████
██
██
██
██
██
██
██
██
██
██
██
████
Cricktor
Legendary
*
Offline Offline

Activity: 938
Merit: 1447


Crypto Swap Exchange


View Profile
May 02, 2024, 02:54:22 PM
 #8

Foreword:
I haven't tested this myself yet as I'm fine with a native Segwit wallet in Electrum that I personally use and you should be very careful and test it before actually moving funds into such a wallet. Use Testnet Bitcoins to check thoroughly and if you're also able to recover such a wallet!


Have a look at: https://bitcoinelectrum.com/creating-a-p2sh-segwit-wallet-with-electrum/

I have taken a brief look at the code of the Python script linked in above tuturial and at a first glimpse it looks OK to me. The quality of seed entropy should be similar to what Electrum itself produces as the script uses Electrum functions for its inner doings.
Here's the Python script's code: https://github.com/AbdussamadA/electrum-xprv/blob/master/xprv.py

Important note:
You should create such extended master private keys only in an offline secure environment which you can later dispose easily. TAILS or booting a known secure and fresh Live Linux system into RAM-only is probably the best. TAILS is agnostic unless you save something in the persistent storage if you use that. A Live Linux system in RAM-only shouldn't store anything persistent on storage media. Make sure you've disabled all network connectivity.

You should know and understand what you're doing when dealing with such sensitive data!

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
Jason Brendon (OP)
Member
**
Offline Offline

Activity: 162
Merit: 65


View Profile
May 03, 2024, 01:34:40 AM
 #9

Foreword:
I haven't tested this myself yet as I'm fine with a native Segwit wallet in Electrum that I personally use and you should be very careful and test it before actually moving funds into such a wallet. Use Testnet Bitcoins to check thoroughly and if you're also able to recover such a wallet!


Have a look at: https://bitcoinelectrum.com/creating-a-p2sh-segwit-wallet-with-electrum/

I have taken a brief look at the code of the Python script linked in above tuturial and at a first glimpse it looks OK to me. The quality of seed entropy should be similar to what Electrum itself produces as the script uses Electrum functions for its inner doings.
Here's the Python script's code: https://github.com/AbdussamadA/electrum-xprv/blob/master/xprv.py

Important note:
You should create such extended master private keys only in an offline secure environment which you can later dispose easily. TAILS or booting a known secure and fresh Live Linux system into RAM-only is probably the best. TAILS is agnostic unless you save something in the persistent storage if you use that. A Live Linux system in RAM-only shouldn't store anything persistent on storage media. Make sure you've disabled all network connectivity.

You should know and understand what you're doing when dealing with such sensitive data!
This is quite interesting but at the same time scary when executing some guy's script creating private keys. Thank you anyway.

I have taken a brief look at the code of the Python script linked in above tuturial and at a first glimpse it looks OK to me. The quality of seed entropy should be similar to what Electrum itself produces as the script uses Electrum functions for its inner doings.
How did you figure out it looks "OK" to you?
Cricktor
Legendary
*
Offline Offline

Activity: 938
Merit: 1447


Crypto Swap Exchange


View Profile
May 03, 2024, 01:43:54 PM
 #10

The script is from BCT user Abdussamad. While this is no guarantee at all, he might have some reputation here to loose.

How did you figure out it looks "OK" to you?

Reading and understanding the code of the script. I didn't put very much time into it, but I think I mostly understand what the script does (I've not debugged it). I share your concern and wouldn't easily run a foreign script that I don't understand how and what it does.

The script is rather short and frankly most of the magic is done in functions that come from Electrum code. You trust Electrum, don't you?

You don't have to believe me. When I say the script looks OK to me, I don't do this light-heartedly, I also put somewhat my reputation at stake. I didn't spot anything shady in this script. That's all I can say. To me it looks as if it does it's job if it works, but I definitely haven't tested it yet. My need for it is small, so don't expect any fast results from me.

I'm no Python coder but I can read and mostly understand Python code well enough to see and understand what the code does. DYOR!

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
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!