Browse Source

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

The MMGen Project 3 years ago
parent
commit
7254375821
2 changed files with 33 additions and 9 deletions
  1. 6 6
      mmgen/tool/help.py
  2. 27 3
      mmgen/tool/rpc.py

+ 6 - 6
mmgen/tool/help.py

@@ -67,7 +67,7 @@ def usage(cmdname=None,exit_val=1):
 		  Arguments with only type specified in square brackets are required
 		  Arguments with only type specified in square brackets are required
 
 
 		  Arguments with both type and default value specified in square brackets are
 		  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 = """
 	m2 = """
@@ -76,20 +76,20 @@ def usage(cmdname=None,exit_val=1):
 
 
 		EXAMPLES:
 		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
 		  $ 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
 		  $ mmgen-tool --coin=dash --type=compressed wif2addr XJkVRC3eGKurc9Uzx1wfQoio3yqkmaXVqLMTa6y7s3M3jTBnmxfw
 
 
 		  Generate a well-known burn address:
 		  Generate a well-known burn address:
 		  $ mmgen-tool hextob58chk 000000000000000000000000000000000000000000
 		  $ mmgen-tool hextob58chk 000000000000000000000000000000000000000000
 
 
 		  Generate a random 12-word seed phrase:
 		  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:
 		  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:
 		  Encode bytes from a file to base 58:
 		  $ mmgen-tool bytestob58 /etc/timezone pad=20
 		  $ mmgen-tool bytestob58 /etc/timezone pad=20
@@ -97,7 +97,7 @@ def usage(cmdname=None,exit_val=1):
 		  Reverse a hex string:
 		  Reverse a hex string:
 		  $ mmgen-tool hexreverse "deadbeefcafe"
 		  $ mmgen-tool hexreverse "deadbeefcafe"
 
 
-		  Same as above, but use a pipe:
+		  Same as above, but supply input via stdin:
 		  $ echo "deadbeefcafe" | mmgen-tool hexreverse -
 		  $ echo "deadbeefcafe" | mmgen-tool hexreverse -
 		"""
 		"""
 
 

+ 27 - 3
mmgen/tool/rpc.py

@@ -187,19 +187,43 @@ class tool_cmd(tool_cmd_base):
 	async def rescan_blockchain(self,
 	async def rescan_blockchain(self,
 			start_block: int = None,
 			start_block: int = None,
 			stop_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
 		from ..tw.ctl import TrackingWallet
 		ret = await (await TrackingWallet(self.proto,mode='w')).rescan_blockchain(start_block,stop_block)
 		ret = await (await TrackingWallet(self.proto,mode='w')).rescan_blockchain(start_block,stop_block)
 		return True
 		return True
 
 
 	async def twexport(self,include_amts=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
 		from ..tw.json import TwJSON
 		await TwJSON.Export( self.proto, include_amts=include_amts )
 		await TwJSON.Export( self.proto, include_amts=include_amts )
 		return True
 		return True
 
 
 	async def twimport(self,filename:str,ignore_checksum=False,batch=False):
 	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
 		from ..tw.json import TwJSON
 		await TwJSON.Import( self.proto, filename, ignore_checksum=ignore_checksum, batch=batch )
 		await TwJSON.Import( self.proto, filename, ignore_checksum=ignore_checksum, batch=batch )
 		return True
 		return True