Example #1
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()
Example #2
0
def addresstohash(PARAMETER):
	"""
	Returns the public key hash encoded in an address.
	[PARAMETER] is required and should be a DRK address.
	"""

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

	d = urllib2.urlopen(blockexplorer('checkaddress') + '/' + str(PARAMETER))
	return d.read()
Example #4
0
def translate_address(PARAMETER):
	"""
	Translates address for use in DRK chain.
	[PARAMETER] is required and can be any crypto address.
	"""

	d = urllib2.urlopen(blockexplorer('translate_address') + '/' + str(PARAMETER))
	return d.read()
Example #5
0
def addressbalance(PARAMETER):
	"""
	Returns the address balance.
	[PARAMETER] is required and should be a DRK address.
	"""

	d = urllib2.urlopen(blockexplorer('addressbalance') + '/' + str(PARAMETER))
	return float(d.read())
Example #6
0
def block_count():
	"""
	Returns the number of blocks in the longest block chain.
	Equivalent to Bitcoin's getblockcount.
	"""

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

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

	d = urllib2.urlopen(blockexplorer('hashpubkey') + '/' + str(PARAMETER))
	return d.read()
Example #9
0
def getsentbyaddress(PARAMETER):
	"""
	Returns amount of DRK sent by an address.
	[PARAMETER] is required and should be a DRK address.
	"""

	d = urllib2.urlopen(blockexplorer('getsentbyaddress') + '/' + str(PARAMETER))
	return d.read()
Example #10
0
def hashrate():
	"""Returns the current network hashrate."""

	c = block_count()
	blocks = "%.0f" %c
	d = urllib2.urlopen(blockexplorer('nethash') + '/' + str(blocks))
	last_line = d.readlines()[-1]
	e = last_line.split(',')
	return e[-1]
Example #11
0
def total_coins():
	"""Returns the number of Darkcoin mined."""

	d = urllib2.urlopen(blockexplorer('totalbc'))
	return float(d.read())
Example #12
0
def difficulty():
	"""Returns the current network difficulty."""

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