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

Document consensus rules from Zcash spec 7.1.2: Coinbase transactions #3427

Closed
11 tasks
Tracked by #3125 ...
mpguerra opened this issue Jan 27, 2022 · 0 comments · Fixed by #3464
Closed
11 tasks
Tracked by #3125 ...

Document consensus rules from Zcash spec 7.1.2: Coinbase transactions #3427

mpguerra opened this issue Jan 27, 2022 · 0 comments · Fixed by #3464
Assignees

Comments

@mpguerra
Copy link
Contributor

mpguerra commented Jan 27, 2022

  • A transaction with one or more transparent inputs from coinbase transactions MUST have no transparent outputs (i.e. tx_out_count MUST be 0). Inputs from coinbase transactions include Founders’ Reward outputs and funding stream outputs.
  • The total value in zatoshi of transparent outputs from a coinbase transaction, minus vbalanceSapling, minus vbalanceOrchard, MUST NOT be greater than the value in zatoshi of block subsidy plus the transaction fees paid by transactions in this block.
  • A coinbase transaction MUST NOT have any transparent inputs with non-null prevout fields, JoinSplit descriptions, or Spend descriptions.
  • [Pre-Heartwood] A coinbase transaction also MUST NOT have any Output descriptions.
  • [NU5 onward] In a version 5 coinbase transaction, the enableSpendsOrchard flag MUST be 0.
  • A coinbase transaction for a block at block height greater than 0 MUST have a script that, as its first item, encodes the block height height as follows. For height in the range {1..16}, the encoding is a single byte of value 0x50 height. Otherwise, let heightBytes be the signed little-endian representation of height, using the minimum nonzero number of bytes such that the most significant byte is < 0x80. The length of heightBytes MUST be in the range {1..5}. Then the encoding is the length of heightBytes encoded as one byte, followed by heightBytes itself. This matches the encoding used by Bitcoin in the implementation of [BIP-34] (but the description here is to be considered normative).
  • A transaction MUST NOT spend a transparent output of a coinbase transaction from a block less than 100 blocks prior to the spend. Note that transparent outputs of coinbase transactions include Founders’ Reward outputs and transparent funding stream outputs.
  • A transaction MUST NOT spend an output of the genesis block coinbase transaction. (There is one such zero-valued output, on each of Testnet and Mainnet.)
  • [NU5 onward] The nExpiryHeight field of a coinbase transaction MUST be equal to its block height.
  • [Heartwood onward] All Sapling and Orchard outputs in coinbase transactions MUST decrypt to a note plaintext, i.e. the procedure in § 4.19.3 ‘Decryption using a Full Viewing Key (Sapling and Orchard)’ on p. 66 does not return ⊥, using a sequence of 32 zero bytes as the outgoing viewing key. (This implies that before Canopy activation, Sapling outputs of a coinbase transaction MUST have note plaintext lead byte equal to 0x01.)
  • [Canopy onward] Any Sapling or Orchard output of a coinbase transaction decrypted to a note plaintext according to the preceding rule MUST have note plaintext lead byte equal to 0x02. (This applies even during the “grace period” specified in [ZIP-212].)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants