modified: mmgen-addrgen modified: mmgen-addrimport modified: mmgen-txcreate modified: mmgen-txsend modified: mmgen-txsign modified: mmgen-walletchk modified: mmgen-walletgen modified: mmgen/addr.py modified: mmgen/config.py modified: mmgen/tx.py modified: mmgen/utils.py
73 lines
2.3 KiB
Python
Executable file
73 lines
2.3 KiB
Python
Executable file
#!/usr/bin/env python
|
|
#
|
|
# mmgen = Multi-Mode GENerator, command-line Bitcoin cold storage solution
|
|
# Copyright (C) 2013 by philemon <mmgen-py@yandex.com>
|
|
#
|
|
# This program is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
"""
|
|
mmgen-addrimport: Import addresses generated by mmgen-addrgen into an
|
|
online bitcoind watching wallet.
|
|
"""
|
|
|
|
import sys
|
|
from mmgen.Opts import *
|
|
from mmgen.config import *
|
|
from mmgen.license import *
|
|
from mmgen.utils import check_infile,parse_addrs_file,confirm_or_exit
|
|
|
|
help_data = {
|
|
'prog_name': sys.argv[0].split("/")[-1],
|
|
'desc': """Import addresses generated by mmgen-addrgen into an
|
|
online bitcoind watching wallet""",
|
|
'usage':"[opts] [infile]",
|
|
'options': """
|
|
-h, --help Print this help message
|
|
-q, --quiet Suppress warnings
|
|
-v, --verbose Produce more verbose output
|
|
"""
|
|
}
|
|
|
|
short_opts = "hqv"
|
|
long_opts = "help", "quiet", "verbose"
|
|
|
|
opts,cmd_args = process_opts(sys.argv,help_data,"".join(short_opts),long_opts)
|
|
|
|
if len(cmd_args) != 1: usage(help_data)
|
|
|
|
check_infile(cmd_args[0])
|
|
|
|
seed_id,addr_data = parse_addrs_file(cmd_args[0])
|
|
|
|
from mmgen.tx import check_wallet_addr_label,connect_to_bitcoind
|
|
|
|
for i in addr_data:
|
|
i[2] = " ".join(i[2:]) if len(i) > 2 else ""
|
|
check_wallet_addr_label(i[2])
|
|
|
|
c = connect_to_bitcoind(http_timeout=3600)
|
|
|
|
message = """
|
|
Importing addresses can take a long time, up to 30 min. per address on a
|
|
low-powered computer such as a netbook.
|
|
"""
|
|
confirm_or_exit(message, "continue", expect="YES")
|
|
|
|
for n,i in enumerate(addr_data):
|
|
label = "%s:%s %s" % (seed_id,str(i[0]),i[2])
|
|
msg("Importing %-6s %-34s (%s)" % (
|
|
("%s/%s:" % (n+1,len(addr_data))),
|
|
i[1], label)
|
|
)
|
|
c.importaddress(i[1],label)
|