Beginning with this commit, every MMGen wallet now has a two sets of associated
subwallets with “long“ and “short” seeds.
MMGen wallets and subwallets are functionally equivalent and externally
indistinguishable. This has benefits, especially for real-world security, as
well as drawbacks. For more information, see the `mmgen-subwalletgen` help
screen: https://github.com/mmgen/mmgen/wiki/subwalletgen-[MMGen-command-help]
This patch provides subwallet generation functionality and subseed display
utilities. Support for transaction signing and address generation using a
subwallet's parent wallet will be added in a forthcoming patch.
Examples:
# Create a bogus wallet in mnemonic format for testing purposes:
$ echo $(yes bee | head -n24) > bogus.mmwords
# List the wallet's first five subseed pairs:
$ mmgen-tool list_subseeds 1-5 wallet=bogus.mmwords
Parent Seed: DF449DA4 (256 bits)
Long Subseeds Short Subseeds
------------- --------------
1L: FC9A8735 1S: 930E1AD5
2L: 62B02F54 2S: DF14AB49
3L: 9E884E99 3S: AD3ABD98
4L: DB595AE1 4S: 3E885EC4
5L: 36D5A0D1 5S: 30D66FF5
# Generate the 5th short (128-bit) subwallet from the wallet:
$ mmgen-subwalletgen bogus.mmwords 5S
# Same as above, but output subwallet to mnemonic (seed phrase) format:
$ mmgen-subwalletgen -o mn bogus.mmwords 5S
...
Mnemonic data written to file '30D66FF5[128].mmwords'
# View the subwallet's seed phrase:
$ cat 30D66FF5[128].mmwords
object capture field heart page observe road bond mother loser really army
# Generate 10 addresses from the subwallet seed phrase:
$ mmgen-addrgen 30D66FF5[128].mmwords 1-10
...
Addresses written to file '30D66FF5[1-10].addrs'
from mmgen.obj import MMGenRange
r = MMGenRange('1-5') # initialize with string
r2 = MMGenRange(1,5) # or with integers
assert r == r2
assert r == (1,5)
assert r.first == 1
assert r.last == 5
assert r.items == [1,2,3,4,5]
r = MMGenRange('22') # initialize range of one item
r2 = MMGenRange(22,22)
assert r == r2
r = MMGenRange('1-1000000') # memory-frugal iteration
for n in r.iterate(): print(n)
To allow the user to verify that transaction outputs have not been altered
by a compromised online MMGen installation, print a list of non-MMGen output
addresses and amounts for all signed transactions after every autosign run.
With --full-summary, print a full view of each signed transaction instead.
- filesort: sort tx files by time ('mtime', 'ctime', 'atime')
- sort: view transaction inputs and outputs either sorted by MMGen ID/address
('addr') or in their actual order in the transaction ('raw')
- When parsing opts, opts.init() now looks only at string values from
opts_data. Global variables are evaluated only when printing help text,
after the variables are initialized
This is a work in progress. Currently, basic operations for BTC and ETH are
supported.
The successor to the MinGW64 project, MSYS2 features package management via
`pacman` and support for Python 3:
https://sourceforge.net/projects/msys2https://www.msys2.org
The rationale for this patch is similar to that of commit a7126ed:
- Many packages were imported for the sake of just a few trivial conversion
functions. These functions have been copied into the local pyethereum.utils.
- rlp has been locally copied and its import statements modified to import
the locally-copied functions. Unneeded classes and functions have been
removed.
- As a result, dependencies on the following external packages have been
eliminated:
+ rlp
+ eth-hash
+ eth-utils
+ eth-typing
+ toolz
+ cytoolz
+ setuptools
- pysha3: Monero and Ethereum use the old pre-SHA3 version of the keccak
hash function, which is not supported by hashlib.sha3.
The pysha3 package supports the function but is not portable.
Therefore, use the pure-Python implementation mmgen.keccak as a fallback,
making the pysha3 package optional.
Use of mmgen.keccak may be forced with --use-internal-keccak-module
mmgen.keccak was ported from the Python 2 implementation at
https://github.com/ctz/keccak
- ethereum (pyethereum): Installation of this package presents numerous
problems due to poor maintenance and many superfluous dependencies.
Therefore, use stripped-down and modified local versions of
ethereum.transactions and ethereum.utils as fallbacks, making the ethereum
package optional.
The local pyethereum.utils uses mmgen.keccak as a fallback for pysha3's
keccak implementation.
- the pycrypto library is now no longer used by MMGen
- cryptography initializes the counter with bytes instead of an int,
leading to a small API change
- binascii.hexlify(b'foo') -> b'foo'.hex()
- binascii.unhexlify('aabb') -> bytes.fromhex('aabb')
- replace HexBytes class with HexStr
This change has led to a ≈10% speedup in the full test-release.sh run
tooltest.py - bugfixes, remove some commands covered in tooltest2.py
mmgen-tool - bugfixes, cleanups, rename some commands, change some command
options
- all commands taking binary input can now receive it from file
or stdin
+ numerous minor fixes throughout
- test groups are now separate classes in separate modules
- test data and code is loaded on an as-needed basis
- new TestSuiteRunner and CmdGroupMgr classes
- simplified invocation: if arguments are omitted, all default tests relevant
for given network and option are run. The following set of invocations
provides nearly complete coverage of MMGen's core functionality:
test/test.py
test/test.py --segwit-random
test/test.py --bech32
test/test.py --coin=ltc
test/test.py --coin=ltc --segwit-random
test/test.py --coin=ltc --bech32
test/test.py --coin=bch
test/test.py --coin=eth
test/test.py --coin=etc
- group tool commands into classes
- add docstrings to command classes and methods
- annotate command method args
- generate call signatures + help and usage screens on the fly
- API changes:
- listaddresses,twview: new 'age_fmt' option replaces 'show_days' and 'show_age'
- addrfile_chksum and friends: 'mmtype' option removed
- tooltest.py, tooltest2.py and test.py have been updated accordingly