From e5a7b51b4f56e884cdf3c3425adcade966dd0b5b Mon Sep 17 00:00:00 2001 From: philemon Date: Wed, 23 Nov 2016 22:04:17 +0300 Subject: [PATCH] Version 0.8.8 Documentation updated [mswin]: colons removed from filenames in test/ref [mswin]: commas allowed in hidden incog filename parameter --- ...Install-MMGen-on-Debian-or-Ubuntu-Linux.md | 2 +- .../using-mmgen/Getting-Started-with-MMGen.md | 66 ++++++++++++------ mmgen/globalvars.py | 2 +- mmgen/opts.py | 13 ++-- mmgen/seed.py | 8 +-- ...-B55E9958-77256FC1[192,1].incog.offset123} | Bin ...E9958-D85FF20C[192,1].incog-old.offset123} | Bin ...-F59B07A0-559CEF19[256,1].incog.offset123} | Bin ...B07A0-848535F3[256,1].incog-old.offset123} | Bin ...E495F-9860A85B[128,1].incog-old.offset123} | 0 ...-161E495F-BEB7548E[128,1].incog-offset123} | Bin test/test.py | 19 +++-- 12 files changed, 68 insertions(+), 42 deletions(-) rename test/ref/{1378FC64-B55E9958-77256FC1[192:1].incog.offset123 => 1378FC64-B55E9958-77256FC1[192,1].incog.offset123} (100%) rename test/ref/{1378FC64-B55E9958-D85FF20C[192:1].incog-old.offset123 => 1378FC64-B55E9958-D85FF20C[192,1].incog-old.offset123} (100%) rename test/ref/{98831F3A-F59B07A0-559CEF19[256:1].incog.offset123 => 98831F3A-F59B07A0-559CEF19[256,1].incog.offset123} (100%) rename test/ref/{98831F3A-F59B07A0-848535F3[256:1].incog-old.offset123 => 98831F3A-F59B07A0-848535F3[256,1].incog-old.offset123} (100%) rename test/ref/{FE3C6545-161E495F-9860A85B[128:1].incog-old.offset123 => FE3C6545-161E495F-9860A85B[128,1].incog-old.offset123} (100%) rename test/ref/{FE3C6545-161E495F-BEB7548E[128:1].incog-offset123 => FE3C6545-161E495F-BEB7548E[128,1].incog-offset123} (100%) diff --git a/doc/wiki/install-linux/Install-MMGen-on-Debian-or-Ubuntu-Linux.md b/doc/wiki/install-linux/Install-MMGen-on-Debian-or-Ubuntu-Linux.md index fc9d0472..3bc901ec 100644 --- a/doc/wiki/install-linux/Install-MMGen-on-Debian-or-Ubuntu-Linux.md +++ b/doc/wiki/install-linux/Install-MMGen-on-Debian-or-Ubuntu-Linux.md @@ -2,7 +2,7 @@ Install required Debian/Ubuntu packages: - $ sudo apt-get install python-pip python-dev python-pexpect python-ecdsa python-scrypt libssl-dev git autoconf libtool + $ sudo apt-get install python-pip python-dev python-pexpect python-ecdsa python-scrypt libssl-dev git autoconf libtool wipe Install the Python Cryptography Toolkit: diff --git a/doc/wiki/using-mmgen/Getting-Started-with-MMGen.md b/doc/wiki/using-mmgen/Getting-Started-with-MMGen.md index 23edb6a6..ba149710 100644 --- a/doc/wiki/using-mmgen/Getting-Started-with-MMGen.md +++ b/doc/wiki/using-mmgen/Getting-Started-with-MMGen.md @@ -24,20 +24,42 @@ format conversion, address and key generation, and address import operations can be performed on either an online or offline computer with an empty blockchain and no Bitcoin balance. +*NOTE: Beginning with v0.8.7a, MMGen supports testnet, allowing you to perform +the entire set of MMGen operations without risking real funds (free testnet +coins may be obtained at [https://tpfaucet.appspot.com/][2]). To use this +feature, start bitcoind with the -testnet option and sync the testnet blockchain +(about 9GB at this time of writing). To make MMGen use testnet instead of +mainnet, supply the `--testnet=1` option as the first argument to all MMGen +commands you run. To save typing, the option may also be set in the MMGen +configuration file.* + Note that all the filenames, seed IDs, Bitcoin addresses and so forth used in -this primer are fake. Substitute real ones in their place as you go. The up -arrow (for repeating commands) and tab key (or Ctrl-I) (for completing commands -and filenames) will speed up your work at the command line greatly. +this primer are fake and for purposes of illustration only. The up arrow (for +repeating commands) and tab key (or Ctrl-I) (for completing commands and +filenames) will speed up your work at the command line greatly. ### Basic Operations #### Generate a wallet (offline computer): +*NOTE: Beginning with v0.8.8, MMGen supports a “default wallet” feature. After +creating your wallet, MMGen will prompt you to make it your default. If you +answer 'y', the wallet will be stored in your MMGen data directory and used for +all future commands that require a wallet or other seed source.* + +*If you don't want your MMGen wallet stored in your MMGen data directory, then +you may not to want to use this feature. Otherwise, it's recommended, as it +saves you from having to type your wallet on the command line.* + +*The following examples suppose that you've chosen to use a default wallet. +Bear in mind that if you hadn't, the wallet would need to be specified as an +argument to all commands where it's relevant.* + On your offline computer, generate a wallet: $ mmgen-walletgen ... - MMGen wallet written to file '89ABCDEF-76543210[256,3].mmdat' + MMGen wallet written to file '/home/username/.mmgen/89ABCDEF-76543210[256,3].mmdat' ‘89ABCDEF’ is the Seed ID; ‘76543210’ is the Key ID. These are randomly generated, so your IDs will of course be different than these. @@ -65,7 +87,7 @@ written out by hand or memorized. Now generate ten addresses with your just-created wallet: - $ mmgen-addrgen 89ABCDEF-76543210[256,3].mmdat 1-10 + $ mmgen-addrgen 1-10 ... Addresses written to file '89ABCDEF[1-10].addrs' @@ -152,15 +174,16 @@ also). ... TOTAL: 0 BTC -Note that it’s also possible to [track ordinary Bitcoin addresses with your -tracking wallet][1]. This is not recommended, however, as you must save their -corresponding keys in a key list in order to spend them. Avoiding the use of -keys is precisely the reason MMGen was created! +*While not covered in this introduction, note that it’s also possible to [import +ordinary Bitcoin addresses into your tracking wallet][1]. This allows you to +move funds from another wallet directly to MMGen without having to go through +the network. To use it, you must save the keys corresponding to the addresses +where the funds are stored in a separate file for use during signing.* Now that your addresses are being tracked, you may go ahead and send some BTC to -them. If you send 0.1, 0.2, 0.3 and 0.4 BTC respectively, for example, your -address listing will look something like this after the transactions have been -confirmed: +them over the Bitcoin network. If you send 0.1, 0.2, 0.3 and 0.4 BTC +respectively, for example, your address listing will look something like this +after the transactions have been confirmed: $ mmgen-tool listaddresses MMGenID COMMENT BALANCE @@ -175,7 +198,9 @@ confirmed: Now that you have some BTC under MMGen’s control, you’re ready to create a transaction. Note that transactions are harmless until they’re signed and broadcast to the network, so feel free to experiment and create transactions -with different combinations of inputs and outputs. +with different combinations of inputs and outputs. If you're using testnet, +then even broadcast transactions are harmless, so it's highly recommended you +do so if you want to practice sending transactions. To send 0.1 BTC to the a third-party address 1AmkUxrfy5dMrfmeYwTxLxfIswUCcpeysc, for example, and send the change back to yourself at address 89ABCDEF:5, you’d @@ -240,13 +265,13 @@ and change addresses. This feature will be appreciated by privacy-conscious use #### Sign a transaction (offline computer): Now transfer the the raw transaction file to your offline computer and sign it -using your wallet: +using your default wallet: - $ mmgen-txsign FEDCBA[0.1].rawtx 89ABCDEF-76543210[256,3].mmdat + $ mmgen-txsign FEDCBA[0.1].rawtx ... Signed transaction written to file 'FEDCBA[0.1].sigtx' -Note that the signed transaction file bears the extension '.sigtx'. +Note that the signed transaction file has a new extension, '.sigtx'. #### Send a transaction (online computer): @@ -284,9 +309,9 @@ by invoking the desired command with the `-h` or `--help` switch. #### Using the mnemonic and seed features: -Continuing our example above, generate a mnemonic from the wallet: +Continuing our example above, generate a mnemonic from the default wallet: - $ mmgen-walletconv -o words '89ABCDEF-76543210[256,3].mmdat' + $ mmgen-walletconv -o words ... Mnemonic data written to file '89ABCDEF.mmwords' @@ -329,7 +354,7 @@ Seed ID. Seed files bear the extension '.mmseed' and are generated and used exactly the same way as mnemonic files: - $ mmgen-walletconv -o seed '89ABCDEF-76543210[256,3].mmdat' + $ mmgen-walletconv -o seed ... Seed data written to file '89ABCDEF.mmseed' @@ -477,7 +502,7 @@ create a 1GB file 'random.dat' and hide a wallet in it at offset 123456789: Data written to file 'random.dat' at offset 123456789 Your ‘random’ file can now be uploaded to a cloud storage service, for example, -or some other, preferably non-public, location on the Net (in a real-life +or some other location on the Net, preferably non-public one (in a real-life situation you will choose a less obvious offset than '123456789' though, won’t you?). @@ -506,3 +531,4 @@ Transaction signing uses the same syntax: Signed transaction written to file 'ABCDEF[0.1].sigtx' [1]: https://github.com/mmgen/mmgen/wiki/Tracking-and-spending-ordinary-Bitcoin-addresses +[2]: https://tpfaucet.appspot.com diff --git a/mmgen/globalvars.py b/mmgen/globalvars.py index 05fa0c28..08d1518e 100755 --- a/mmgen/globalvars.py +++ b/mmgen/globalvars.py @@ -36,7 +36,7 @@ class g(object): sys.exit(ev) # Variables - these might be altered at runtime: - version = '0.8.8rc1' + version = '0.8.8' release_date = 'November 2016' proj_name = 'MMGen' diff --git a/mmgen/opts.py b/mmgen/opts.py index 11304ace..f50314b8 100755 --- a/mmgen/opts.py +++ b/mmgen/opts.py @@ -320,20 +320,21 @@ def check_opts(usr_opts): # Returns false if any check fails die(1,'Output to brainwallet format unsupported') elif key in ('hidden_incog_input_params','hidden_incog_output_params'): a = val.split(',') - if len(a) != 2: + if len(a) < 2: opt_display(key,val) msg('Option requires two comma-separated arguments') return False - if not opt_is_int(a[1],desc): return False + fn,ofs = ','.join(a[:-1]),a[-1] # permit comma in filename + if not opt_is_int(ofs,desc): return False if key == 'hidden_incog_input_params': - check_infile(a[0],blkdev_ok=True) + check_infile(fn,blkdev_ok=True) key2 = 'in_fmt' else: - try: os.stat(a[0]) + try: os.stat(fn) except: - b = os.path.dirname(a[0]) + b = os.path.dirname(fn) if b: check_outdir(b) - else: check_outfile(a[0],blkdev_ok=True) + else: check_outfile(fn,blkdev_ok=True) key2 = 'out_fmt' if hasattr(opt,key2): val2 = getattr(opt,key2) diff --git a/mmgen/seed.py b/mmgen/seed.py index fac6707b..7721f62d 100755 --- a/mmgen/seed.py +++ b/mmgen/seed.py @@ -84,7 +84,8 @@ class SeedSource(MMGenObject): if fn: f = Filename(fn) else: - fn = opt.hidden_incog_input_params.split(',')[0] + # permit comma in filename + fn = ','.join(opt.hidden_incog_input_params.split(',')[:-1]) f = Filename(fn,ftype=IncogWalletHidden) if opt.in_fmt and not ignore_in_fmt: die_on_opt_mismatch(opt.in_fmt,f.ftype) @@ -924,9 +925,8 @@ harder to find, you're advised to choose a much larger file size than this. } def _get_hincog_params(self,wtype): - p = getattr(opt,'hidden_incog_'+ wtype +'_params') - a,b = p.split(',') - return a,int(b) + a = getattr(opt,'hidden_incog_'+ wtype +'_params').split(',') + return ','.join(a[:-1]),int(a[-1]) # permit comma in filename def _check_valid_offset(self,fn,action): d = self.ssdata diff --git a/test/ref/1378FC64-B55E9958-77256FC1[192:1].incog.offset123 b/test/ref/1378FC64-B55E9958-77256FC1[192,1].incog.offset123 similarity index 100% rename from test/ref/1378FC64-B55E9958-77256FC1[192:1].incog.offset123 rename to test/ref/1378FC64-B55E9958-77256FC1[192,1].incog.offset123 diff --git a/test/ref/1378FC64-B55E9958-D85FF20C[192:1].incog-old.offset123 b/test/ref/1378FC64-B55E9958-D85FF20C[192,1].incog-old.offset123 similarity index 100% rename from test/ref/1378FC64-B55E9958-D85FF20C[192:1].incog-old.offset123 rename to test/ref/1378FC64-B55E9958-D85FF20C[192,1].incog-old.offset123 diff --git a/test/ref/98831F3A-F59B07A0-559CEF19[256:1].incog.offset123 b/test/ref/98831F3A-F59B07A0-559CEF19[256,1].incog.offset123 similarity index 100% rename from test/ref/98831F3A-F59B07A0-559CEF19[256:1].incog.offset123 rename to test/ref/98831F3A-F59B07A0-559CEF19[256,1].incog.offset123 diff --git a/test/ref/98831F3A-F59B07A0-848535F3[256:1].incog-old.offset123 b/test/ref/98831F3A-F59B07A0-848535F3[256,1].incog-old.offset123 similarity index 100% rename from test/ref/98831F3A-F59B07A0-848535F3[256:1].incog-old.offset123 rename to test/ref/98831F3A-F59B07A0-848535F3[256,1].incog-old.offset123 diff --git a/test/ref/FE3C6545-161E495F-9860A85B[128:1].incog-old.offset123 b/test/ref/FE3C6545-161E495F-9860A85B[128,1].incog-old.offset123 similarity index 100% rename from test/ref/FE3C6545-161E495F-9860A85B[128:1].incog-old.offset123 rename to test/ref/FE3C6545-161E495F-9860A85B[128,1].incog-old.offset123 diff --git a/test/ref/FE3C6545-161E495F-BEB7548E[128:1].incog-offset123 b/test/ref/FE3C6545-161E495F-BEB7548E[128,1].incog-offset123 similarity index 100% rename from test/ref/FE3C6545-161E495F-BEB7548E[128:1].incog-offset123 rename to test/ref/FE3C6545-161E495F-BEB7548E[128,1].incog-offset123 diff --git a/test/test.py b/test/test.py index d9c08f65..201f47ac 100755 --- a/test/test.py +++ b/test/test.py @@ -273,8 +273,8 @@ cfgs = { 'ic_wallet': 'FE3C6545-E29303EA-5E229E30[128,1].mmincog', 'ic_wallet_hex': 'FE3C6545-BC4BE3F2-32586837[128,1].mmincox', - 'hic_wallet': 'FE3C6545-161E495F-BEB7548E[128:1].incog-offset123', - 'hic_wallet_old': 'FE3C6545-161E495F-9860A85B[128:1].incog-old.offset123', + 'hic_wallet': 'FE3C6545-161E495F-BEB7548E[128,1].incog-offset123', + 'hic_wallet_old': 'FE3C6545-161E495F-9860A85B[128,1].incog-old.offset123', 'tmpdir': os.path.join('test','tmp6'), 'kapasswd': '', @@ -299,8 +299,8 @@ cfgs = { 'ic_wallet': '1378FC64-2907DE97-F980D21F[192,1].mmincog', 'ic_wallet_hex': '1378FC64-4DCB5174-872806A7[192,1].mmincox', - 'hic_wallet': '1378FC64-B55E9958-77256FC1[192:1].incog.offset123', - 'hic_wallet_old': '1378FC64-B55E9958-D85FF20C[192:1].incog-old.offset123', + 'hic_wallet': '1378FC64-B55E9958-77256FC1[192,1].incog.offset123', + 'hic_wallet_old': '1378FC64-B55E9958-D85FF20C[192,1].incog-old.offset123', 'tmpdir': os.path.join('test','tmp7'), 'kapasswd': '', @@ -332,8 +332,8 @@ cfgs = { 'ic_wallet': '98831F3A-5482381C-18460FB1[256,1].mmincog', 'ic_wallet_hex': '98831F3A-1630A9F2-870376A9[256,1].mmincox', - 'hic_wallet': '98831F3A-F59B07A0-559CEF19[256:1].incog.offset123', - 'hic_wallet_old': '98831F3A-F59B07A0-848535F3[256:1].incog-old.offset123', + 'hic_wallet': '98831F3A-F59B07A0-559CEF19[256,1].incog.offset123', + 'hic_wallet_old': '98831F3A-F59B07A0-848535F3[256,1].incog-old.offset123', 'tmpdir': os.path.join('test','tmp8'), 'kapasswd': '', @@ -663,7 +663,7 @@ except: # Windows m1 = green('MS Windows or missing pexpect module detected. Skipping some tests and running in\n') m2 = green('interactive mode. User prompts and control values will be ') m3 = grnbg('HIGHLIGHTED IN GREEN') - m4 = green('.\nControl values should be checked against the output that precedes them.') + m4 = green('.\nControl values should be checked against the program output.') m5 = green('\nContinue?') ni = True if not keypress_confirm(m1+m2+m3+m4+m5,default_yes=True): @@ -751,8 +751,7 @@ def verify_checksum_or_exit(checksum,chk): class MMGenExpect(object): def __init__(self,name,mmgen_cmd_arg,cmd_args=[],extra_desc='',no_output=False): - if not opt.system: - mmgen_cmd = os.path.join(os.curdir,mmgen_cmd_arg) + mmgen_cmd = (os.path.join(os.curdir,mmgen_cmd_arg),mmgen_cmd_arg)[bool(opt.system)] desc = (cmd_data[name][1],name)[bool(opt.names)] if extra_desc: desc += ' ' + extra_desc for i in cmd_args: @@ -2036,7 +2035,7 @@ start_time = int(time.time()) def end_msg(): t = int(time.time()) - start_time m1 = 'All requested tests finished OK, elapsed time: {:02d}:{:02d}\n' - m2 = ('','Please re-check all {} control values against the output preceding them.\n'.format(grnbg('HIGHLIGHTED')))[ni] + m2 = ('','Please re-check all {} control values against the program output.\n'.format(grnbg('HIGHLIGHTED')))[ni] sys.stderr.write(green(m1.format(t/60,t%60))) sys.stderr.write(m2)