-
Notifications
You must be signed in to change notification settings - Fork 79
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
[DRAFT] Monero Sub-addresses #7
Comments
also fyi @RandomRun maybe you'd be interested to have a look |
@JollyMort: Thanks for sharing, this is indeed a nice problem! I was just discussing this problem with a friend, and below is more or less what we have come up with. This happened just a few hours ago, and I am tired, so I expect it to contain some imprecisions, or perhaps even a blunder, but I hope that the idea is helps :)
This is almost identical to what happens with regular stealth addresses currently used, but now Alice can keep Over time, she will end up with a collection I am hoping that the bulk of the scanning cost was the group multiplication, and the hash function. If so, maybe this can be considered reasonable performance. [Edit: PS.: Our original setup was to make the address longer, like |
I've been staring at this for 40 minutes, and can't see a flaw, up until the private view key part. I've posted this stackexchange question about the EC point factorization issue: http://crypto.stackexchange.com/questions/43951/can-elliptic-curve-point-common-factors-be-detected I think it is probably the case that the private view key can be factored, because RSA needs far longer key lengths than 256 bits to be secure. So I think that giving away multiple view keys will allow the signing keys to be determined. I hope I'm wrong about this. |
Perhaps the view key issue could be fixed by passing to Bob a third item cG, where c is another random number. Bob would compute For each subaddress: Note that I've defined |
@knaccc: Thanks for finding out the that the view keys do leak the spend key. One way of perhaps fixing that is to go back to the original approach we had, which is: fix Alice checks:
If your |
@RandomRun Bob is given the address You're right, my comments fixed the problem of allowing the private spend key to be determined, but did not prevent multiple private view keys from being compared to notice common factors to link them together. This leak is probably not a big deal, because it is only a leak to an auditor that you'd probably want to share all subaddresses within a wallet to anyway. The main thing is that holders of different subaddresses cannot see that they're linked, and that the spend keys are safe from the auditor. I think your original approach also suffers from the same private spend key exposure issue when multiple subaddress view keys are shared with an auditor. Edit: The view key for multiple individual subaddresses cannot be given out without exposing the signing keys, but I don't think that's a problem worth moving to my three EC-point (A, B, C) address format to fix since the user can just be told to share either the view key for all subaddresses or for none at all. |
@knaccc: But when Alice wants to receive money from Carol, will |
@RandomRun Bob would be sent an address composed of 3 different EC points, as defined in my comment #7 (comment) Including an extra EC point is not conceptually different from including a payment id with a wallet address (although of course those things would be implemented with different address formats) |
I think there might be some confusion because I did make multiple edits to #7 (comment) which you may have missed prior to replying |
Just in case it's not clear, i'll restate the whole thing: Alice rolls a random number a, which is shared between each subaddress To generate each subaddress, Alice rolls two further random numbers Bob would compute Note that Alice's computation of The slightly confusing bit is to note I've defined |
Here's my interpretation of @RandomRun's original idea: assumptions/characteristics
generating a sub-addressBob's
Note that
To handle his main address in a unified way, Bob also registers
sending to a sub-addressWhen constructing a transaction, Alice first chooses a random scalar
She then computes an output pubkey to Bob:
She finally computes an output pubkey to herself as her change:
Alice can prove her payment to Bob by using receiving by a sub-addressBob checks if an output pubkey
and looking for
Therefore, Bob should be able to find
and obtain the private key of
disposable addressBob can generate a one-time disposable address associated with one of his sub-addresses
Note that
Bob can also generate one-time disposable addresses associated with his main address
sending to a disposable addressAlice's procedure is exactly the same as above: she first generates a tx pubkey:
and then generates an output pubkey
Importantly, she finally attaches the payment ID receiving by a disposable addressWhen Bob processes a new transaction, he first computes
and looks for
and looks for
and
Bob can obtain the private key of
Edit: |
@knaccc: I think I just found my blunder, but it may actually fix thiings: the view key is not |
@RandomRun You were right that the view key for an individual subaddress was |
@knaccc: Thanks! View key: If you were given only |
@RandomRun You can't do it if you're only given one view key. But if you have been given 2 view keys as an auditor, you might be able to find the common factor The issue I'm highlighting isn't that you can tell (P, R) belongs to Alice, as far as I know, but it's that |
The way I suggested, the sender can keep track of each value Edit: I see now that the transactions key, in the usual sense, allows the sender to provide evidence of authoring a transaction without revealing any information about the recipient's address. In this new setup, the sender could still show evidence of authoring the output Edit: Please see my first comment, as it contained an error and has been edited. |
@knaccc: Please see my first comment, it contains a mistake which I have edited. The correct view key pair doesn't contain the product |
@knaccc: |
@RandomRun I think I might have gotten myself into a muddle because lots of the workings I have been using may have been using the original |
@kenshi84 So you're saying that a subaddress The view key per subaddress in @kenshi84's notation is |
Yes, I think it is pretty much all there. [I was a bit thrown off by the notation, so this is just one suggestion, if I may: can we flip the address notation, like
The way I understand it, currently each transaction contains only one key If the sender tries to use the same value to create both one-time addresses for the recipient and for the change, then this has a couple of disadvantages. (i) As you noted, only those two people can be part of the transaction; [ Having a different In fact, considering that we usually assume that one transaction has a single author, represented by their knowledge of Sub-addresses: From what I understood, addresses would be now of the form: Disposable addresses: This is just sub-addresses with |
By the way, instead of So now if we consider, for instance, a Bitcoin HD wallet scheme (like BIP0032/BIP0044, I believe), and |
@RandomRun You've written it as @kenshi84 wrote it as: So for clarity on two contiguous lines: @kenshi84 just needs to define in his document We'd better pick a preference for the order or it'll get very confusing. I personally prefer that |
fwd{ack} |
I have considered this approach and consulted privately with @luigi1111 but the conclusion was that the computational cost due to additional key derivation processes for per-output tx pubkeys would be unacceptably high.
The point of my proposal is to achieve sub-addresses while still being able to scan outputs in new transactions using the same key derivation
No. Disposable address is different from sub-address, actually it builds on top of sub-address. It derives additional random pubkey |
Apologies in advance for asking so many questions at once. I am just trying to understand things!
Since a tipical transaction is expected to have, for the most part, only two outputs, I guess that would about double the scanning cost, or are there more complications to it?
What is the plan in that case, use subaddresses in transactions that only involve Alice and Bob, and keep the usual static address scheme working for other transactions? [Edit: I see you answered yes to that here.] I wonder how many people will stick with static addresses when subaddresses comes out.
Storing two secrets
I still don't see this. I mean, if you go by your description of how to generate them, it seems like it is just copy and paste, replace The exception being the generation of
but I am not quite sure I get why it is defined like that. What would be the problem the problem of using
I like your optimism estimating the number of addresses a user will need! :) Although I guess one use case could be an exchange. When you say it doesn't allow reuse, you mean that it is not good practice to reuse them, and that, unfortunatelly, depends on the sender, right? |
Doubling the scanning cost is already way more than unacceptable. In addition, it'll be more than double since some transactions are multi-destination transfers, e.g. transfer to 4 or 5 recipients. This is most common for pool payouts which is not the majority of all transactions. Imposing such an immense additional cost to all users merely to enable multi-destination transfer with subaddresses, would be inappropriate.
Subaddresses in the current implementation is fully usable for the most common use case which is payment to a single recipient. Less common multi-recipient transfers can be just done using standard addresses. After hard thinking and private discussion with @luigi1111, I came to a conclusion that there doesn't seem to be any workable way of achieving sub-addresses capable of multi-recipient transfer without increased scanning cost. My proposed scheme provides clear improvements over Monero's privacy feature at practically zero cost, so I don't see any reason not to use it (after thorough reviewing and testing, of course).
I don't understand what you're trying to say. Watch-only wallet
I'm a bit puzzled that this simple idea doesn't get understood by you so easily while it did for other people like @knaccc and @JollyMort. I hope this Reddit post of mine helps: https://www.reddit.com/r/Monero/comments/5vgjs2/subaddresses_and_disposable_addresses/de28cd1/
|
Implemented :) |
converted to use x25519 bouncycastle impl
Ok, so I'm moving this here to keep the monero-project/monero#1345 clutter-free.
@fluffypony @kenshi84 @knaccc @luigi1111
Todo:
n
derivationChangelog:
2017-02-07: Initial: http://termbin.com/vdam, http://termbin.com/0a3o, http://termbin.com/n58g - knaccc
2017-02-07: Changed notation and supporting normal addresses as well: https://paste.fedoraproject.org/550729/50082614/ - all :)
2017-02-07: Multi-address support: https://paste.fedoraproject.org/550761/06389148/ - Luigi/JM
2017-02-08: More tweaks and improvement of readability: https://paste.fedoraproject.org/550825/65211341/ - Kenshi
2017-02-08: More tweaks, formatted and copied from monero-project/monero#1345 (comment) - Luigi/JM
2017-02-09: Apparently this is broken, because knowing C and n, it's trivial to find A
2017-02-17: See discussion below...
Initial discussion: https://paste.fedoraproject.org/551203/78349148/
Monero Sub-addresses
Brief
Currently, each Monero wallet generates one set of keys and one public address which is given out to receive payments. However, a user may want to give out a dedicated address to each sender for dual purpose: to know which payment came from which sender and to avoid privacy loss via off-chain linking of the one address. To accomplish both goals, we propose a way to create multiple addresses which maintains reasonable performance of scanning the blockchain for outputs sent to any of the addresses created, all accessible from within the same wallet.
Sub-addresses creation
A recipient's root wallet address is defined as a pair of public view and spend keys (A,B) = (a*G,b*G), where a and b are the secret view and spend keys. The recipient creates a sub-address by choosing an arbitrary scalar n and defining a triplet (C,D,n). The choice of scalar n could be deterministic, as proposed below:
where
Such a sub-address (C,D,n) gets passed to the sender. Note that the sender can't determine its root address (A,B). The sender can, if necessary, transfer to more than one such sub-addresses (C_i,D_i,n_i), i=1,...,w (either to the same recipient or to different recipients) in a single
transaction.
Transaction Construction
When constructing a transaction, the sender generates the transaction key R=r*G in a particular
manner: he rolls a random scalar s, and computes r as
Then, an output public key P for any standard destination address (A,B) is created as usual:
In contrast, an output public key P_i for the i-th sub-address (C_i, D_i, n_i) is created as:
Since C_i = n_i * A_i (while A_i is not known to the sender), the trick is in the following property:
Therefore, the output public key P_i is effectively equivalent to:
even though the sender doesn't know (A_i,B_i).
Scanning for Incoming Transfers
When a recipient checks for incoming transfers, he first performs the standard key derivation
procedure to check if a given output key P matches to:
If this test fails, he then goes through all previously created sub-addresses (C,D,n) and
checks if P matches to:
Similar to the aggregated addresses approach [1], this search can be done in a constant time
using a hash table: instead of computing Q' directly, the recipient computes
and looks for (B + M)' in the hash table. If such an (B + M)' is found, the output key P belongs to the recipient and its private key x can be recovered as:
Wallet Recovery
From a known set of private keys (a,b), and with assumed number of previously used sub-addresses q>=p, the wallet must first reconstruct all the sub-address information:
where
Then, it performs the full scan, as described in the previous section.
To make it stateless, wallet software could limit the range of p, and have q=p=10000, or any other arbitrary number.
Notes
The root address should never be made public because in that case, anyone could check whether any 2 sub-addresses belong to the same root address.
Credits
knaccc for the initial idea, Luigi for guidance and solution for multiple addresses, and kenshi84 for opening the topic in the first place and final touches.
References
[1] https://bytecoin.org/static/files/docs/aggregate-addresses.pdf
The text was updated successfully, but these errors were encountered: