Bitcoin Forum
May 26, 2024, 05:40:56 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Address compatability between Bitcoin core and Electrum  (Read 132 times)
Bigbutts0lie (OP)
Newbie
*
Offline Offline

Activity: 1
Merit: 0


View Profile
January 07, 2021, 10:42:34 AM
 #1

HI,

Im experimenting with importing addresses from Electrum to bitcoin core and vica versa. When I create a new wallet in Electrum and import a private key that starts with "p2wpkh:" the receiving address(pub key) will start with "bc1". If I import the same private key, but skip the "p2wpkh:" beginning, the receiving address is different.

When I import the same private key to bitcoin core (must skip the "p2wpkh:" begining to be compatible) and use the command "dumpprivkey" for the respective public keys above, it shows the same privkey for both the addresses.

As I understand the "bc1" abbreviation is about segwit compatabiltiy. My question is if both the public addresses are compatible with segwit, or if u have to use the "bc1" address to be? And Is there any reason for concern about functionality of the wallets in this case, i.e. funds sent to either one of the public addresses will show up in both bitcoin core and Electrum wallet?

Thanks.

(updated title)
AB de Royse777
Legendary
*
Offline Offline

Activity: 2492
Merit: 3903


Hire Bitcointalk Camp. Manager @ r7promotions.com


View Profile WWW
January 07, 2021, 10:54:50 AM
 #2

Im experimenting with importing addresses from Electrum to bitcoin core and vica versa. When I create a new wallet in Electrum and import a private key that starts with "p2wpkh:" the receiving address(pub key) will start with "bc1". If I import the same private key, but skip the "p2wpkh:" beginning, the receiving address is different.
This is Electrum readable format so when you will export a private key using Electrum if will add a prefix:
"p2wpkh:" if the address starts with bc1......
"p2wpkh-p2sh" if the address starts with 3.......
"p2pkh:" if the address starts with 1.......
It's the way Electrum recognize the private key of different address format.



Without this prefix Electrum will consider a seed a Legacy address which starts with 1....

So to experiment, generate a random private key, mark the address.
If you restore the address with "p2wpkh:" as prefix in the private key then you will get the address for bc1...
The Same way, "p2wpkh-p2sh" and "p2pkh:" will restore bitcoin address format 3.... and 1... respectively.


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

Activity: 2422
Merit: 5636


Self-proclaimed Genius


View Profile
January 07, 2021, 11:18:13 AM
 #3

As I understand the "bc1" abbreviation is about segwit compatabiltiy. My question is if both the public addresses are compatible with segwit, or if u have to use the "bc1" address to be?
Only the 'bc1' will be SegWit compatible; not the legacy even if they have the same private/public key, or keys exported from a native SegWit Address then imported as legacy.
The address' format is basically a human-readable form for a specific script type, if you use the legacy '1' address, it can only be spent through a P2PKH script which isn't SegWit.

Quote from: Bigbutts0lie
And Is there any reason for concern about functionality of the wallets in this case, i.e. funds sent to either one of the public addresses will show up in both bitcoin core and Electrum wallet?
Not at all, your bitcoin is in the blockchain and the clients like Electrum and Bitcoin Core's wallet only hodls the keys.
You can import the key(s) to as many clients as you want as long as you can keep them safe, of course, if one spent the coins, the others' balances will be updated concurrently.

█▀▀▀











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











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
HCP
Legendary
*
Offline Offline

Activity: 2086
Merit: 4316

<insert witty quote here>


View Profile
January 07, 2021, 07:22:15 PM
Last edit: November 15, 2023, 12:26:55 AM by HCP
 #4

As I understand the "bc1" abbreviation is about segwit compatabiltiy. My question is if both the public addresses are compatible with segwit, or if u have to use the "bc1" address to be? And Is there any reason for concern about functionality of the wallets in this case, i.e. funds sent to either one of the public addresses will show up in both bitcoin core and Electrum wallet?
There are actually three address types available in this situation...

"Legacy" - These addresses start with a "1"
"P2SH-P2WPKH" - These addresses start with a "3"
"P2WPKH" - These addresses start with "bc1"

One private key can be "converted" to all 3 types... for instance, if we take the private key:
Code:
L2sf8SUpytobSSxSteJ7ixKt8pHXjm9FzavktpsN4Vy1t5M4Cos5

And import it into Electrum use the three different script types:



We get a wallet that has 3 different addresses... all generated from the same private key:







Bitcoin Core will automatically create all three addresses when you import a single private key... you don't need to specify the script type.



The "3"-type (P2SH-P2WPKH aka "Nested SegWit") and "bc1"-type addresses (P2WPKH aka "bech32" aka "Native SegWit") are "SegWit Compatible"... the only difference being that the "3"-type ones are compatible with older clients/services that don't recognise the "bc1" address format. This is becoming less and less of a problem as time goes on and wallet apps and online platforms upgrade to support bech32 addresses.



And Is there any reason for concern about functionality of the wallets in this case, i.e. funds sent to either one of the public addresses will show up in both bitcoin core and Electrum wallet?
Electrum and Bitcoin Core simply display what the blockchain records contain... so any changes to any of the addresses will be reflected in both the clients (and any other clients where the private keys have been imported).

Also note that even though all of these addresses are generated from the same private key, they are treated as completely separate addresses by the bitcoin network. So, funds sent to the different addresses are effectively segregated from each other.

So, if you setup the wallets as I have shown above, and then sent 1 BTC to bc1q77avy7yp04j4sql8u7jq4qwyhrn2dushe6q0dd it will show in Electrum and Bitcoin Core, but the addresses 1PasdfsTw1Mmm9E6bqcCz6dfAmsfMN4Q7f and 36T6zbUdRtR5bEEioUexWGKJRPxgwjkpAL will still show as "empty"...

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


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