openoms / joininbox

A terminal based graphical menu for JoinMarket
MIT License
153 stars 20 forks source link

[Feature request]] Signing messages #58

Open curemici opened 3 years ago

curemici commented 3 years ago

New item in the tools menu: Sign a message with an external address of a specified mixdepth.

Input: Wallet, Mixdepth, Textmessage Output: Signature, Address

openoms commented 3 years ago

Is this for buying bitcoin straight to your JM wallet?

Any pointers are appreciated if you happened to do this before manually.

openoms commented 3 years ago

Syntax:

(jmvenv) joinmarket@joininbox:~/joinmarket-clientserver/scripts$ python wallet-tool.py -H "m/84'/0'/4'/0/4" wallet.jmdat signmessage "Testmessage"

User data location: /home/joinmarket/.joinmarket/
Enter passphrase to decrypt wallet: 
Signature: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=
Message: Testmessage
Address: bc1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
To verify this in Electrum use Tools->Sign/verify message.

Use the first new address in the mixdepth (avoid address reuse), otherwise using a later new address results in:

(jmvenv) joinmarket@joininbox:~/joinmarket-clientserver/scripts$ python wallet-tool.py -H "m/84'/0'/4'/0/5" wallet.jmdat 

"Traceback (most recent call last):
  File "wallet-tool.py", line 6, in <module>
    jmprint(wallet_tool_main("wallets"), "success")
  File "/home/joinmarket/joinmarket-clientserver/jmclient/jmclient/wallet_utils.py", line 1553, in wallet_tool_main
    return wallet_signmessage(wallet_service, options.hd_path, args[2])
  File "/home/joinmarket/joinmarket-clientserver/jmclient/jmclient/wallet_utils.py", line 1076, in wallet_signmessage
    addr = wallet.get_address_from_path(path)
  File "/home/joinmarket/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 525, in get_address_from_path
    return self.script_to_addr(script)
  File "/home/joinmarket/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 489, in script_to_addr
    assert self.is_known_script(script)
AssertionError
openoms commented 2 years ago

This will make a good FAQ entry, not planning to implement further for now, but contributions are welcome.