Bitcoin Forum
September 12, 2025, 08:11:05 AM *
News: Latest Bitcoin Core release: 29.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Need someone verifying these versioned private keys (BIP178 & Electrum)  (Read 212 times)
Coding Enthusiast (OP)
Legendary
*
Offline Offline

Activity: 1048
Merit: 2847


Bitcoin and C♯ Enthusiast


View Profile WWW
November 03, 2018, 12:51:42 PM
 #1

In want to make sure I understood Extended Wallet Import Format (which is what BIP178 proposes and a couple of Electrum versions used as defaulted), also have some data for unit testing.

Code:
hex: 0c28fca386c7a227600b2fe50b7cae11ec86d3bf1fbe471be89827e19d72aa1d [1]
P2PKH: KwdMAjGmerYanjeui5SHS7JkmpZvVipYvB2LJGU1ZxJwYx2CqY6c
P2WPKH: KwdMAjGmerYanjeui5SHS7JkmpZvVipYvB2LJGU1ZxJwYxCGTuAe
P2WPKH_P2SH: KwdMAjGmerYanjeui5SHS7JkmpZvVipYvB2LJGU1ZxJwYxGoTEdc

Note that above is only the BIP178 proposal which is not what Electrum is using. Electrum Extended WIFs will look like these:
Code:
hex: 0c28fca386c7a227600b2fe50b7cae11ec86d3bf1fbe471be89827e19d72aa1d
P2WPKH: L6Cyjtdfq1TimFfgG9qBEHQF2FmaL96H5ceTrip74S4eqFapbcDJ
P2WPKH_P2SH: LEncK3za1ANrjmgSpEE52TVjGgyEAZN1F4GbRBACYupN7ao1BVeh
P2SH: LgXW2Y5GXd8GfKikUTQkQynC1zaBfpBBjP8z6YCV2M5VxaMBQ5C1
P2WSH: Lq78bhSAhn3QdqjX2XoeD9sgGRmqWESutpm7ezYaWpqDEuYfi2Sc
P2WSH_P2SH: LygmAro4svxYcMkHacCY1KyAWryVLeie4GPFDStg1JavXEn8H9X5

I can't find any test vectors to use so I need verification for these. And c++ has never made any sense to me [2]! So I can't really tell how that PR is tested.
P.S. Is BIP178[3] missing bytes P2SH, P2WSH and P2WSH_P2SH and are they 0x13, 0x14 and 0x15 respectively?

[1] https://en.bitcoin.it/wiki/Wallet_import_format
[2] https://github.com/bitcoin/bitcoin/pull/12869/files
[3] https://github.com/bitcoin/bips/blob/master/bip-0178.mediawiki

Projects List+Suggestion box
Donate: 1Q9s or bc1q
|
|
|
FinderOuter(0.20.0)Ann-git
Denovo(0.8.0)Ann-git
Bitcoin.Net(0.27.0)Ann-git
|
|
|
BitcoinTransactionTool(0.11.0)Ann-git
WatchOnlyBitcoinWallet(4.0.0)Ann-git
SharpPusher(0.14.0)Ann-git
Abdussamad
Legendary
*
Offline Offline

Activity: 3886
Merit: 1651



View Profile
November 03, 2018, 04:24:12 PM
 #2

you can use the deserialize_privkey  function in electrum's bitcoin.py to test these. here's an example:

https://pastebin.com/AcEnZpFg
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!