New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement address labeling #1015
Conversation
11341fa
to
b7fc070
Compare
Could there be some other information indexed by addresses we would like to store in a wallet file in future? Then I should change |
I love the feature, tested a bit and I was able to create labels for both INTERNAL and EXTERNAL addresses, I was able to see them with both
Maybe we could make it such that not providing a label arg, instead of throwing an error, removes the label.
IDK if it was intentional, I can see the labels in QT: in the |
@@ -26,6 +26,7 @@ For a quick introduction to Joinmarket you can watch [this demonstration](https: | |||
* GUI to support Taker role, including tumbler/automated coinjoin sequence. | |||
* PayJoin - [BIP78](https://github.com/bitcoin/bips/blob/master/bip-0078.mediawiki) to pay users of other wallets (e.g. merchants), as well as between two compatible wallet users (Joinmarket, Wasabi, others). This is a way to boost fungibility/privacy while paying. | |||
* Protection from [forced address reuse](https://en.bitcoin.it/wiki/Privacy#Forced_address_reuse) attacks. | |||
* Address labeling |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Address labeling | |
* Address labeling. |
Minor nit, we could make all this feature lines consistent by either always putting a dot at the end or by never putting it.
It wasn't intentional, I didn't test this with Qt. Will look into this. |
b7fc070
to
eb94c5e
Compare
Implemented proper displaying of labels in a separate column in Qt GUI. |
Tested eb94c5e:
|
Was thinking about this. User could accidentally forget to add that argument (for example, press Ctrl+V and Enter, but for some reason it wasn't in clipboard). Better approach in this case could be asking explicit question to user, like "Address label will be removed. Are you sure? (Y/N)". |
Makes sense, my feeling was that the convenience gain justifies the possible mistakes. If we were changing the label anyway, it shouldn't be a problem to lose it by accident, we can just set it to the new desired value right after. Adding an extra interaction may also hurt a little bit external scripts that want to work with labels. For me it's fine either way. |
eb94c5e
to
fe9fa71
Compare
Added returning label also in |
@PulpCattel I don't have so strong opinion here. Maybe others will have thoughts on this too. In any case, seems like a minor detail. |
fe9fa71
to
b97b044
Compare
Nobody else plans to review / test this? Also this is still an open question:
|
@@ -1584,6 +1602,12 @@ def wallet_tool_main(wallet_root_path): | |||
jmprint("args: [master public key]", "error") | |||
sys.exit(EXIT_ARGERROR) | |||
return wallet_createwatchonly(wallet_root_path, args[1]) | |||
elif method == "setlabel": | |||
if len(args) < 4: | |||
jmprint("args: address label", "error") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's certainly very reasonable to have the mechanism for removing a label be setlabel address ""
, but maybe someone might not be 100% sure about that. A very minor comment though, feel free to leave it.
My testing so far seems to show this as working correctly, except: If you try to |
I want to drop this note before I forget: now that we have an RPC exposed, we have to be careful about any changes to the structure of what is returned by |
@AdamISZ Shouldn't |
Mostly yes, but there is a subtlety, which I was unsure about when writing the above: the wallet_display will return a big json object. Even if one checks every key at every level of the tree, it doesn't necessarily mean it's wrong to have another key which is not documented. For now we don't check that anyway, but I'm saying if we did it wouldn't necessarily error and it wouldn't necessarily be a failure vector (the client could just ignore it), but we might want them to know about the new feature. |
It's a bit unclear to me. Note for example that Wasabi (iirc, it was certainly like this when they started), labels utxos not addresses. I'm not actually that clear, now I think of it, why you chose to go with address rather than utxo labels. Note that, when I implemented freezing of utxos, I did it by adding a
If I was going to do labelling, I probably would have done that. I'm sure a case can be made for a per-address label, but it's probably better if the user understands to label specific utxos. Also this would have meant we don't need another Manager object. |
I clearly remember that Wasabi creates a label as soon as you generate an address, when there is no UTXO yet, and this string is saved in the zkSNACKs/WalletWasabi#2455 (comment) |
@PulpCattel thanks for figuring it out in detail, it's clearly somewhat relevant to the discussion here. I had the privilege of doing literally the first mainnet transaction with Wasabi's first released version :) I remember the guys pointing out to me that I was forced to label what I remember as being a utxo, but given that doc, most likely my memory is wrong and it was an address. It's interesting for these wallets because of course we have this one-usage rule meaning that probably 95-99% of the time the distinction will be academic. But I suppose a good argument is: since addresses effectively label utxos themselves with that pseudonym, there wouldn't be a point in labelling utxos differently (arguable point, but you can say that). So labels at an address level are probably more intuitive. Given all this I guess we should stick with @kristapsk 's current approach. |
Proper way is to label addresses, because any UTXOs related to the same address are also related from blockchain analysis perspective. Also, as said above, more intuitive from user's perspective. So, only question remains - should it be |
Another cool feature of labeling addresses, is being able to do it before actually having any coin. So, for example, one can reserve an address for something and having it labeled as such. We can't, at least trivially, do that with UTXOs because we do not have one yet. |
I mean I wouldn't worry about the name; that can always be changed since it's internal. The only question to be concerned about is the structure of data persisted in the file. In the case of the utxo manager, when I added the |
Just for the sake of communication clarity: from my POV this is basically ready to go except for the timelock address case I mentioned (which may be trivial or not, I just didn't look at it). |
Yes, that's actually one of the use cases for me personally. I could specify JM address for something where payment will happen weeks or months later, very easy to forgot.
Almost forgot that one, will look into that (unless somebody else does). |
You cannot get / set labels for timelocked addresses because |
Or not. There is no exception raised, hmmm... Anyway, will look into that tomorrow. :) |
I took a quick look. You just need to repeat your references to label here: joinmarket-clientserver/jmclient/jmclient/wallet_utils.py Lines 473 to 484 in d5299c4
in the section starting on line 490, for fidelity bond mixdepth. |
@AdamISZ Thanks! |
So this looks ready, I plan to squash and merge this in a few days, unless there are some more comments. |
tACK on 9defcd7 - specifically, tested setting labels and deleting labels works including fidelity bonds and including Qt. |
9defcd7
to
21c0e3e
Compare
Adds new method
setlabel
towallet-tool.py
that allows to set label for wallet address. Setting it to empty string removes label. Labels are shown as additional column indisplay
anddisplayall
methods.Full functionality for now is cli only, in Qt GUI is only read-only displaying implemented.