From 72543758213e6f8cbf225ff61907bb34f3769b50 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Sat, 23 Jul 2022 11:48:14 +0000 Subject: [PATCH] `mmgen-tool`: update usage info, add usage details for `twexport`, `twimport`, `rescan_blockchain` --- mmgen/tool/help.py | 12 ++++++------ mmgen/tool/rpc.py | 30 +++++++++++++++++++++++++++--- 2 files changed, 33 insertions(+), 9 deletions(-) diff --git a/mmgen/tool/help.py b/mmgen/tool/help.py index 7cc05d5a..50f6edcb 100755 --- a/mmgen/tool/help.py +++ b/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 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 - """ diff --git a/mmgen/tool/rpc.py b/mmgen/tool/rpc.py index 941c3d77..c0c8bfaa 100755 --- a/mmgen/tool/rpc.py +++ b/mmgen/tool/rpc.py @@ -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