57 lines
2.7 KiB
Protocol Buffer
57 lines
2.7 KiB
Protocol Buffer
// Copyright (c) 2019-2020 The Zcash developers
|
|
// Distributed under the MIT software license, see the accompanying
|
|
// file COPYING or https://www.opensource.org/licenses/mit-license.php .
|
|
|
|
syntax = "proto3";
|
|
package cash.z.wallet.sdk.rpc;
|
|
option go_package = "walletrpc";
|
|
option swift_prefix = "";
|
|
// Remember that proto3 fields are all optional. A field that is not present will be set to its zero value.
|
|
// bytes fields of hashes are in canonical little-endian format.
|
|
|
|
// CompactBlock is a packaging of ONLY the data from a block that's needed to:
|
|
// 1. Detect a payment to your shielded Sapling address
|
|
// 2. Detect a spend of your shielded Sapling notes
|
|
// 3. Update your witnesses to generate new Sapling spend proofs.
|
|
message CompactBlock {
|
|
uint32 protoVersion = 1; // the version of this wire format, for storage
|
|
uint64 height = 2; // the height of this block
|
|
bytes hash = 3; // the ID (hash) of this block, same as in block explorers
|
|
bytes prevHash = 4; // the ID (hash) of this block's predecessor
|
|
uint32 time = 5; // Unix epoch time when the block was mined
|
|
bytes header = 6; // (hash, prevHash, and time) OR (full header)
|
|
repeated CompactTx vtx = 7; // zero or more compact transactions from this block
|
|
}
|
|
|
|
// CompactTx contains the minimum information for a wallet to know if this transaction
|
|
// is relevant to it (either pays to it or spends from it) via shielded elements
|
|
// only. This message will not encode a transparent-to-transparent transaction.
|
|
message CompactTx {
|
|
uint64 index = 1; // the index within the full block
|
|
bytes hash = 2; // the ID (hash) of this transaction, same as in block explorers
|
|
|
|
// The transaction fee: present if server can provide. In the case of a
|
|
// stateless server and a transaction with transparent inputs, this will be
|
|
// unset because the calculation requires reference to prior transactions.
|
|
// in a pure-Sapling context, the fee will be calculable as:
|
|
// valueBalance + (sum(vPubNew) - sum(vPubOld) - sum(tOut))
|
|
uint32 fee = 3;
|
|
|
|
repeated CompactSpend spends = 4; // inputs
|
|
repeated CompactOutput outputs = 5; // outputs
|
|
}
|
|
|
|
// CompactSpend is a Sapling Spend Description as described in 7.3 of the Zcash
|
|
// protocol specification.
|
|
message CompactSpend {
|
|
bytes nf = 1; // nullifier (see the Zcash protocol specification)
|
|
}
|
|
|
|
// output is a Sapling Output Description as described in section 7.4 of the
|
|
// Zcash protocol spec. Total size is 948.
|
|
message CompactOutput {
|
|
bytes cmu = 1; // note commitment u-coordinate
|
|
bytes epk = 2; // ephemeral public key
|
|
bytes ciphertext = 3; // ciphertext and zkproof
|
|
}
|