zync-core 0.6.0

Trust-minimized Zcash light client primitives: verification, scanning, proving
Documentation
// lightwalletd gRPC service protocol
// https://github.com/zcash/lightwalletd/blob/master/walletrpc/service.proto

syntax = "proto3";
package cash.z.wallet.sdk.rpc;

// CompactTx contains the index and hash of a transaction, along with its compact outputs
message CompactTx {
    uint64 index = 1;
    bytes hash = 2;
    uint32 fee = 3;
    repeated CompactSaplingSpend spends = 4;
    repeated CompactSaplingOutput outputs = 5;
    repeated CompactOrchardAction actions = 6;
}

message CompactSaplingSpend {
    bytes nf = 1;
}

message CompactSaplingOutput {
    bytes cmu = 1;
    bytes ephemeralKey = 2;
    bytes ciphertext = 3;
}

message CompactOrchardAction {
    bytes nullifier = 1;
    bytes cmx = 2;
    bytes ephemeralKey = 3;
    bytes ciphertext = 4;
}

// CompactBlock is a compact representation of a block
message CompactBlock {
    uint32 protoVersion = 1;
    uint64 height = 2;
    bytes hash = 3;
    bytes prevHash = 4;
    uint32 time = 5;
    bytes header = 6;
    repeated CompactTx vtx = 7;
    ChainMetadata chainMetadata = 8;
}

message ChainMetadata {
    uint32 saplingCommitmentTreeSize = 1;
    uint32 orchardCommitmentTreeSize = 2;
}

// Block ID message
message BlockID {
    uint64 height = 1;
    bytes hash = 2;
}

// Block range for queries
message BlockRange {
    BlockID start = 1;
    BlockID end = 2;
}

// Raw transaction for sending
message RawTransaction {
    bytes data = 1;
    uint64 height = 2;
}

// Transaction send response
message SendResponse {
    int32 errorCode = 1;
    string errorMessage = 2;
}

// Get address UTXOs
message GetAddressUtxosArg {
    repeated string addresses = 1;
    uint64 startHeight = 2;
    uint32 maxEntries = 3;
}

message GetAddressUtxosReply {
    string address = 1;
    bytes txid = 2;
    int32 index = 3;
    bytes script = 4;
    int64 valueZat = 5;
    uint64 height = 6;
}

message GetAddressUtxosReplyList {
    repeated GetAddressUtxosReply addressUtxos = 1;
}

// Transparent address block filter
message TransparentAddressBlockFilter {
    string address = 1;
    BlockRange range = 2;
}

// Light wallet info
message LightdInfo {
    string version = 1;
    string vendor = 2;
    bool taddrSupport = 3;
    string chainName = 4;
    uint64 saplingActivationHeight = 5;
    string consensusBranchId = 6;
    uint64 blockHeight = 7;
    string gitCommit = 8;
    string branch = 9;
    string buildDate = 10;
    string buildUser = 11;
    uint64 estimatedHeight = 12;
    string zcashdBuild = 13;
    string zcashdSubversion = 14;
}

// Tree state
message TreeState {
    string network = 1;
    uint64 height = 2;
    string hash = 3;
    uint32 time = 4;
    string saplingTree = 5;
    string orchardTree = 6;
}

// Empty message
message Empty {}

// Lightwalletd service definition
service CompactTxStreamer {
    // Get latest block
    rpc GetLatestBlock(ChainSpec) returns (BlockID);

    // Get block by ID
    rpc GetBlock(BlockID) returns (CompactBlock);

    // Get block range (streaming)
    rpc GetBlockRange(BlockRange) returns (stream CompactBlock);

    // Get transaction by txid
    rpc GetTransaction(TxFilter) returns (RawTransaction);

    // Send raw transaction
    rpc SendTransaction(RawTransaction) returns (SendResponse);

    // Get tree state at height
    rpc GetTreeState(BlockID) returns (TreeState);

    // Get address UTXOs
    rpc GetAddressUtxos(GetAddressUtxosArg) returns (GetAddressUtxosReplyList);

    // Stream address UTXOs
    rpc GetAddressUtxosStream(GetAddressUtxosArg) returns (stream GetAddressUtxosReply);

    // Get lightwalletd info
    rpc GetLightdInfo(Empty) returns (LightdInfo);
}

// Chain specification
message ChainSpec {}

// Transaction filter
message TxFilter {
    BlockID block = 1;
    uint64 index = 2;
    bytes hash = 3;
}