Esempio n. 1
0
"""
	},
	'code': {
		'options': lambda s: s.format(
			g=g,pnm=g.proj_name,pnl=g.proj_name.lower(),
			kgs=' '.join(['{}:{}'.format(n,k) for n,k in enumerate(g.key_generators,1)]),
			fu=help_notes('rel_fee_desc'),
			fl=help_notes('fee_spec_letters'),
			ss=g.subseeds,ss_max=SubSeedIdxRange.max_idx,
			kg=g.key_generator,
			cu=g.coin),
		'notes': lambda s: s.format(
			help_notes('txcreate'),
			help_notes('fee'),
			help_notes('txsign'),
			f='\n  '.join(SeedSource.format_fmt_codes().splitlines()))
	}
}

cmd_args = opts.init(opts_data)

rpc_init()

from mmgen.tx import *
from mmgen.txsign import *

seed_files = get_seed_files(opt,cmd_args)

kal = get_keyaddrlist(opt)
kl = get_keylist(opt)
if kl and kal: kl.remove_dup_keys(kal)
Esempio n. 2
0
                      (min={g.min_urandchars}, max={g.max_urandchars}, default={g.usr_randchars})
-S, --stdout          Write wallet data to stdout instead of file
-v, --verbose         Produce more verbose output
""".format(
        g=g,
        iaction=capfirst(iaction),
        oaction=capfirst(oaction),
    ),
    'notes':
    u"""

{n_pw}{n_bw}

FMT CODES:
  {f}
""".format(f=u'\n  '.join(SeedSource.format_fmt_codes().splitlines()),
           n_pw=help_notes('passwd'),
           n_bw=(u'', '\n\n' + help_notes('brainwallet'))[bw_note])
}

cmd_args = opts.init(opts_data, opt_filter=opt_filter)

if opt.label:
    opt.label = MMGenWalletLabel(opt.label, msg="Error in option '--label'")

sf = get_seed_file(cmd_args, nargs, invoked_as=invoked_as)

if not invoked_as == 'chk': do_license_msg()

if invoked_as in ('conv', 'passchg'):
    m1 = green('Processing input wallet')
Esempio n. 3
0
def help_notes(k):
    from mmgen.seed import SeedSource
    return {
        'passwd':
        """
For passphrases all combinations of whitespace are equal and leading and
trailing space is ignored.  This permits reading passphrase or brainwallet
data from a multi-line file with free spacing and indentation.
""".strip(),
        'brainwallet':
        """
BRAINWALLET NOTE:

To thwart dictionary attacks, it's recommended to use a strong hash preset
with brainwallets.  For a brainwallet passphrase to generate the correct
seed, the same seed length and hash preset parameters must always be used.
""".strip(),
        'txcreate':
        """
The transaction's outputs are specified on the command line, while its inputs
are chosen from a list of the user's unpent outputs via an interactive menu.

If the transaction fee is not specified on the command line (see FEE
SPECIFICATION below), it will be calculated dynamically using {dn}'s
"estimatefee" function for the default (or user-specified) number of
confirmations.  If "estimatefee" fails, the user will be prompted for a fee.

Dynamic ("estimatefee") fees will be multiplied by the value of '--tx-fee-adj',
if specified.

Ages of transactions are approximate based on an average block discovery
interval of one per {g.proto.secs_per_block} seconds.

All addresses on the command line can be either {pnu} addresses or {pnm}
addresses of the form <seed ID>:<index>.

To send the value of all inputs (minus TX fee) to a single output, specify
one address with no amount on the command line.
""".format(g=g,
           pnm=g.proj_name,
           dn=g.proto.daemon_name,
           pnu=g.proto.name.capitalize()),
        'fee':
        """
FEE SPECIFICATION: Transaction fees, both on the command line and at the
interactive prompt, may be specified as either absolute {} amounts, using
a plain decimal number, or as satoshis per byte, using an integer followed by
the letter 's'.
""".format(g.coin),
        'txsign':
        """
Transactions may contain both {pnm} or non-{pnm} input addresses.

To sign non-{pnm} inputs, a {dn} wallet dump or flat key list is used
as the key source ('--keys-from-file' option).

To sign {pnm} inputs, key data is generated from a seed as with the
{pnl}-addrgen and {pnl}-keygen commands.  Alternatively, a key-address file
may be used (--mmgen-keys-from-file option).

Multiple wallets or other seed files can be listed on the command line in
any order.  If the seeds required to sign the transaction's inputs are not
found in these files (or in the default wallet), the user will be prompted
for seed data interactively.

To prevent an attacker from crafting transactions with bogus {pnm}-to-{pnu}
address mappings, all outputs to {pnm} addresses are verified with a seed
source.  Therefore, seed files or a key-address file for all {pnm} outputs
must also be supplied on the command line if the data can't be found in the
default wallet.

Seed source files must have the canonical extensions listed in the 'FileExt'
column below:

  {n_fmt}
""".format(dn=g.proto.daemon_name,
           n_fmt='\n  '.join(SeedSource.format_fmt_codes().splitlines()),
           pnm=g.proj_name,
           pnu=g.proto.name.capitalize(),
           pnl=g.proj_name.lower())
    }[k]
Esempio n. 4
0
def help_notes(k):
    from mmgen.seed import SeedSource
    from mmgen.tx import MMGenTX

    def fee_spec_letters(use_quotes=False):
        cu = g.proto.coin_amt.units
        sep, conj = ((',', ' or '), ("','", "' or '"))[use_quotes]
        return sep.join(u[0]
                        for u in cu[:-1]) + ('', conj)[len(cu) > 1] + cu[-1][0]

    def fee_spec_names():
        cu = g.proto.coin_amt.units
        return ', '.join(cu[:-1]) + ('', ' and ')[len(cu) > 1] + cu[-1] + (
            '', ',\nrespectively')[len(cu) > 1]

    return {
        'rel_fee_desc':
        MMGenTX().rel_fee_desc,
        'fee_spec_letters':
        fee_spec_letters(),
        'passwd':
        """
For passphrases all combinations of whitespace are equal and leading and
trailing space is ignored.  This permits reading passphrase or brainwallet
data from a multi-line file with free spacing and indentation.
""".strip(),
        'brainwallet':
        """
BRAINWALLET NOTE:

To thwart dictionary attacks, it's recommended to use a strong hash preset
with brainwallets.  For a brainwallet passphrase to generate the correct
seed, the same seed length and hash preset parameters must always be used.
""".strip(),
        'txcreate':
        """
The transaction's outputs are specified on the command line, while its inputs
are chosen from a list of the user's unpent outputs via an interactive menu.

If the transaction fee is not specified on the command line (see FEE
SPECIFICATION below), it will be calculated dynamically using network fee
estimation for the default (or user-specified) number of confirmations.
If network fee estimation fails, the user will be prompted for a fee.

Network-estimated fees will be multiplied by the value of '--tx-fee-adj',
if specified.

Ages of transactions are approximate based on an average block discovery
interval of one per {g.proto.secs_per_block} seconds.

All addresses on the command line can be either {pnu} addresses or {pnm}
addresses of the form <seed ID>:<index>.

To send the value of all inputs (minus TX fee) to a single output, specify
one address with no amount on the command line.
""".format(g=g, pnm=g.proj_name, pnu=g.proto.name.capitalize()),
        'fee':
        """
FEE SPECIFICATION: Transaction fees, both on the command line and at the
interactive prompt, may be specified as either absolute {c} amounts, using
a plain decimal number, or as {r}, using an integer followed by
'{l}', for {u}.
""".format(c=g.coin,
           r=MMGenTX().rel_fee_desc,
           l=fee_spec_letters(use_quotes=True),
           u=fee_spec_names()),
        'txsign':
        u"""
Transactions may contain both {pnm} or non-{pnm} input addresses.

To sign non-{pnm} inputs, a {dn} wallet dump or flat key list is used
as the key source ('--keys-from-file' option).

To sign {pnm} inputs, key data is generated from a seed as with the
{pnl}-addrgen and {pnl}-keygen commands.  Alternatively, a key-address file
may be used (--mmgen-keys-from-file option).

Multiple wallets or other seed files can be listed on the command line in
any order.  If the seeds required to sign the transaction's inputs are not
found in these files (or in the default wallet), the user will be prompted
for seed data interactively.

To prevent an attacker from crafting transactions with bogus {pnm}-to-{pnu}
address mappings, all outputs to {pnm} addresses are verified with a seed
source.  Therefore, seed files or a key-address file for all {pnm} outputs
must also be supplied on the command line if the data can't be found in the
default wallet.

Seed source files must have the canonical extensions listed in the 'FileExt'
column below:

  {n_fmt}
""".format(dn=g.proto.daemon_name,
           n_fmt='\n  '.join(SeedSource.format_fmt_codes().splitlines()),
           pnm=g.proj_name,
           pnu=g.proto.name.capitalize(),
           pnl=g.proj_name.lower())
    }[k] + (u'-α' if g.debug_utf8 else '')
Esempio n. 5
0
required {pnm} keys using 'bitcoind importprivkey'.

For transaction outputs that are {pnm} addresses, {pnm}-to-Bitcoin address
mappings are verified.  Therefore, seed material or a key-address file for
these addresses must be supplied on the command line.

Seed data supplied in files must have the following extensions:
   wallet:      '.{g.wallet_ext}'
   seed:        '.{g.seed_ext}'
   mnemonic:    '.{g.mn_ext}'
   brainwallet: '.{g.brain_ext}'

FMT CODES:
  {f}
""".format(
		f="\n  ".join(SeedSource.format_fmt_codes().splitlines()),
		g=g,pnm=pnm,pnl=pnl
	)
}

wmsg = {
	'mm2btc_mapping_error': """
{pnm} -> BTC address mappings differ!
From %-18s %s -> %s
From %-18s %s -> %s
""".strip().format(pnm=pnm),
	'removed_dups': """
Removed %s duplicate wif key%s from keylist (also in {pnm} key-address file
""".strip().format(pnm=pnm),
}