Commit graph

38 commits

Author SHA1 Message Date
cb7f38370b
Update copyright dates 2021-02-19 20:09:06 +03:00
d2055c93da
test.py: allow color for some test groups; minor fixes, cleanups 2020-06-03 12:29:50 +00:00
c27c464a87
obj.py: InitErrors: allow selected exceptions to be passed through 2020-06-02 19:33:15 +00:00
0852321c21
obj.py: remove 'on_fail' keyword arg
- During initialization, data objects now invariably raise an exception on
  failure (ObjectInitError by default, configurable via the 'exc' attribute).

- For callers that need to handle the exception, the new get_obj() wrapper is
  provided.

Testing:

    $ test/objtest.py -S
    $ test/objtest.py -S --getobj
2020-06-01 09:59:04 +00:00
5e745f2a08
string formatting, whitespace, minor fixes throughout 2020-06-01 09:25:56 +00:00
c3f185e8b0
eliminate use of global vars g.proto, g.coin, g.rpc and others
This patch eliminates nearly all the global variables that changed during the
execution of scripts.  With a few minor exceptions, global vars are now used
only during initialization or reserved for cfg file / cmdline options and other
unchanging values.

The result is a code base that's much more maintainable and extensible and less
error-prone.  The autosigning code, which supports signing of transactions for
multiple protocols and networks, has been greatly simplified.

Doing away with globals required many changes throughout the code base, and
other related (and not so related) changes and cleanups were made along the
way, resulting in an enormous patch.

Additional code changes include:

    - tx.py: complete reorganization of TX classes and use of nesting

    - protocol.py: separation of Regtest and Testnet into distinct subclasses
      with separate address and transaction files and file extensions

    - new module help.py for the help notes, loaded on demand

    - addr.py: rewrite of the address file label parsing code

    - tx.py,tw.py: use of generators to create formatted text

User-visible changes include:

    - importing of addresses for tokens not yet in the user's tracking wallet
      is now performed with the `--token-addr` option instead of `--token`

Testing:

    Testing this patch requires a full run of the test suite as described on the
    Test-Suite wiki page.
2020-05-28 09:53:34 +00:00
31f7236731
protocol.py: new coin protocol instance attrs
- add 'testnet', 'regtest' and 'dcoin' attributes to coin protocol instance,
  remove is_testnet() method

- g.testnet -> g.proto.testnet, g.regtest -> g.proto.regtest

- g.coin and g.dcoin are now read-only properties shadowing g.proto.coin
  and g.proto.dcoin, respectively
2020-05-16 09:27:13 +00:00
673b97b3b8
update copyright dates 2020-02-18 14:07:27 +00:00
1f3c048172
test suite: minor fixes & cleanups 2019-11-15 10:46:16 +00:00
4d23f122aa
add g.network convenience variable 2019-11-04 16:47:21 +00:00
c1347d1080
various fixes and cleanups 2019-10-19 17:34:49 +03:00
4d07d53ff6
minor changes and cleanups 2019-10-13 20:30:56 +03:00
3d004c3600 minor fixes and cleanups 2019-10-11 15:37:52 +03:00
94e02995de
issubclass -> isinstance and related cleanups 2019-07-05 21:21:00 +03:00
0ec3eb1a07
tw.py: new get_tw_label() function; raise exception on bad tw label 2019-07-03 20:40:43 +03:00
037acf0791
modularize objtest.py 2019-05-27 11:34:23 +03:00
83e54ccb6e
objtest.py: separate test vectors for coin,network pairs 2019-05-16 12:45:52 +03:00
338cb77199
obj.py,eth/obj.py,protocol.py: exception handling cleanups 2019-05-13 11:49:35 +03:00
7538a9460e
Subwallets, Part 1: basic framework and subwallet generation
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'
2019-05-12 15:29:38 +03:00
3a09017804
various minor fixes and cleanups 2019-05-12 11:54:03 +03:00
017ecef3bc
[opts]: separate code from text in opts_data
- 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
2019-03-26 15:59:37 +03:00
b5f1ebc640
py3port: make hexadecimal values be strings instead of bytes type
- 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
2019-03-17 13:33:55 +03:00
514c1100ee Update copyright dates 2019-02-12 21:35:12 +03:00
c2675c15ed
py3port: headers 2018-11-17 23:34:04 +03:00
0eff2811e1
py3port: update tests 2018-10-31 21:20:59 +03:00
af2bec1220
py3port: new HexBytes class 2018-10-31 19:32:03 +03:00
25c31e8c32
py3port: Exception as e: e.message -> e.args[0] 2018-10-31 18:44:10 +03:00
2c253c0750
py3port: use bytes literals where applicable ('foo' -> b'foo') 2018-10-31 16:28:54 +03:00
949e42ebf4
py3port: 2to3 on all files
The result of running 2to3-2.7 on all Python files in the repository.
2018-10-30 19:31:14 +03:00
f0fea335eb
py3port: update hashbangs
This is the first commit of the MMGen Python 3 port.  Branch 'py3port', against
master branch commit ab06ca4

Commits are groupings of similar or related changes: automatic changes first,
followed by repetitive and global changes, followed by specific ones

All commits until the final one will leave the branch in a broken state
2018-10-30 19:23:12 +03:00
7ebe50dc0b
Use Exception attributes: e.message, e.code 2018-10-16 18:39:33 +03:00
21042737fe
Support UTF-8 wallet labels; new UTF-8 restrictions
- this means .mmdat wallet file itself is now UTF-8 (formerly ASCII-only)
- control and combining characters are now forbidden in all labels
2018-05-08 14:00:16 +03:00
MMGen
f7e54cce93
Minor fixes and improvements
- mmgen-tool listaddresses: add 'show_age','show_days' options
- init_fail(): make 'silent' override 'MMGEN_TRACEBACK', fixing regression
  introduced by 3909339
- test/test.py: improve formatting of --list output
- test/{test,objtest,scrambletest}.py, mmgen/tool.py: indentation (whitespace) fixes
2018-02-17 12:34:15 +03:00
MMGen
83e9899b38
Version 0.9.6 2018-01-14 17:24:36 +03:00
MMGen
4876ee47ed
View key support for Zcash z-addresses
- view keys are included in key-address lists
- tests updated to test the new functionality

- mmgen-tool: `compressed` and `segwit` args replaced by --type option
2017-12-18 20:19:01 +03:00
philemon
8fb3efd99c
mmgen-autosign: encrypt signing wallet with session key on removable device 2017-10-29 15:06:16 +03:00
philemon
35d1091159
Basic altcoin framework, full Litecoin support
- LTC: tested on mainnet, full test suite support
- simultaneous autosigning for all supported coins (BTC,BCH,LTC)
2017-10-28 00:11:00 +03:00
philemon
b23b497d77
obj.py rewrite+test suite, Bob and Alice regtest mode, compressed addresses
- basic data types in obj.py rewritten
- new test suite 'test/objtest.py' for testing basic data types
- new compressed address type with the 'C' identifier

- Bob and Alice regtest mode for testing MMGen in a mock two-user environment
  * All MMGen commands are available in this mode.
  * Set up with 'mmgen-regtest setup'. Bob and Alice's wallets are funded with
    500 BTC each.  Use the --mixed switch to import mixed address types in
    Bob and Alice's tracking wallets.
  * Transact as Bob by adding --bob switch to MMGen commands
  * Transact as Alice by adding --alice switch to MMGen commands
  * After sending a transaction, mine a block to confirm it with
    'mmgen-regtest generate'
    The bitcoin daemon is stopped and restarted automatically when switching
    between users.
2017-08-14 13:04:25 +03:00