tupdate merchant script - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 640a6a3bf99656a55d84ae2ac05a0212588e927f DIR parent 960407925a19104bb2bfa86dd3a05eeb745f0dea HTML Author: ThomasV <thomasv@gitorious> Date: Mon, 28 Jul 2014 15:57:08 +0200 update merchant script Diffstat: M scripts/merchant/merchant.conf.tem… | 3 +-- M scripts/merchant/merchant.py | 22 ++++++++++++---------- 2 files changed, 13 insertions(+), 12 deletions(-) --- DIR diff --git a/scripts/merchant/merchant.conf.template b/scripts/merchant/merchant.conf.template t@@ -7,8 +7,7 @@ password = choose a password database = database filename [electrum] -mpk = the master public key of your wallet (in hexadecimal) -chain = second part of the mastrer public key (hexadecimal) +xpub = the master public key of your wallet wallet_path = path where the script will save the wallet [callback] DIR diff --git a/scripts/merchant/merchant.py b/scripts/merchant/merchant.py t@@ -21,8 +21,9 @@ import time, thread, sys, socket, os import urllib2,json import Queue import sqlite3 -from electrum import Wallet, WalletStorage, SimpleConfig, Network, set_verbosity -set_verbosity(False) + +import electrum +electrum.set_verbosity(False) import ConfigParser config = ConfigParser.ConfigParser() t@@ -39,8 +40,7 @@ expired_url = config.get('callback','expired') cb_password = config.get('callback','password') wallet_path = config.get('electrum','wallet_path') -master_public_key = config.get('electrum','mpk') -master_chain = config.get('electrum','chain') +xpub = config.get('electrum','xpub') pending_requests = {} t@@ -158,16 +158,18 @@ if __name__ == '__main__': check_create_table(conn) # init network - config = SimpleConfig({'wallet_path':wallet_path}) - network = Network(config) - network.start(wait=True) + network = electrum.NetworkProxy(False) + network.start() + while network.is_connecting(): + time.sleep(0.1) # create watching_only wallet - storage = WalletStorage(config) - wallet = Wallet(storage) + config = electrum.SimpleConfig({'wallet_path':wallet_path}) + storage = electrum.WalletStorage(config) + wallet = electrum.wallet.NewWallet(storage) if not storage.file_exists: wallet.seed = '' - wallet.create_watching_only_wallet(master_public_key) + wallet.create_watching_only_wallet(xpub) wallet.synchronize = lambda: None # prevent address creation by the wallet wallet.start_threads(network)