How to use the base58.encodeBase58Check function in base58

To help you get started, we’ve selected a few base58 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 cornwarecjp / Bitcoin-Cash-Off-The-Grid / bccotg.py View on Github external
def getAddress(key):
	publicKeyHash = RIPEMD160(SHA256(key.getPublicKey()))
	return base58.encodeBase58Check(publicKeyHash, 0) #PUBKEY_ADDRESS = 0
github cornwarecjp / Bitcoin-Cash-Off-The-Grid / bccotg.py View on Github external
elements = tx_out.scriptPubKey.elements
		print '    script:'
		for e in elements:
			if isinstance(e, str):
				s = e.encode("hex")
			else:
				s = '0x%0x' % e
			print '        ', s

		if len(elements) == 5 and \
			elements[0:2] == [btx.OP.DUP, btx.OP.HASH160] and \
			elements[3:5] == [btx.OP.EQUALVERIFY, btx.OP.CHECKSIG] and \
			isinstance(elements[2], str):

			address = base58.encodeBase58Check(elements[2], 0) #PUBKEY_ADDRESS = 0
			print '    Address: ', address
		else:
			print '    Unrecognized script type'

		print ''

	fee = sum(amounts) - sum([tx_out.amount for tx_out in tx.tx_out])
	print 'Tx fee: %s BCC' % str(decimal.Decimal(fee)/BCC)