update merchant script
This commit is contained in:
@@ -7,8 +7,7 @@ password = choose a password
|
|||||||
database = database filename
|
database = database filename
|
||||||
|
|
||||||
[electrum]
|
[electrum]
|
||||||
mpk = the master public key of your wallet (in hexadecimal)
|
xpub = the master public key of your wallet
|
||||||
chain = second part of the mastrer public key (hexadecimal)
|
|
||||||
wallet_path = path where the script will save the wallet
|
wallet_path = path where the script will save the wallet
|
||||||
|
|
||||||
[callback]
|
[callback]
|
||||||
|
|||||||
@@ -21,8 +21,9 @@ import time, thread, sys, socket, os
|
|||||||
import urllib2,json
|
import urllib2,json
|
||||||
import Queue
|
import Queue
|
||||||
import sqlite3
|
import sqlite3
|
||||||
from electrum import Wallet, WalletStorage, SimpleConfig, Network, set_verbosity
|
|
||||||
set_verbosity(False)
|
import electrum
|
||||||
|
electrum.set_verbosity(False)
|
||||||
|
|
||||||
import ConfigParser
|
import ConfigParser
|
||||||
config = ConfigParser.ConfigParser()
|
config = ConfigParser.ConfigParser()
|
||||||
@@ -39,8 +40,7 @@ expired_url = config.get('callback','expired')
|
|||||||
cb_password = config.get('callback','password')
|
cb_password = config.get('callback','password')
|
||||||
|
|
||||||
wallet_path = config.get('electrum','wallet_path')
|
wallet_path = config.get('electrum','wallet_path')
|
||||||
master_public_key = config.get('electrum','mpk')
|
xpub = config.get('electrum','xpub')
|
||||||
master_chain = config.get('electrum','chain')
|
|
||||||
|
|
||||||
|
|
||||||
pending_requests = {}
|
pending_requests = {}
|
||||||
@@ -158,16 +158,18 @@ if __name__ == '__main__':
|
|||||||
check_create_table(conn)
|
check_create_table(conn)
|
||||||
|
|
||||||
# init network
|
# init network
|
||||||
config = SimpleConfig({'wallet_path':wallet_path})
|
network = electrum.NetworkProxy(False)
|
||||||
network = Network(config)
|
network.start()
|
||||||
network.start(wait=True)
|
while network.is_connecting():
|
||||||
|
time.sleep(0.1)
|
||||||
|
|
||||||
# create watching_only wallet
|
# create watching_only wallet
|
||||||
storage = WalletStorage(config)
|
config = electrum.SimpleConfig({'wallet_path':wallet_path})
|
||||||
wallet = Wallet(storage)
|
storage = electrum.WalletStorage(config)
|
||||||
|
wallet = electrum.wallet.NewWallet(storage)
|
||||||
if not storage.file_exists:
|
if not storage.file_exists:
|
||||||
wallet.seed = ''
|
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.synchronize = lambda: None # prevent address creation by the wallet
|
||||||
wallet.start_threads(network)
|
wallet.start_threads(network)
|
||||||
|
|||||||
Reference in New Issue
Block a user