-
Notifications
You must be signed in to change notification settings - Fork 2k
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
z_sendmany multiple output to the same address #2955
Comments
It looks to me this change is very simple, simply remove the duplicity check in z_sendmany. As far as I tested, it works just fine. But I'm not sure if there are any consequences. |
I made few shielded transactions back and forth (on my private test network) and it works fine, coins can be spent and received without any issue. This is the patch I've used:
|
@Tomas-M @daira this change is interesting to me from the point of view of Hushlist protocol, which attempts to support any size message and must break things into smaller memo chunks. In any case, this change would still only allow messages of size 54*512, do you foresee needing memos larger than that @Tomas-M ? |
I personaly don't need more than say 20. While you mention 54*512, where does this limit come from? I thought we're limited by total transaction size, which appears to be like 100KB, but 54*512 is around 27KB only. |
We probably won't change this for now even though it's an interesting proposal. Deduplication was added for efficiency reasons and might be fine especially for Sapling. We'll need to discuss this internally. |
@Tomas-M Hushlist protocol will support large on-chain "memos" which are actually stored in different tx's and stitched together, that part of the protocol is not yet in the whitepaper: I would love to talk more to see if HushList protocol can help VOT |
I have been experimenting with this on the Hush chain, here is a transaction with 54 duplicate zaddr receivers which encodes a 27KB PNG of the Hush logo: https://explorer.myhush.org/tx/b2375b5ebbefffad6c0cdda7a2b1ee9ac2e0f206e37ebd2186c426bd65c024b7 One issue did arise that I wanted to ask @daira about: It seems that output order is not preserved inside a transaction, in a specific way, i.e. the first 2 outputs swapped their order. My first memo contained the magic bytes for a PNG header but for some reason it's order was swapped with the next output, but all the remaining outputs/memos stayed in the correct order. I have a hunch this could be related to giving the taddr change or internal JoinSplit magic that I don't fully understand. My question is: Does Zcash intend to preserve the order of outputs, i.e. from a z_sendmany and z_listreceivedbyaddress ? Is the above behavior a bug, or the intended behavior, or undefined behavior? It would be useful to specific in the docs. I understand that Zcash does not allow duplicate receivers, but this issue still seems relevant to clarify for 3rd party developers. Thanks. |
Input and output orders are intentionally randomized, to help mitigate potential information leaks. See #778, #1561, #1790, and #1814. |
@leto: what I did for my purposes is to use first data byte of the memo as index, and then sort the memos in the transaction by it (simple by the hex value, sorting two-byte string like 00 01 02 03 04 is easy for my purposes) |
A couple of days ago, Aditya (Zecwallet developer) also asked for this change. Note that this restriction is not enforced by the consensus rules (you can create a raw transaction with multiple outputs to the same address). This check originally comes from Bitcoin Core, 2011. I can't find any documentation on why this restriction exists; my guess is to prevent copy-and-paste errors when the user intends to send to several different outputs. There's probably little to no downside to removing this restriction. |
This change would also be helpful for an application that I am working on.
@LarryRuane I think that your intuition is correct. See: Bitcoin did not accept this pull request because doing so would have run afoul of the JSON-RPC standard, but that objection does not apply to z_sendmany. (Unlike Zcash's z_sendmany, in Bitcoin's sendmany there is a JSON object containing address-amount key-value pairs, so allowing duplicate addresses would lead to duplicate keys.) |
I think we should just add a flag to |
Zcash currently has memo field limited to 512 bytes.
To owercome that limit, I was thinking to send the desired amount divided in multiple outputs, so I could push through longer memo (split into 512 byte chunks)
In order to simplify combining the memos later, I was thinking the best way could be to send all in a single transaction. But when I use a single z_sendmany call to send multiple amounts to a single output address, it does not work. Error message is
Invalid parameter, duplicated address: ...
Here is what I am trying to do (let me split it into multiple lines and write the memos in plaintex, for better readability):
Currently zcash does not allow this. If zcash allowed this, the receiver could very easily combine the memos to create a final memo longer than 512 bytes, while all would be under a SINGLE TRANSACTION ID, which would extremely simplify things.
Please consider allowing duplicite output address in z_sendmany.
Do you have any suggestion how to perhaps achieve similar thing? I know that if I just make multiple transactions, it will send it properly, but then each transaction will have different ID so it will not be obvious which memo part belongs to which other trasnaction.
Thank you
The text was updated successfully, but these errors were encountered: