Skip to main content

zcash_client_backend/proto/
compact_formats.rs

1// This file is @generated by prost-build.
2/// Information about the state of the chain as of a given block.
3#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
4pub struct ChainMetadata {
5    /// the size of the Sapling note commitment tree as of the end of this block
6    #[prost(uint32, tag = "1")]
7    pub sapling_commitment_tree_size: u32,
8    /// the size of the Orchard note commitment tree as of the end of this block
9    #[prost(uint32, tag = "2")]
10    pub orchard_commitment_tree_size: u32,
11    /// the size of the Ironwood note commitment tree as of the end of this block
12    #[prost(uint32, tag = "3")]
13    pub ironwood_commitment_tree_size: u32,
14}
15/// A compact representation of a Zcash block.
16///
17/// CompactBlock is a packaging of ONLY the data from a block that's needed to:
18///    1. Detect a payment to your Shielded address
19///    2. Detect a spend of your Shielded notes
20///    3. Update your witnesses to generate new spend proofs.
21///    4. Spend UTXOs associated to t-addresses of your wallet.
22///
23/// Currently, the `header` field should always be unset (empty). In the future,
24/// the presence or absence of header data may be made dependent on request
25/// parameters, although it is likely that such flexibility will only be provided via
26/// newly-added service methods, not via existing APIs.
27#[derive(Clone, PartialEq, ::prost::Message)]
28pub struct CompactBlock {
29    /// the height of this block
30    #[prost(uint64, tag = "2")]
31    pub height: u64,
32    /// if present, the ID (hash) of this block
33    #[prost(bytes = "vec", tag = "3")]
34    pub hash: ::prost::alloc::vec::Vec<u8>,
35    /// if present, the ID (hash) of this block's predecessor
36    #[prost(bytes = "vec", tag = "4")]
37    pub prev_hash: ::prost::alloc::vec::Vec<u8>,
38    /// if non-zero, Unix epoch time when the block was mined
39    #[prost(uint32, tag = "5")]
40    pub time: u32,
41    /// if present, full header (as returned by the getblock RPC)
42    #[prost(bytes = "vec", tag = "6")]
43    pub header: ::prost::alloc::vec::Vec<u8>,
44    /// zero or more compact transactions from this block
45    #[prost(message, repeated, tag = "7")]
46    pub vtx: ::prost::alloc::vec::Vec<CompactTx>,
47    /// information about the state of the chain as of this block
48    #[prost(message, optional, tag = "8")]
49    pub chain_metadata: ::core::option::Option<ChainMetadata>,
50}
51/// A compact representation of a Zcash transaction.
52///
53/// CompactTx contains the minimum information for a wallet to know if this transaction
54/// is relevant to it (either pays to it or spends from it) via shielded elements. Additionally,
55/// it can optionally include the minimum necessary data to detect payments to transparent addresses
56/// related to your wallet.
57#[derive(Clone, PartialEq, ::prost::Message)]
58pub struct CompactTx {
59    /// The index of the transaction within the block.
60    #[prost(uint64, tag = "1")]
61    pub index: u64,
62    /// The id of the transaction as defined in
63    /// [§ 7.1.1 ‘Transaction Identifiers’](<https://zips.z.cash/protocol/protocol.pdf#txnidentifiers>)
64    /// This byte array MUST be in protocol order and MUST NOT be reversed
65    /// or hex-encoded; the byte-reversed and hex-encoded representation is
66    /// exclusively a textual representation of a txid.
67    #[prost(bytes = "vec", tag = "2")]
68    pub txid: ::prost::alloc::vec::Vec<u8>,
69    /// The transaction fee: present if server can provide. In the case of a
70    /// stateless server and a transaction with transparent inputs, this will be
71    /// unset because the calculation requires reference to prior transactions.
72    /// If there are no transparent inputs, the fee will be calculable as:
73    ///     valueBalanceSapling + valueBalanceOrchard + valueBalanceIronwood
74    ///     + sum(vPubNew) - sum(vPubOld) - sum(tOut)
75    #[prost(uint32, tag = "3")]
76    pub fee: u32,
77    #[prost(message, repeated, tag = "4")]
78    pub spends: ::prost::alloc::vec::Vec<CompactSaplingSpend>,
79    #[prost(message, repeated, tag = "5")]
80    pub outputs: ::prost::alloc::vec::Vec<CompactSaplingOutput>,
81    #[prost(message, repeated, tag = "6")]
82    pub actions: ::prost::alloc::vec::Vec<CompactOrchardAction>,
83    #[prost(message, repeated, tag = "9")]
84    pub ironwood_actions: ::prost::alloc::vec::Vec<CompactOrchardAction>,
85    /// `CompactTxIn` values corresponding to the `vin` entries of the full transaction.
86    ///
87    /// Note: the single null-outpoint input for coinbase transactions is omitted. Light
88    /// clients can test `CompactTx.index == 0` to determine whether a `CompactTx`
89    /// represents a coinbase transaction, as the coinbase transaction is always the
90    /// first transaction in any block.
91    #[prost(message, repeated, tag = "7")]
92    pub vin: ::prost::alloc::vec::Vec<CompactTxIn>,
93    /// A sequence of transparent outputs being created by the transaction.
94    #[prost(message, repeated, tag = "8")]
95    pub vout: ::prost::alloc::vec::Vec<TxOut>,
96}
97/// A compact representation of a transparent transaction input.
98#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
99pub struct CompactTxIn {
100    /// The id of the transaction that generated the output being spent. This
101    /// byte array must be in protocol order and MUST NOT be reversed or
102    /// hex-encoded.
103    #[prost(bytes = "vec", tag = "1")]
104    pub prevout_txid: ::prost::alloc::vec::Vec<u8>,
105    /// The index of the output being spent in the `vout` array of the
106    /// transaction referred to by `prevoutTxid`.
107    #[prost(uint32, tag = "2")]
108    pub prevout_index: u32,
109}
110/// A transparent output being created by the transaction.
111///
112/// This contains identical data to the `TxOut` type in the transaction itself, and
113/// thus it is not "compact".
114#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
115pub struct TxOut {
116    /// The value of the output, in Zatoshis.
117    #[prost(uint64, tag = "1")]
118    pub value: u64,
119    /// The script pubkey that must be satisfied in order to spend this output.
120    #[prost(bytes = "vec", tag = "2")]
121    pub script_pub_key: ::prost::alloc::vec::Vec<u8>,
122}
123/// A compact representation of a [Sapling Spend](<https://zips.z.cash/protocol/protocol.pdf#spendencodingandconsensus>).
124///
125/// CompactSaplingSpend is a Sapling Spend Description as described in 7.3 of the Zcash
126/// protocol specification.
127#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
128pub struct CompactSaplingSpend {
129    /// Nullifier (see the Zcash protocol specification)
130    #[prost(bytes = "vec", tag = "1")]
131    pub nf: ::prost::alloc::vec::Vec<u8>,
132}
133/// A compact representation of a [Sapling Output](<https://zips.z.cash/protocol/protocol.pdf#outputencodingandconsensus>).
134///
135/// It encodes the `cmu` field, `ephemeralKey` field, and a 52-byte prefix of the
136/// `encCiphertext` field of a Sapling Output Description. Total size is 116 bytes.
137#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
138pub struct CompactSaplingOutput {
139    /// Note commitment u-coordinate.
140    #[prost(bytes = "vec", tag = "1")]
141    pub cmu: ::prost::alloc::vec::Vec<u8>,
142    /// Ephemeral public key.
143    #[prost(bytes = "vec", tag = "2")]
144    pub ephemeral_key: ::prost::alloc::vec::Vec<u8>,
145    /// First 52 bytes of ciphertext.
146    #[prost(bytes = "vec", tag = "3")]
147    pub ciphertext: ::prost::alloc::vec::Vec<u8>,
148}
149/// A compact representation of an [Orchard Action](<https://zips.z.cash/protocol/protocol.pdf#actionencodingandconsensus>).
150#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
151pub struct CompactOrchardAction {
152    /// \[32\] The nullifier of the input note
153    #[prost(bytes = "vec", tag = "1")]
154    pub nullifier: ::prost::alloc::vec::Vec<u8>,
155    /// \[32\] The x-coordinate of the note commitment for the output note
156    #[prost(bytes = "vec", tag = "2")]
157    pub cmx: ::prost::alloc::vec::Vec<u8>,
158    /// \[32\] An encoding of an ephemeral Pallas public key
159    #[prost(bytes = "vec", tag = "3")]
160    pub ephemeral_key: ::prost::alloc::vec::Vec<u8>,
161    /// \[52\] The first 52 bytes of the encCiphertext field
162    #[prost(bytes = "vec", tag = "4")]
163    pub ciphertext: ::prost::alloc::vec::Vec<u8>,
164}