Skip to content
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

[ZIP-230] v6 transactions, including ZSAs #687

Closed
wants to merge 9 commits into from
Closed

[ZIP-230] v6 transactions, including ZSAs #687

wants to merge 9 commits into from

Conversation

dconnolly
Copy link
Contributor

@dconnolly dconnolly commented Apr 18, 2023

fixes #686

@dconnolly dconnolly changed the title Start stub of v6 transaction ZIP, to include ZSA changes [ZIP-XXXX] v6 transactions, to include ZSA changes Apr 18, 2023
@dconnolly dconnolly changed the title [ZIP-XXXX] v6 transactions, to include ZSA changes [ZIP-XXXX] v6 transactions, including ZSAs Apr 18, 2023
+-----------------------------+--------------------------+----------------------------------------+---------------------------------------------------------------------+
|``varies`` |``nSpendsSapling`` |``compactSize`` |Number of Sapling Spend descriptions in ``vSpendsSapling``. |
+-----------------------------+--------------------------+----------------------------------------+---------------------------------------------------------------------+
|``96 * nSpendsSapling`` |``vSpendsSapling`` |``SpendDescriptionV6[nSpendsSapling]`` |A sequence of Sapling Spend descriptions, encoded per |
Copy link
Collaborator

@daira daira Apr 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
|``96 * nSpendsSapling`` |``vSpendsSapling`` |``SpendDescriptionV6[nSpendsSapling]`` |A sequence of Sapling Spend descriptions, encoded per |
|``96 * nSpendsSapling`` |``vSpendsSapling`` |``SpendDescriptionV5[nSpendsSapling]`` |A sequence of Sapling Spend descriptions, encoded per |

There's no reason for this to be different from v5. We can add a note explaining that.

+-----------------------------+--------------------------+----------------------------------------+---------------------------------------------------------------------+
|``varies`` |``nOutputsSapling`` |``compactSize`` |Number of Sapling Output Decriptions in ``vOutputsSapling``. |
+-----------------------------+--------------------------+----------------------------------------+---------------------------------------------------------------------+
|``756 * nOutputsSapling`` |``vOutputsSapling`` |``OutputDescriptionV6[nOutputsSapling]``|A sequence of Sapling Output descriptions, encoded per |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
|``756 * nOutputsSapling`` |``vOutputsSapling`` |``OutputDescriptionV6[nOutputsSapling]``|A sequence of Sapling Output descriptions, encoded per |
|``756 * nOutputsSapling`` |``vOutputsSapling`` |``OutputDescriptionV5[nOutputsSapling]``|A sequence of Sapling Output descriptions, encoded per |

dconnolly and others added 3 commits April 18, 2023 23:08
Co-authored-by: Daira Hopwood <[email protected]>
Co-authored-by: Daira Hopwood <[email protected]>
Co-authored-by: Daira Hopwood <[email protected]>
+-----------------------------+--------------------------+--------------------------------------+------------------------------------------------------------+
|``32`` |``ephemeralKey`` |``byte[32]`` |An encoding of an ephemeral Jubjub public key. |
+-----------------------------+--------------------------+--------------------------------------+------------------------------------------------------------+
|``580`` |``encCiphertext`` |``byte[580]`` |The encrypted contents of the note plaintext. |
Copy link
Contributor

@nuttycom nuttycom Apr 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something that I wanted to get in for v5 transactions, but that we didn't do because we were already pushing the complexity budget, is decouple memos from outputs. The idea here is that the action would, instead of a memo in the encCiphertext, include a 32-byte key. The transaction would then, at the top level, contain a field that is a length-prefixed array of 512-byte memo ciphertexts. This would allow multiple memos to be decryptable by a single recipient, or a single memo to be decrypted by multiple recipients without increasing the size of the transaction, or any combination in between. Decoupling the memos from the outputs could open up new use cases for including longer message, and could also in common cases limit chain growth by eliminating the need to add an additional 512-byte payload for each recipient; the "standard" would likely be to include a single memo per transaction. At present, if a user wants to send more than a single 512-byte payload to their counterparty, they are compelled to bloat the chain with extra actions; segregating the memos eliminates this source of chain growth.

If we did decouple the memos in this fashion, we'd probably want to modify ZIP 317 to add a per-memo fee amount (potentially decreasing the marginal fee per action at the same time).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, I'd meant to put this comment into the Orchard section, but I suppose that it could apply to Sapling as well.

zip-xxxx.rst Outdated
@@ -0,0 +1,290 @@
::

ZIP: XXXX
Copy link
Contributor Author

@dconnolly dconnolly Apr 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ZIP number reserved: 230

@dconnolly dconnolly changed the title [ZIP-XXXX] v6 transactions, including ZSAs [ZIP-240] v6 transactions, including ZSAs Apr 26, 2023
@dconnolly dconnolly changed the title [ZIP-240] v6 transactions, including ZSAs [ZIP-XXXX] v6 transactions, including ZSAs Apr 26, 2023
@dconnolly dconnolly changed the title [ZIP-XXXX] v6 transactions, including ZSAs [ZIP-230] v6 transactions, including ZSAs Apr 26, 2023
+-----------------------------+--------------------------+----------------------------------------+---------------------------------------------------------------------+
|``4`` |``lock_time`` |``uint32`` |Unix-epoch UTC time or block height, encoded as in Bitcoin. |
+-----------------------------+--------------------------+----------------------------------------+---------------------------------------------------------------------+
|``4`` |``nExpiryHeight`` |``uint32`` |A block height in the range {1 .. 499999999} after which |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to specify coinbase transaction heights here, or is it ok to leave it in the detailed rules?

| | | |the transaction will expire, or 0 to disable expiry. |
| | | |[ZIP-203] |
+-----------------------------+--------------------------+----------------------------------------+---------------------------------------------------------------------+
|``8`` |``fee`` |``int64`` |The fee to be paid by this transaction, in zatoshis. |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
|``8`` |``fee`` |``int64`` |The fee to be paid by this transaction, in zatoshis. |
|``8`` |``fee`` |``int64`` |The non-negative fee to be paid by this transaction, in zatoshis. |

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or are negative values allowed in coinbase transactions?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Teor's comment refers to a brainwave I had during the ZIP sync today, which is that a negative fee in a coinbase transaction could represent the fees collected from other transactions in the block. This would be more regular, because:

  • every transaction would balance exactly;
  • the sum of fee fields in each block would be zero.

| | | |the transaction will expire, or 0 to disable expiry. |
| | | |[ZIP-203] |
+-----------------------------+--------------------------+----------------------------------------+---------------------------------------------------------------------+
|``8`` |``fee`` |``int64`` |The fee to be paid by this transaction, in zatoshis. |
Copy link
Contributor

@teor2345 teor2345 Apr 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth making the fees and value balances a CompactSize to save 15+ bytes per transaction?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no strong opinion about this, but a possible argument for doing so is that if we increase the range of amounts in order to accommodate ZSA bridges with other coins that have a larger range, then using CompactSizes would help to mitigate the cost of that (when the full range is not actually used, or for ZEC).

dconnolly and others added 2 commits April 26, 2023 17:39
@nuttycom
Copy link
Contributor

A note from zip sync: we should start thinking about setting a horizon for recovery of notes and memos from the chain via trial decryption. 10 years maybe?

| | | |the transaction will expire, or 0 to disable expiry. |
| | | |[ZIP-203] |
+-----------------------------+--------------------------+----------------------------------------+---------------------------------------------------------------------+
|``8`` |``fee`` |``int64`` |The fee to be paid by this transaction, in zatoshis. |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: add a burn_value field (values treated as burned may eventually be contributed to the sustainability fund) and then add a consensus rule that all transactions are required to fully balance.

@tomekpiotrowski
Copy link
Contributor

I've pushed #745 to add zsf_deposit field to this PR.

@daira daira added the ZSAs label Jul 23, 2024
@nuttycom nuttycom added F-transaction-v6 Feature: v6 transactions NU7 proposal labels Nov 1, 2024
@nuttycom
Copy link
Contributor

nuttycom commented Nov 1, 2024

This was subsumed by (and appears to have been copied into) #778

@nuttycom nuttycom closed this Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ZIP 230] Transaction V6
5 participants