update merchant script

This commit is contained in:
ThomasV 2014-07-28 15:57:08 +02:00
parent 960407925a
commit 640a6a3bf9
2 changed files with 13 additions and 12 deletions

View File

@ -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]

View File

@ -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()
@ -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 = {}
@ -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)