Bitcoin Forum
May 22, 2024, 02:50:46 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 [2]  All
  Print  
Author Topic: Legacy vs segwit  (Read 322 times)
bitmover
Legendary
*
Offline Offline

Activity: 2310
Merit: 5957


bitcoindata.science


View Profile WWW
April 10, 2020, 11:33:32 AM
 #21

those that can't verify messages signed from a P2WPKH or P2SH/P2WPKH addresses can't do it because that part of their application is not capable of recognizing the "address type".

The problem is that "those that cant" = "all but electrum"

I just found a discussion where you did participate where a user claimed trezor and electrum made different  signing methods...
https://bitcointalk.org/index.php?topic=5137069.msg50817536#msg50817536

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
pooya87
Legendary
*
Offline Offline

Activity: 3458
Merit: 10572



View Profile
April 11, 2020, 05:04:24 AM
Merited by DdmrDdmr (1), DireWolfM14 (1)
 #22

those that can't verify messages signed from a P2WPKH or P2SH/P2WPKH addresses can't do it because that part of their application is not capable of recognizing the "address type".

The problem is that "those that cant" = "all but electrum"

I just found a discussion where you did participate where a user claimed trezor and electrum made different  signing methods...
https://bitcointalk.org/index.php?topic=5137069.msg50817536#msg50817536

it is not the method, it is the optional first byte. we don't even need that first byte to verify a message!
let me explain the process of message signing and verification, maybe that helps in understanding why it is so trivial to implement.
the part that is the exact same thing:
1. normalize the input string (message) and add a fixed predefined string (Bitcoin Signed Message:\n) to the beginning then decode (convert to byte array) using UTF8 encoding.
2. compute SHA256 of SHA256 of the result from step 1
3. pass the 32 byte result to the ECDSA function to sign and return signature (r and s).
(* there is an extra step here i'll explain below)
4. encode the signature using base64
To verify:
5. decode signature using base64
6. perform steps 1 and 2 above to get the same hash
7. recover from 0 up to 4 possible public key(s) using result of step 5 and 6 (* extra explanation below)
8. convert the result(s) of step 7 to address of same type as user entered to see if they match
9. publish result of the match to user

these 9 steps are the exact same way that you sign and verify any message using ECDSA. these are sections 4.1.3 Signing Operation and 4.1.4 Verifying Operation and 4.1.6 Public Key Recovery Operation of SEC 1: Elliptic Curve Cryptography standard.
address type doesn't make any difference in these steps at all.


* now the extra step explanation the part that makes things be different:
the thing about public key recovery (step 7) is that it can recover up to 4 possible public keys from a given ECDSA signature on secp256k1 curve (usually it is just one though). it still doesn't make a difference in verification since we can still recover all 4 and check all 4 to see if any match the given address. but we can help the verifier to know which public key is the correct one and by doing that reduce its work.
in bitcoin we use hash of the public key and since hash of compressed key is different from hash of uncompressed key, that also makes a difference. so the verifier has to check up to 8 hashes (addresses) instead. we can help the verifier know this too.
so far both of these are happening by adding an additional byte to the beginning of the signature. it is a number between 27 and 34.
to indicate address type (P2PKH or P2SH/P2WPKH or P2WPKH) they decided to add another value to this first byte.

so in short it is that non-standard self-defined optional first byte that is making some tools not be able to verify the signature created by another tool even if they understand the address.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
Malvika_sitlani (OP)
Member
**
Offline Offline

Activity: 116
Merit: 14


View Profile
April 12, 2020, 06:31:04 PM
Last edit: April 16, 2020, 12:12:34 PM by Malvika_sitlani
 #23

Segwit addresses don't provide any more security, the purpose is to reduce fees for transactions.  The least secure address is one that is hosted by someone other than you, i.e. a custodial wallet or an exchange.  I say that because they have a greater risk of being hacked.  Of course this assumes that you are versed and capable of storing your private information in a private and secure way.  
Thank, for your feedback and explanation about fees, I will try to use some noncustodial exchange to receive my coins on my own address.

Your fund security depends on how you backup your wallet (its private key/ mnemonic seeds) and how your wallet backups work smoothly. How you keep your backups safely from threats of water, fire, and thieves (both off-line and online).

You can run wallet on your phones or computers but the vital step is backup. If you don't have backup, when you lost your devices or they get broken, you will lose bitcoin in your wallet.

Only download and upgrade wallet from official legit sites, not phishing ones. Example: Electrum vulnerability allows arbitrary messages, phishing

There are some SPV wallet like Electrum, that gives you extra security by extending seeds (their default seeds is 12, but you can extend more).

If you intend to run your wallet on mobile devices, I advice you to visit official site and get link to their apps for your OS. Don't search for wallet apps on Stores because it will put you under higher risks of fake apps in the air. Maybe you are not aware of this risk before reading my post.  Grin

Yes, I was aware but I wasn't knowing about the extending seeds and also the wallet backup thing. Thank you so much for explaining to me in such an easy and informative way.

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!