Bitcoin Forum
December 14, 2024, 04:37:57 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 [2]  All
  Print  
Author Topic: Can a watch-only wallet sign messages from its addresses?  (Read 347 times)
Abdussamad
Legendary
*
Offline Offline

Activity: 3710
Merit: 1586



View Profile
July 08, 2020, 12:47:38 PM
 #21

just because you can store 256 versions/address types doesn't mean you have to use all of them today. you can use the ones you need to and leave the rest for future expansion. or use a smaller number of bits for the version/address type like 4 or 6 bits.

electrum actually uses a system where the first 4 bits tell you how long the version number is. it's very flexible and perhaps overkill.

a single byte would allow for 256 different address types (2^8).

not if you use it as a "flag". then each bit has a separate meaning and can be combined with other bits. if you use integer values (1, 2, 3,...) then you'll have to define a lot of different cases (1-> x, 2->y, 3->z,... 50->x+y, 60->x+z,...). that makes implementation a nightmare.
in contrast using 0b00000001->x, 0b00000010->y is enough because x+y is 0b00000011 with a simple OR (x|y)

what's the advantage of doing bitwise operations like these on the version bits? seems like a poor use of space to me.
pooya87
Legendary
*
Offline Offline

Activity: 3668
Merit: 11107


Crypto Swap Exchange


View Profile
July 08, 2020, 03:28:33 PM
 #22

~
what's the advantage of doing bitwise operations like these on the version bits? seems like a poor use of space to me.

mainly to combine different options together. they are used everywhere in programming and in bitcoin. for example each transaction has a "flag" indicating its sighash type which can be combined by another bit called AnyoneCanPay. or the P2P protocol has a service "flag" that indicates the options that the node supports (full node, UTXO, bloom filters, witness, XThin and pruned).

the advantage is making what o_e_l_e_o said easier. a quick look at the bits in such a version tells the wallet right away which type of addresses it should derive from the mnemonic. this is something Electrum partially uses but only for 4 types (SegWit, legacy, SegWit-2FA and legacy-2FA) and is not that scalable since scaling it to more bytes would make the brute force operation that is performed to find the mnemonic a lot harder and can potentially end up taking minutes for the user to generate a new wallet!

█▀▀▀











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











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
NotATether (OP)
Legendary
*
Offline Offline

Activity: 1820
Merit: 7476


Top Crypto Casino


View Profile WWW
July 08, 2020, 11:34:40 PM
 #23

Something worth noting at this point is that new address types take what seems like forever to be proposed. For example the earliest mentions of segwit P2WSH and P2WPKH I found in the bitcoin-dev mailing list are in January 2016, but they weren't merged into the codebase until December 2017, two years later: https://github.com/bitcoin/bitcoin/commit/940a21932ba769ba5829cba713579db84f96d2f8. So for using a single byte to represent address types with flags, 3 bits are already occupied, but it leaves 5 bits which will get used up slowly as new BIPs are made.

6 or so years passed, measuring from the beginning of bitcoin core to January 2016, with only one address type in use. If we assume new address types are added every 6 years then extrapolating, I'd say that a single byte will last us 18 years from today before we run out of bits for address types.

We'd have to add an extra byte every 24 years to get more flags. I assume address types are created in the same time frame as the one between P2SH and P2WSH/P2WPKH.

███████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████

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


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