Esempio n. 1
0
File: tx.py Progetto: etherume/mmgen
def wiftoaddr(s):
	if s == "": return False
	compressed = not s[0] == '5'
	from mmgen.bitcoin import wiftohex,privnum2addr
	hex_key = wiftohex(s,compressed)
	if not hex_key: return False
	return privnum2addr(int(hex_key,16),compressed)
Esempio n. 2
0
def wif2hex(wif,compressed=False):
	Msg(bitcoin.wiftohex(wif,compressed))
Esempio n. 3
0
def wif2addr(wif,compressed=False):
	s_enc = bitcoin.wiftohex(wif,compressed)
	if s_enc == False:
		die(1,"Invalid address")
	addr = bitcoin.privnum2addr(int(s_enc,16),compressed)
	Vmsg_r("Addr: "); Msg(addr)
Esempio n. 4
0
def randwif(compressed=False):
	r_hex = ba.hexlify(get_random(32))
	enc = bitcoin.hextowif(r_hex,compressed)
	dec = bitcoin.wiftohex(enc,compressed)
	print_convert_results(r_hex,enc,dec,"hex")
Esempio n. 5
0
File: tx.py Progetto: etherume/mmgen
def is_wif(s):
	if s == "": return False
	compressed = not s[0] == '5'
	from mmgen.bitcoin import wiftohex
	return wiftohex(s,compressed) is not False