Commit graph

696 commits

Author SHA1 Message Date
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
bb87b1f996
[BCH]: workaround for Bitcoin ABC's broken 'setlabel' RPC 2019-11-29 18:41:36 +00:00
944d7c3db7
remove last dependency on 'getbalance' RPC 2019-11-29 18:39:06 +00:00
0578f15c88
rpc.py: minor debugging fixes 2019-11-29 18:37:17 +00:00
9d3b11c798
test suite: minor fixes 2019-11-29 18:36:13 +00:00
8ec9fa1a24
[msys2]: tooltest2: add address generation vectors for ETH,XMR,ZEC
- these are required due to the lack of the following external testing tools
  in MSYS2:

  + ethkey (requires build)
  + moneropy (requires pysha3)
  + zcash-mini (requires golang)
2019-11-29 10:29:51 +00:00
1f3c048172
test suite: minor fixes & cleanups 2019-11-15 10:46:16 +00:00
2d02af152e
[msys2]: test suite fixes 2019-11-14 17:22:15 +00:00
c260fbf9aa
[msys2]: support libsecp256k1 2019-11-14 17:19:32 +00:00
da13550cd1
obj.py: create Int type, make MMGenIdx & ETHNonce its subclasses 2019-11-14 17:12:47 +00:00
d5da1e7ada
txbump: remove superfluous output choice prompt with one-output bumps 2019-11-10 15:46:39 +00:00
9c0157e0e9
txcreate,txbump: add 'fee_estimate_mode' option 2019-11-10 15:44:02 +00:00
3db1c423ef
gentest.py: forkcoin testing framework, BCH support 2019-11-06 17:35:14 +00:00
3813ce33ba
altcoin.py: add tests: verify_leading_symbols(), verify_core_coin_data() 2019-11-06 17:34:52 +00:00
6eaf01f243
a few minor cleanups 2019-11-06 17:34:26 +00:00
b4c528f92a
protocol.py: parse_addr() rewrite
- rename verify_addr() to parse_addr()
- implement using bytes instead of hex strings
- remove unnecessary first-letter and encoded length checks
- perform decoded length check
2019-11-06 17:33:35 +00:00
7451f122ed
gentest.py: complete rewrite, move tool selection logic to altcoin.py 2019-11-04 16:48:25 +00:00
1295fdb6e0
altcoin trust level changes
- make trust level system consistent, include all coins
- rewrite init_genonly_altcoins():
  + with coin argument, create only requested protocol
  + with no arguments, create all protocols
2019-11-04 16:48:05 +00:00
4d23f122aa
add g.network convenience variable 2019-11-04 16:47:21 +00:00
d47dc356af
altcoin trust level initialization fix 2019-11-02 23:07:23 +00:00
3e0caf7beb
_b58chk_encode(), _b58chk_decode(): reimplement using bytes 2019-11-02 10:39:30 +00:00
f63b35469c
parse_wif(): additional cleanups 2019-11-02 10:31:31 +00:00
5663ca0712
test-release.sh, gentest.py, tooltest.py: cleanups 2019-11-02 09:34:21 +00:00