mmgen-tool: update usage info, add usage details for twexport, twimport, rescan_blockchain

This commit is contained in:
The MMGen Project 2022-07-23 11:48:14 +00:00
commit 7254375821
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
2 changed files with 33 additions and 9 deletions

View file

@ -67,7 +67,7 @@ def usage(cmdname=None,exit_val=1):
Arguments with only type specified in square brackets are required
Arguments with both type and default value specified in square brackets are
optional; if used, they must be supplied in the form name=value
optional and must be specified in the form name=value
"""
m2 = """
@ -76,20 +76,20 @@ def usage(cmdname=None,exit_val=1):
EXAMPLES:
Generate a random Bech32 public/private keypair for LTC:
Generate a random LTC Bech32 public/private keypair:
$ mmgen-tool -r0 --coin=ltc --type=bech32 randpair
Generate a DASH compressed public key address from the supplied WIF key:
Generate a DASH address with compressed public key from the supplied WIF key:
$ mmgen-tool --coin=dash --type=compressed wif2addr XJkVRC3eGKurc9Uzx1wfQoio3yqkmaXVqLMTa6y7s3M3jTBnmxfw
Generate a well-known burn address:
$ mmgen-tool hextob58chk 000000000000000000000000000000000000000000
Generate a random 12-word seed phrase:
$ mmgen-tool -r0 mn_rand128
$ mmgen-tool -r0 mn_rand128 fmt=bip39
Same as above, but get additional entropy from user:
$ mmgen-tool mn_rand128
$ mmgen-tool mn_rand128 fmt=bip39
Encode bytes from a file to base 58:
$ mmgen-tool bytestob58 /etc/timezone pad=20
@ -97,7 +97,7 @@ def usage(cmdname=None,exit_val=1):
Reverse a hex string:
$ mmgen-tool hexreverse "deadbeefcafe"
Same as above, but use a pipe:
Same as above, but supply input via stdin:
$ echo "deadbeefcafe" | mmgen-tool hexreverse -
"""

View file

@ -187,19 +187,43 @@ class tool_cmd(tool_cmd_base):
async def rescan_blockchain(self,
start_block: int = None,
stop_block: int = None ):
"rescan the blockchain to update historical transactions in the tracking wallet"
"""
rescan the blockchain to update historical transactions in the tracking wallet
NOTE:
The rescanning process typically takes several hours and may be interrupted
using Ctrl-C. An interrupted rescan may be resumed using the start_block
parameter.
"""
from ..tw.ctl import TrackingWallet
ret = await (await TrackingWallet(self.proto,mode='w')).rescan_blockchain(start_block,stop_block)
return True
async def twexport(self,include_amts=True):
"export the tracking wallet to JSON format"
"""
export a tracking wallet to JSON format
NOTE:
If include_amts is true (the default), Ethereum balances will be restored
from the dump upon import. For Bitcoin and forks, amount fields in the dump
are ignored.
"""
from ..tw.json import TwJSON
await TwJSON.Export( self.proto, include_amts=include_amts )
return True
async def twimport(self,filename:str,ignore_checksum=False,batch=False):
"restore the tracking wallet from a JSON dump created by ‘twexport’"
"""
restore a tracking wallet from a JSON dump created by twexport
NOTE:
The restored tracking wallet will have correct balances but no record of
historical transactions. These may be restored by running mmgen-tool
rescan_blockchain.
"""
from ..tw.json import TwJSON
await TwJSON.Import( self.proto, filename, ignore_checksum=ignore_checksum, batch=batch )
return True