-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest.py
More file actions
27 lines (18 loc) · 985 Bytes
/
test.py
File metadata and controls
27 lines (18 loc) · 985 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import time,string,random
import hashlib
import bitkeylib
seed = str(time.time()) + ''.join(random.choices(string.ascii_uppercase + string.digits, k=20))
enx = seed.encode()
pk = bytes(hashlib.sha256(enx).digest())
bitkeylib.NetworkConstants.set_mainnet('BTC')
privkey_wif = bitkeylib.serialize_privkey(pk, True, "p2pkh")
txin_type, bprivkey, compressed = bitkeylib.deserialize_privkey(privkey_wif)
pubkey = bitkeylib.public_key_from_private_key(bprivkey, compressed)
addr = bitkeylib.pubkey_to_address(txin_type, pubkey)
print('BTC Private Key: {0}\nPublic Key: {1}'.format(privkey_wif, addr))
bitkeylib.NetworkConstants.set_mainnet('LTC')
privkey_wif = bitkeylib.serialize_privkey(pk, True, "p2pkh")
txin_type, bprivkey, compressed = bitkeylib.deserialize_privkey(privkey_wif)
pubkey = bitkeylib.public_key_from_private_key(bprivkey, compressed)
addr = bitkeylib.pubkey_to_address(txin_type, pubkey)
print('LTC Private Key: {0}\nPublic Key: {1}'.format(privkey_wif, addr))