Created
December 8, 2017 20:32
-
-
Save dymurray/1478ab8696738035f0367e64105ecfdb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import time, sys | |
from electroncash import SimpleConfig, Network, daemon, wallet | |
from electroncash.util import print_msg, json_encode, PrintError | |
## CONFIG | |
password = "" | |
wallet_path = "/home/<user>/.electron-cash/wallets/<wallet>" | |
c = SimpleConfig() | |
# Start daemon | |
dm = daemon.Daemon(c, 0) | |
print() | |
#wallet = dm.get_wallet() | |
w = dm.load_wallet(wallet_path, password) | |
if w == None: | |
print "Couldn't find wallet." | |
exit() | |
addresses = w.get_addresses() | |
#w.sign_message() | |
#print(w.pubkeys_to_address()) | |
message = "Hello Satoshi!".encode('utf8').strip() | |
pub_keys = w.get_public_keys(addresses[0])[0] | |
print(pub_keys) | |
print(addresses[0]) | |
tx = w.mktx(outputs, password, c) | |
signed_message = w.sign_message(addresses[0], message, password) | |
decrypted_message = w.decrypt_message(pub_keys, signed_message, password) | |
#print(aw) | |
network = Network(c) | |
network.start() | |
while network.is_connecting(): | |
time.sleep(0.1) | |
if not network.is_connected(): | |
print_msg("Daemon is not connected") | |
#callback = lambda response: print_msg(json_encode(response.get('result'))) | |
#network.send([('blockchain.transaction.get', [tx])], callback) | |
#print "Sleeping for 5 seconds since network request has delay" | |
#time.sleep(5) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment