def getreceivedbyaddress(PARAMETER):
	"""Returns amount of HBN received by an address.
	   [PARAMETER] is required and should be a HBN address.
	"""

	d = urllib.urlopen(blockexplorer('getreceivedbyaddress') + '/' + str(PARAMETER))
	return d.read()
def addresstohash(PARAMETER):
	"""Returns the public key hash encoded in an address.
	   [PARAMETER] is required and should be a HBN address.
	"""
	
	d = urllib.urlopen(blockexplorer('addresstohash') + '/' + str(PARAMETER))
	return d.read()
def translate_address(PARAMETER):
	"""Translates address for use in HBN chain
	   [PARAMETER] is required and can be any crypto address.
	"""

	d = urllib.urlopen(blockexplorer('translate_address') + '/' + str(PARAMETER))
	return d.read()
def addressbalance(PARAMETER):
	"""Returns the address balance.
	   [PARAMETER] is required and should be a HBN address.
	"""
	
	d = urllib.urlopen(blockexplorer('addressbalance') + '/' + str(PARAMETER))
	return float(d.read())
def block_count():
	"""Returns the number of blocks in the longest block chain.
	   Equivalent to Bitcoin's getblockcount.
	"""

	d = urllib.urlopen(blockexplorer('getblockcount'))
	return float(d.read())
def hashtoaddress(PARAMETER):
	"""Converts a 160-bit hash to an address.
	   [PARAMETER] is required and should be an address hash.
	"""

	d = urllib.urlopen(blockexplorer('hashtoaddress') + '/' + str(PARAMETER))
	return d.read()
def hashpubkey(PARAMETER):
	"""Returns the 160-bit hash of PUBKEY.
	   [PARAMETER] is required and should be a PUBKEY.
	"""

	d = urllib.urlopen(blockexplorer('hashpubkey') + '/' + str(PARAMETER))
	return d.read()
def checkaddress(PARAMETER):
	"""Checks if specified address is valid and returns
	   _pubkeyhash_version_byte.
	   [PARAMETER] is required and can be any crypto address.
	"""

	d = urllib.urlopen(blockexplorer('checkaddress') + '/' + str(PARAMETER))
	return d.read()
Пример #9
0
def decode_address(PARAMETER):
	"""
	Returns the version prefix and hash encoded in an address
	[PARAMETER] is required and can be any crypto address.
	"""
	
	d = urllib2.urlopen(blockexplorer('decode_address') + '/' + str(PARAMETER))
	return d.read()
def hashrate():
	"""Returns the current network hashrate."""

	c = block_count()
	blocks = "%.0f" %c
	d = urllib.urlopen(blockexplorer('nethash') + '/' + str(blocks))
	last_line = d.readlines()[-1]
	e = last_line.split(',')
	return e[-1]
def total_coins():
	"""Returns the number of Hobonickels mined."""
	
	d = urllib.urlopen(blockexplorer('totalbc'))
	return float(d.read())
def difficulty():
	"""Returns the current network difficulty."""

	d = urllib.urlopen(blockexplorer('getdifficulty'))
	return float(d.read())