update doc for recovery

This commit is contained in:
Nick Klockenga
2021-09-16 16:15:05 +00:00
parent fe8d6a4157
commit 293ec3b23e
5 changed files with 112 additions and 18 deletions
+29 -8
View File
@@ -1,14 +1,35 @@
# SeedSigner Recovery Information
SeedSigner creates extended public keys for the coordinator following [slip-0132](https://github.com/satoshilabs/slips/blob/master/slip-0132.md) to encode the extended public key. SeedSigner only supports native segwit for single sig (P2WPKH) and native segwit multisig (P2WSH).
SeedSigner creates extended public keys for the coordinator following [slip-0132](https://github.com/satoshilabs/slips/blob/master/slip-0132.md) to encode the extended public key. SeedSigner supports native and nested segwit for single sig and multisig.
SeedSigners default settings for "Script Policy" (2021-08-21) is Multi Sig Native Segwit. The second option is Single Sig Native Segwit.
Derivation paths for standard script types for mainnet:
- Single Sig Derivation Path: m/84'/0'/0'
- Single Sig Public Key Encoding: 0x04b24746 - zpub
- Multisig Dervivation Path: m/48'/0'/0'/2'
- Multisig Public Key Encoding: 0x02aa7ed3 - Zpub
- Single Sig
- Native Segwit
- Derivation Path: m/84'/0'/0'
- Script Type: P2WPKH
- Public Key Encoding: 0x04b24746 - zpub
- Nested Segwit
- Derivation Path: m/49'/0'/0'
- Script Type: P2WPKH in P2SH
- Public Key Encoding: 0x049d7cb2 - ypub
- Multisig
- Native Segwit
- Derivation Path: m/48'/0'/0'/2'
- Script Type: P2WSH
- Public Key Encoding: 0x02aa7ed3 - Zpub
- Nested Segwit
- Derivation Path: m/48'/0'/0'/1'
- Script Type: P2WSH in P2SH
- Public Key Encoding: 0x0295b43f - Ypub
Changing the network settings from main to test will change the public key encoding and derivation path following bip-0084, bip-0048 and slip-0132 standards.
Custom derivation paths are also optional when generating an xpub from SeedSigner. The Public Key Encodings is detected based on the derivation path configured. Embit bitcoin library does the detection and is documented [here](https://github.com/diybitcoinhardware/embit/blob/master/docs/api/bip32.md#detect_version). For a video explination of these standards see a presentation by Stepan of Embit/Specter on this topic: https://youtube.com/watch?v=JCaC5DG2HTM
Custom derivation paths will be optional in the future.
Changing the network settings from main to test in SeedSigner will change the public key encoding and derivation path following [slip-0132](https://github.com/satoshilabs/slips/blob/master/slip-0132.md) standards.
Related Standards:
- [bip-0032](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki)
- [bip-0044](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki)
- [bip-0048](https://github.com/bitcoin/bips/blob/master/bip-0048.mediawiki)
- [bip-0049](https://github.com/bitcoin/bips/blob/master/bip-0049.mediawiki)
- [bip-0084](https://github.com/bitcoin/bips/blob/master/bip-0084.mediawiki)
+30 -4
View File
@@ -9,9 +9,9 @@ class Seed:
self._valid = False
self.passphrase = passphrase
self.mnemonic = mnemonic
self.wordlist = wordlist
self._wordlist = wordlist
if self.wordlist == None:
if self._wordlist == None:
raise Exception('Wordlist Required')
self._valid = self._generate_seed()
@@ -20,7 +20,7 @@ class Seed:
def _generate_seed(self) -> bool:
self.seed = None
try:
self.seed = bip39.mnemonic_to_seed(self.mnemonic, password=self.passphrase, wordlist=self.wordlist)
self.seed = bip39.mnemonic_to_seed(self.mnemonic, password=self.passphrase, wordlist=self._wordlist)
return True
except Exception as e:
return False
@@ -54,7 +54,6 @@ class Seed:
if self._init_complete:
self._valid = self._generate_seed()
@property
def passphrase(self):
return self._passphrase
@@ -71,6 +70,33 @@ class Seed:
if self._init_complete:
self._valid = self._generate_seed()
@property
def wordlist(self):
return self._wordlist
@wordlist.setter
def wordlist(self, value):
previous_wordlist = self._wordlist
if isinstance(value, list):
if len(value) == 2048:
self._wordlist = value
else:
raise Exception('Invalid Wordlist')
else:
raise Exception('Wordlist Must be List Type')
if self.mnemonic != None:
# if has mnemonic, convert to new wordlist
previous_mnemonic_str = self._mnemonic
previous_mnemonic_list = previous_mnemonic_str.split()
new_mnemonic_list = []
for word in previous_mnemonic_list:
idx = previous_wordlist.index(word)
new_mnemonic_list.append(self._wordlist[idx])
self._mnemonic = " ".join(new_mnemonic_list)
### override operators
def __eq__(self, other):
+2 -1
View File
@@ -11,7 +11,8 @@ from seedsigner.helpers import B
class LogoView(View):
def __init__(self):
logo_url = os.path.join("seedsigner", "resources", "logo_black_240.png")
dirname = os.path.dirname(__file__)
logo_url = os.path.join(dirname, "../../", "seedsigner", "resources", "logo_black_240.png")
self.logo = Image.open(logo_url)
+5 -5
View File
@@ -72,7 +72,7 @@ def test_xpub_qr():
e = EncodeQR(seed_phrase=mnemonic.split(" "), passphrase="pass", qr_type=QRType.XPUBQR, network="test", derivation="m/48h/1h/0h/2h", wordlist=bip39.WORDLIST)
assert e.nextPart() == "[c49122a5/48h/1h/0h/2h]vpub5adb6xr5X1yqx2v7qoo5uR32BBCQsj9tRe9zbMRsH8X6tYGE6CzuiF6k3njCyHrU5JWPMsoPwNZd9Bk9Kaqy29izB8PbuU6smtv8HLcTEAv"
assert e.nextPart() == "[c49122a5/48h/1h/0h/2h]Vpub5mXgECaX5yYDNc5VnUG4jVNptyEg65qUjuofWchQeuMWWiq8rcPBoMxfrVggXj5NJmaNEToWpax8GMMucozvAdqf1bW1JsZsfdBzsK3VUC5"
def test_specter_xpub_qr():
@@ -80,9 +80,9 @@ def test_specter_xpub_qr():
e = EncodeQR(seed_phrase=mnemonic.split(" "), passphrase="pass", qr_type=QRType.SPECTERXPUBQR, network="test", derivation="m/48h/1h/0h/2h", qr_density=EncodeQRDensity.LOW, wordlist=bip39.WORDLIST)
assert e.nextPart() == "p1of4 [c49122a5/48h/1h/0h/2h]vpub5adb6xr5X1yqx"
assert e.nextPart() == "p2of4 2v7qoo5uR32BBCQsj9tRe9zbMRsH8X6tYGE6Czui"
assert e.nextPart() == "p3of4 F6k3njCyHrU5JWPMsoPwNZd9Bk9Kaqy29izB8Pbu"
assert e.nextPart() == "p4of4 U6smtv8HLcTEAv"
assert e.nextPart() == "p1of4 [c49122a5/48h/1h/0h/2h]Vpub5mXgECaX5yYDN"
assert e.nextPart() == "p2of4 c5VnUG4jVNptyEg65qUjuofWchQeuMWWiq8rcPBo"
assert e.nextPart() == "p3of4 MxfrVggXj5NJmaNEToWpax8GMMucozvAdqf1bW1J"
assert e.nextPart() == "p4of4 sZsfdBzsK3VUC5"
File diff suppressed because one or more lines are too long