How to use hdwallet - 6 common examples

To help you get started, we’ve selected a few hdwallet examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github FelixWeis / python-hdwallet / hdwallet / bip32_test_vector.py View on Github external
prv_key = key.to_extended_key(include_prv=True)
  pub_key = key.to_extended_key()

  desc ='  * [Chain m'
  for c in chain:
    if c&0x80000000:
      desc = desc + '/%d\'' % (c & ~0x80000000)
    else:
      desc = desc + '/%d' % c
  desc = desc + ']'

  print desc

  print '    * Identifier'
  print '      * (hex):       %s' % base58.hash_160(point_compress(key.point())).encode('hex')
  print '      * (fpr):       0x%s' % key.fingerprint().encode('hex')
  print '      * (main addr): %s' % key.address()
  print '    * Secret key'
  print '      * (hex):       %s' % key.prvkey().encode('hex')
  print '      * (wif):       %s' % SecretToASecret(key.prvkey(), True)
  print '    * Public key'
  print '      * (hex):       %s' % point_compress(key.point()).encode('hex')
  print '    * Chain code'
  print '      * (hex):       %s' % key.chain().encode('hex')
  print '    * Serialized'
  print '      * (pub hex):   %s' % base58.b58decode(pub_key, None).encode('hex')
  print '      * (prv hex):   %s' % base58.b58decode(prv_key, None).encode('hex')
  print '      * (pub b58):   %s' % pub_key
  print '      * (prv b58):   %s' % prv_key
github FelixWeis / python-hdwallet / hdwallet / bip32_test_vector.py View on Github external
desc = desc + '/%d\'' % (c & ~0x80000000)
    else:
      desc = desc + '/%d' % c
  desc = desc + ']'

  print desc

  print '    * Identifier'
  print '      * (hex):       %s' % base58.hash_160(point_compress(key.point())).encode('hex')
  print '      * (fpr):       0x%s' % key.fingerprint().encode('hex')
  print '      * (main addr): %s' % key.address()
  print '    * Secret key'
  print '      * (hex):       %s' % key.prvkey().encode('hex')
  print '      * (wif):       %s' % SecretToASecret(key.prvkey(), True)
  print '    * Public key'
  print '      * (hex):       %s' % point_compress(key.point()).encode('hex')
  print '    * Chain code'
  print '      * (hex):       %s' % key.chain().encode('hex')
  print '    * Serialized'
  print '      * (pub hex):   %s' % base58.b58decode(pub_key, None).encode('hex')
  print '      * (prv hex):   %s' % base58.b58decode(prv_key, None).encode('hex')
  print '      * (pub b58):   %s' % pub_key
  print '      * (prv b58):   %s' % prv_key
github FelixWeis / python-hdwallet / hdwallet / bip32_test_vector.py View on Github external
def test_vector(seed, seq):
  print '* Master (hex): %s' % seed

  current = HDWallet.from_master_seed(seed.decode('hex'))
  print_info(current, [])
  
  for i in xrange(len(seq)):
    current = current.child(seq[i])
    print_info(current, seq[:i+1])
github FelixWeis / python-hdwallet / hdwallet / hdwallet.py View on Github external
def main():
	# 1. generate a master wallet with a (random) seed 
	master = HDWallet.from_master_seed('HDWallet seed')
	# 2. store the Private Extended Key somewhere very (!) safe
	prv_master_key = master.to_extended_key(include_prv=True)
	# 3. store the Public Extended Key on the webserver
	pub_master_key = master.to_extended_key()



	# 4. On the webserver we can generate child wallets, 
	webserver_wallet = HDWallet.from_extended_key(pub_master_key)
	child2342 = webserver_wallet.child(23).child(42)
	print '- Public Extended Key (M):', pub_master_key
	print 'Child: M/23/42'
	print 'Address:', child2342.address()
	print 'Privkey:', child2342.prvkey() # ... but the private keys remain _unknown_
	print ''


	# 5. In case we need the private key for a child wallet, start with the private master key
	cold_wallet = HDWallet.from_extended_key(prv_master_key)
	child2342 = cold_wallet.child(23).child(42)
	print '- Private Extended Key (m):', prv_master_key
	print 'Child: m/23/42'
	print 'Address:', child2342.address()
	print 'Privkey:', child2342.prvkey().encode('hex')
github FelixWeis / python-hdwallet / hdwallet / hdwallet.py View on Github external
pub_master_key = master.to_extended_key()



	# 4. On the webserver we can generate child wallets, 
	webserver_wallet = HDWallet.from_extended_key(pub_master_key)
	child2342 = webserver_wallet.child(23).child(42)
	print '- Public Extended Key (M):', pub_master_key
	print 'Child: M/23/42'
	print 'Address:', child2342.address()
	print 'Privkey:', child2342.prvkey() # ... but the private keys remain _unknown_
	print ''


	# 5. In case we need the private key for a child wallet, start with the private master key
	cold_wallet = HDWallet.from_extended_key(prv_master_key)
	child2342 = cold_wallet.child(23).child(42)
	print '- Private Extended Key (m):', prv_master_key
	print 'Child: m/23/42'
	print 'Address:', child2342.address()
	print 'Privkey:', child2342.prvkey().encode('hex')
github FelixWeis / python-hdwallet / hdwallet / hdwallet.py View on Github external
def main():
	# 1. generate a master wallet with a (random) seed 
	master = HDWallet.from_master_seed('HDWallet seed')
	# 2. store the Private Extended Key somewhere very (!) safe
	prv_master_key = master.to_extended_key(include_prv=True)
	# 3. store the Public Extended Key on the webserver
	pub_master_key = master.to_extended_key()



	# 4. On the webserver we can generate child wallets, 
	webserver_wallet = HDWallet.from_extended_key(pub_master_key)
	child2342 = webserver_wallet.child(23).child(42)
	print '- Public Extended Key (M):', pub_master_key
	print 'Child: M/23/42'
	print 'Address:', child2342.address()
	print 'Privkey:', child2342.prvkey() # ... but the private keys remain _unknown_
	print ''

hdwallet

Python-based library for the implementation of a hierarchical deterministic wallet generator for more than 140+ multiple cryptocurrencies.

MIT
Latest version published 1 year ago

Package Health Score

53 / 100
Full package analysis

Similar packages