Commit graph

2,768 commits

Author SHA1 Message Date
d8e1d5f88c
term.py: new MMGenTerm family of classes
Testing:

    $ test/misc/term.py
2020-03-15 19:43:23 +00:00
9a888735a6
minor fixes and cleanups 2020-03-13 19:51:08 +00:00
04add0dfa5
new mnemonic entry modes, new 'mn2hex_interactive' tool command
Auto-completion functionality for seed phrase entry provides real benefit to the
user, reducing the number of keystrokes required and permitting quick re-entry
of mistyped words.  In addition, unifying the number of keystrokes among words
improves security against acoustic side-channel attacks.  To this end, three
new interactive mnemonic entry modes are introduced by this patch.

Each entry mode is optimized for a particular wordlist.  The “short” mode, for
example, takes advantage of the fact that each word in the Monero wordlist is
uniquely identifiable by its first three letters.  For MMGen’s default Electrum
wordlist, which lacks this unique substring property, the “minimal” mode was
developed to reduce keystrokes to a minimum while retaining the option of
obfuscating entry with pad characters.

Users who prefer not to use auto-completion may specify the “full” mode, which
emulates the previous default behavior.

Overview of the key entry modes:

- 'full' (all wordlists): words are typed in full and entered with the ENTER
  or SPACE key, or by exceeding the pad character limit (see below).

- 'short' (BIP39, Monero): words are entered automatically once user types
  UNIQ_SS_LEN (see below) valid word letters.  3-letter words in the BIP39
  wordlist must be entered with the ENTER or SPACE key, or by exceeding the
  pad character limit.

- 'fixed' (BIP39, Electrum): words are entered automatically once user types
  UNIQ_SS_LEN characters in total.  Words shorter than UNIQ_SS_LEN must be
  padded to fit.  Thus the total number of characters entered is the same for
  all words.

- 'minimal' (Electrum): words are entered automatically once user types the
  minimum number of characters required to uniquely identify a word (varies
  from word to word).  Words that are substrings of other words in the wordlist
  must be entered with the ENTER or SPACE key, or by exceeding the pad
  character limit.  This is the only mode that checks user input letter by
  letter.

Pad character limits by mode:
-----------------------------
  short:   16
  minimal: 16
  full:    longest_word - word_len
  fixed:   uniq_ss_len - word_len

Wordlist parameters:
--------------------
  Parameter        Electrum   BIP39   XMRSEED
  ---------        --------   -----   -------
  uniq_ss_len:     10         4       3
  shortest_word:   3          3       4
  longest word:    12         8       12
  optimum mode:    minimal    fixed   short

Default modes for each wordlist may be configured in 'mmgen.cfg' via the
'mnemonic_entry_modes' option.

Usage / testing:

    $ mmgen-walletconv -i words
    $ mmgen-walletconv -i bip39

    $ mmgen-tool mn2hex_interactive fmt=mmgen mn_len=12 print_mn=1
    $ mmgen-tool mn2hex_interactive fmt=bip39
    $ mmgen-tool mn2hex_interactive fmt=xmrseed

    $ test/unit_tests.py mn_entry
    $ test/test.py -e input
2020-03-12 17:12:43 +00:00
987dafd353
opts.py: init sequence, opt checking cleanups/improvements
Testing:

  $ test/test.py opts
2020-03-12 17:10:02 +00:00
924ccc6012
new CfgFile API for mmgen.cfg and related files
Testing:

  $ test/test.py cfg
2020-03-12 17:01:47 +00:00
ea83e2595d
test.py: move tool and input tests to their own modules 2020-03-12 16:59:55 +00:00
853a24df21
minor fixes, cleanups and additions 2020-03-12 16:38:02 +00:00
c7d15bcacf
Version bump 2020-03-01 09:12:21 +00:00
6d9a192c54
Version 0.12.0 v0.12.0 2020-02-26 16:49:05 +00:00
1f98c42ab8
Update README, update documentation from wiki 2020-02-25 19:03:47 +00:00
f4d2829a54
Daemon: new 'flags' arg; testing/release: minor fixes 2020-02-25 16:45:27 +00:00
5fe92460ad
release/testing: UTF8 testing fixes, other fixes and improvements 2020-02-22 19:54:03 +00:00
cd3e1e3574
MoneroWalletRPCConnection: use requests library 2020-02-21 13:53:21 +00:00
43fc89e2bb
Daemon: use lockfile, attempt repeated starts before failing 2020-02-21 13:42:56 +00:00
fe7fd06017
[msys2]: use Curl for RPC
Workaround necessitated by severe performance issues with the Python HTTP
module on MSYS2.  Other Python HTTP libraries seem to be affected too.
2020-02-20 20:47:17 +00:00
a27eddef10
rpc.py: minor code cleanups 2020-02-20 20:44:10 +00:00
9a4920a1b5
release/testing: minor fixes and improvements 2020-02-18 20:28:28 +00:00
4fc344dfe5
tool_api: warn on low trust-level altcoins 2020-02-18 15:32:20 +00:00
4493a7b10f
Daemon: hide Windows console 2020-02-18 14:59:55 +00:00
78652dc664
add v0.12.0 release notes 2020-02-18 14:23:31 +00:00
0f8d259cf6
[msys2]: remove mswin_pw_warning 2020-02-18 14:18:56 +00:00
b4a60208e4
test-release.sh: add 'noalt' test group 2020-02-18 14:07:51 +00:00
673b97b3b8
update copyright dates 2020-02-18 14:07:27 +00:00
99a8c46578
[msys2]: support Monero and Monero wallet RPC daemons 2020-02-17 16:54:57 +00:00
f805663041
new Tool API interface
- provides a convenient interface to selected methods in the mmgen.tool module
- Type `pydoc3 mmgen.tool.tool_api` for available methods and call signatures

## Examples:

### Initialize:

    from mmgen.tool import tool_api
    tool = tool_api()

### Utility methods:

    # Skip user entropy gathering (not recommended)
    tool.usr_randchars = 0

    # Generate a random hex secret:
    hexsec = tool.randhex()

    # Reverse the hex string:
    hexsec_rev = tool.hexreverse(hexsec)

    # Get the HASH160 of the value:
    sec_hash160 = tool.hash160(hexsec)

    # Convert the value to base58 format:
    sec_b58 = tool.hextob58(hexsec)

    # Convert the value to base58 check format:
    sec_b58chk = tool.hextob58chk(hexsec)

    # Convert the byte specification '4G' to an integer:
    four_g = tool.bytespec('4G')

    # Convert the byte specification '4GB' to an integer:
    four_gb = tool.bytespec('4GB')

### Key/address generation:

    # List available coins:
    print(' '.join(tool.coins))

    # Initialize a coin/network pair:
    proto = tool.init_coin('btc','mainnet')

    # Print the available address types for current coin/network, along with a
    # description.  If tool.addrtype is unset, the first-listed will be used:
    tool.print_addrtypes()

    # Set the address type to P2PKH with compressed public key:
    tool.addrtype = 'compressed'

    # Generate the key and address:
    wif = tool.hex2wif(hexsec)
    addr = tool.wif2addr(wif)

    # Generate an LTC regtest Segwit key and address:
    proto = tool.init_coin('ltc','regtest')
    tool.addrtype = 'segwit'
    wif = tool.hex2wif(hexsec)
    addr = tool.wif2addr(wif)

    # Generate a random LTC regtest Bech32 key/address pair:
    tool.addrtype = 'bech32'
    wif,addr = tool.randpair()

### Mnemonic seed phrase generation:

    # Generate an MMGen native mnemonic seed phrase:
    mmgen_seed = tool.hex2mn(hexsec)

    # Generate a BIP39 mnemonic seed phrase:
    bip39_seed = tool.hex2mn(hexsec,fmt='bip39')
2020-02-15 14:32:14 +00:00
07131b160a
protocol.py: improve handling of testnet/regtest Bech32 HRP 2020-02-15 14:13:13 +00:00
e1f7a50ba4
minor changes and fixes 2020-02-15 14:11:30 +00:00
3951925a93
reimplement Monero wallet creation/syncing tool
This patch reimplements the `mmgen-tool` commands `keyaddrlist2monerowallets`
and `syncmonerowallets`.

- to communicate with monerod, the helper daemon `monero-wallet-rpc` is now
  used instead of `monero-wallet-cli`.  The helper daemon is started and
  stopped automatically
- wallet sync time is significantly reduced
- commands should now work under MSWin/MSYS2 (testing TBD)
2020-02-12 10:38:27 +00:00
779f522d16
new MoneroWalletDaemon, MoneroWalletRPCConnection classes 2020-02-12 10:38:26 +00:00
ff104847d8
SeedSource.__new__(): cleanups, fixes 2020-02-12 10:38:24 +00:00
cfa16418b3
limited Monero mnemonic seed phrase ('xmrseed') support
- only 256-bit (25-word) new-style mnemonics are supported

Testing:

  $ test/unit_tests.py baseconv
  $ test/tooltest2.py hex2mn mn2hex
  $ test/scrambletest.py pw
  $ test/test.py ref_xmrseed_25_passwdgen_3
  $ test/test.py ref_passwdfile_chk_xmrseed_25

The following operations are supported:

  Generate a random Monero mnemonic:

  $ mmgen-tool mn_rand256 fmt=xmrseed

  Generate a Monero mnemonic from hexadecimal data:

  $ mmgen-tool hex2mn deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef fmt=xmrseed

  Convert the resulting mnemonic back to hexadecimal data:

  $ mmgen-tool mn2hex 'viewpoint donuts ardent template unveil agile meant unafraid urgent athlete rustled mime azure jaded hawk baby jagged haystack baby jagged haystack ramped oncoming point template' fmt=xmrseed

  Note that the result of the reversal does not match the original input.  This
  is because input data is reduced to a spendkey before conversion so that a
  canonical seed phrase is produced.  This is required because Monero seeds,
  unlike ordinary wallet seeds, are tied to a concrete key/address pair.  The
  spendkey can be generated directly using the `hex2wif` command:

  $ mmgen-tool --coin=xmr hex2wif deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef

  Generate a list of passwords in Monero mnemonic format with ID 'mymonero':

  $ mmgen-passgen -f xmrseed 'mymonero' 1-10
2020-02-12 10:38:11 +00:00
c7220cc5e3
CoinDaemon.__new__(): cleanups 2020-02-12 10:36:17 +00:00
70675956b8
various fixes and cleanups throughout 2020-02-12 10:36:15 +00:00
e33d56c09e
CoinDaemon: move non-coin-specific methods to new Daemon superclass 2020-02-08 18:17:00 +00:00
93bb5ebcb5
global rename: Daemon -> CoinDaemon 2020-02-08 17:58:56 +00:00
6f0e51d566
Daemon: handle path and RPC port selection logic in class 2020-02-08 17:43:59 +00:00
4803dea18c
Daemon: coinsym -> daemon_id, coins -> daemon_ids 2020-02-08 17:41:32 +00:00
4b2c76c9c9
mmgen-seedsplit: add BIP39 example; 'secp256k1' -> 'libsecp256k1' 2020-02-08 12:07:27 +00:00
12e742fb00
global rename: TestDaemon -> Daemon 2019-12-10 18:27:19 +00:00
ac02cf66a6
file rename: test_daemon.py -> daemon.py 2019-12-10 18:16:56 +00:00
3d9bcd7876
test.py ethdev: auto-use precompiled contract data if solc not available 2019-12-08 18:38:31 +00:00
ebe21cf8d8
TestDaemon: support ETH; test.py: start/stop parity automatically 2019-12-08 18:36:40 +00:00
69890d831b
TestDaemon: use non-standard RPC ports 2019-12-08 18:29:46 +00:00
fe8fdabdab
test_daemon.py,rpc.py: various cleanups 2019-12-08 18:19:12 +00:00
041c55b65a
test.py,unit_tests.py: start/stop BTC,LTC,BCH daemons automatically 2019-12-07 12:45:04 +00:00
adc5bc6e36
test-release.sh: start/stop monerod automatically 2019-12-07 12:41:40 +00:00
76925c0d5b
test/{start,stop}-coin-daemons.py: test suite daemon control utility 2019-12-07 12:37:41 +00:00
ae7de5d5d4
mmgen-regtest: complete OO rewrite using TestDaemon API 2019-12-07 12:33:36 +00:00
f18b14d395
new TestDaemon API for controlling test-suite & regtest daemons 2019-12-07 12:33:01 +00:00
d22fd160c5
lots of minor fixes and cleanups throughout 2019-12-07 12:20:21 +00:00