MCPcopy Index your code
hub / github.com/petertodd/python-bitcoinlib / CBitcoinSecret

Class CBitcoinSecret

bitcoin/wallet.py:356–372  ·  view source on GitHub ↗

A base58-encoded secret key

Source from the content-addressed store, hash-verified

354 pass
355
356class CBitcoinSecret(bitcoin.base58.CBase58Data, CKey):
357 """A base58-encoded secret key"""
358
359 @classmethod
360 def from_secret_bytes(cls, secret, compressed=True):
361 """Create a secret key from a 32-byte secret"""
362 self = cls.from_bytes(secret + (b'\x01' if compressed else b''),
363 bitcoin.params.BASE58_PREFIXES['SECRET_KEY'])
364 self.__init__(None)
365 return self
366
367 def __init__(self, s):
368 if self.nVersion != bitcoin.params.BASE58_PREFIXES['SECRET_KEY']:
369 raise CBitcoinSecretError('Not a base58-encoded secret key: got nVersion=%d; expected nVersion=%d' % \
370 (self.nVersion, bitcoin.params.BASE58_PREFIXES['SECRET_KEY']))
371
372 CKey.__init__(self, self[0:32], len(self) > 32 and self[32] == 1)
373
374
375__all__ = (

Callers 9

dumpprivkeyMethod · 0.90
sign_messageFunction · 0.90
print_verboseFunction · 0.90
TMethod · 0.85
test_signMethod · 0.85
publish-text.pyFile · 0.85

Calls

no outgoing calls

Tested by 5

TMethod · 0.68
test_signMethod · 0.68