proto: add initial protocol definitions
This commit is contained in:
parent
58e5f3e78b
commit
09cd0300e6
7
go.mod
7
go.mod
|
@ -1,3 +1,8 @@
|
||||||
module github.com/gtank/ctxd
|
module github.com/gtank/ctxd
|
||||||
|
|
||||||
require github.com/pkg/errors v0.8.0
|
require (
|
||||||
|
github.com/golang/protobuf v1.2.0
|
||||||
|
github.com/pkg/errors v0.8.0
|
||||||
|
golang.org/x/net v0.0.0-20180926154720-4dfa2610cdf3 // indirect
|
||||||
|
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f // indirect
|
||||||
|
)
|
||||||
|
|
6
go.sum
6
go.sum
|
@ -1,2 +1,8 @@
|
||||||
|
github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
|
||||||
|
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw=
|
github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw=
|
||||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
|
golang.org/x/net v0.0.0-20180926154720-4dfa2610cdf3 h1:dgd4x4kJt7G4k4m93AYLzM8Ni6h2qLTfh9n9vXJT3/0=
|
||||||
|
golang.org/x/net v0.0.0-20180926154720-4dfa2610cdf3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA=
|
||||||
|
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
|
|
@ -0,0 +1,507 @@
|
||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// source: compact_formats.proto
|
||||||
|
|
||||||
|
package proto
|
||||||
|
|
||||||
|
import proto "github.com/golang/protobuf/proto"
|
||||||
|
import fmt "fmt"
|
||||||
|
import math "math"
|
||||||
|
|
||||||
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
|
var _ = proto.Marshal
|
||||||
|
var _ = fmt.Errorf
|
||||||
|
var _ = math.Inf
|
||||||
|
|
||||||
|
// This is a compile-time assertion to ensure that this generated file
|
||||||
|
// is compatible with the proto package it is being compiled against.
|
||||||
|
// A compilation error at this line likely means your copy of the
|
||||||
|
// proto package needs to be updated.
|
||||||
|
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||||
|
|
||||||
|
// A BlockFilter message contains identifiers to select a block: either a
|
||||||
|
// height or a hash.
|
||||||
|
type BlockFilter struct {
|
||||||
|
BlockHeight uint64 `protobuf:"varint,1,opt,name=blockHeight,proto3" json:"blockHeight,omitempty"`
|
||||||
|
BlockHash []byte `protobuf:"bytes,2,opt,name=blockHash,proto3" json:"blockHash,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *BlockFilter) Reset() { *m = BlockFilter{} }
|
||||||
|
func (m *BlockFilter) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*BlockFilter) ProtoMessage() {}
|
||||||
|
func (*BlockFilter) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_compact_formats_0da157b93a4fa3be, []int{0}
|
||||||
|
}
|
||||||
|
func (m *BlockFilter) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_BlockFilter.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *BlockFilter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_BlockFilter.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *BlockFilter) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_BlockFilter.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *BlockFilter) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_BlockFilter.Size(m)
|
||||||
|
}
|
||||||
|
func (m *BlockFilter) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_BlockFilter.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_BlockFilter proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *BlockFilter) GetBlockHeight() uint64 {
|
||||||
|
if m != nil {
|
||||||
|
return m.BlockHeight
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *BlockFilter) GetBlockHash() []byte {
|
||||||
|
if m != nil {
|
||||||
|
return m.BlockHash
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type RangeFilter struct {
|
||||||
|
Start *BlockFilter `protobuf:"bytes,1,opt,name=start,proto3" json:"start,omitempty"`
|
||||||
|
End *BlockFilter `protobuf:"bytes,2,opt,name=end,proto3" json:"end,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *RangeFilter) Reset() { *m = RangeFilter{} }
|
||||||
|
func (m *RangeFilter) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*RangeFilter) ProtoMessage() {}
|
||||||
|
func (*RangeFilter) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_compact_formats_0da157b93a4fa3be, []int{1}
|
||||||
|
}
|
||||||
|
func (m *RangeFilter) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_RangeFilter.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *RangeFilter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_RangeFilter.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *RangeFilter) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_RangeFilter.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *RangeFilter) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_RangeFilter.Size(m)
|
||||||
|
}
|
||||||
|
func (m *RangeFilter) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_RangeFilter.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_RangeFilter proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *RangeFilter) GetStart() *BlockFilter {
|
||||||
|
if m != nil {
|
||||||
|
return m.Start
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *RangeFilter) GetEnd() *BlockFilter {
|
||||||
|
if m != nil {
|
||||||
|
return m.End
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// A TxFilter contains the information needed to identify a particular
|
||||||
|
// transaction: either a block and an index, or a direct transaction hash.
|
||||||
|
type TxFilter struct {
|
||||||
|
BlockID *BlockFilter `protobuf:"bytes,1,opt,name=blockID,proto3" json:"blockID,omitempty"`
|
||||||
|
TxIndex uint64 `protobuf:"varint,2,opt,name=txIndex,proto3" json:"txIndex,omitempty"`
|
||||||
|
TxHash []byte `protobuf:"bytes,3,opt,name=txHash,proto3" json:"txHash,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *TxFilter) Reset() { *m = TxFilter{} }
|
||||||
|
func (m *TxFilter) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*TxFilter) ProtoMessage() {}
|
||||||
|
func (*TxFilter) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_compact_formats_0da157b93a4fa3be, []int{2}
|
||||||
|
}
|
||||||
|
func (m *TxFilter) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_TxFilter.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *TxFilter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_TxFilter.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *TxFilter) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_TxFilter.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *TxFilter) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_TxFilter.Size(m)
|
||||||
|
}
|
||||||
|
func (m *TxFilter) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_TxFilter.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_TxFilter proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *TxFilter) GetBlockID() *BlockFilter {
|
||||||
|
if m != nil {
|
||||||
|
return m.BlockID
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *TxFilter) GetTxIndex() uint64 {
|
||||||
|
if m != nil {
|
||||||
|
return m.TxIndex
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *TxFilter) GetTxHash() []byte {
|
||||||
|
if m != nil {
|
||||||
|
return m.TxHash
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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.
|
||||||
|
type CompactBlock struct {
|
||||||
|
BlockID *BlockFilter `protobuf:"bytes,1,opt,name=blockID,proto3" json:"blockID,omitempty"`
|
||||||
|
Vtx []*CompactTx `protobuf:"bytes,3,rep,name=vtx,proto3" json:"vtx,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CompactBlock) Reset() { *m = CompactBlock{} }
|
||||||
|
func (m *CompactBlock) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*CompactBlock) ProtoMessage() {}
|
||||||
|
func (*CompactBlock) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_compact_formats_0da157b93a4fa3be, []int{3}
|
||||||
|
}
|
||||||
|
func (m *CompactBlock) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_CompactBlock.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *CompactBlock) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_CompactBlock.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *CompactBlock) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_CompactBlock.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *CompactBlock) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_CompactBlock.Size(m)
|
||||||
|
}
|
||||||
|
func (m *CompactBlock) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_CompactBlock.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_CompactBlock proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *CompactBlock) GetBlockID() *BlockFilter {
|
||||||
|
if m != nil {
|
||||||
|
return m.BlockID
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CompactBlock) GetVtx() []*CompactTx {
|
||||||
|
if m != nil {
|
||||||
|
return m.Vtx
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type CompactTx struct {
|
||||||
|
// Index and hash will allow the receiver to call out to chain
|
||||||
|
// explorers or other data structures to retrieve more information
|
||||||
|
// about this transaction.
|
||||||
|
Index uint64 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"`
|
||||||
|
Hash []byte `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"`
|
||||||
|
Spends []*CompactSpend `protobuf:"bytes,3,rep,name=spends,proto3" json:"spends,omitempty"`
|
||||||
|
Outputs []*CompactOutput `protobuf:"bytes,4,rep,name=outputs,proto3" json:"outputs,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CompactTx) Reset() { *m = CompactTx{} }
|
||||||
|
func (m *CompactTx) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*CompactTx) ProtoMessage() {}
|
||||||
|
func (*CompactTx) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_compact_formats_0da157b93a4fa3be, []int{4}
|
||||||
|
}
|
||||||
|
func (m *CompactTx) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_CompactTx.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *CompactTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_CompactTx.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *CompactTx) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_CompactTx.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *CompactTx) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_CompactTx.Size(m)
|
||||||
|
}
|
||||||
|
func (m *CompactTx) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_CompactTx.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_CompactTx proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *CompactTx) GetIndex() uint64 {
|
||||||
|
if m != nil {
|
||||||
|
return m.Index
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CompactTx) GetHash() []byte {
|
||||||
|
if m != nil {
|
||||||
|
return m.Hash
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CompactTx) GetSpends() []*CompactSpend {
|
||||||
|
if m != nil {
|
||||||
|
return m.Spends
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CompactTx) GetOutputs() []*CompactOutput {
|
||||||
|
if m != nil {
|
||||||
|
return m.Outputs
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type CompactSpend struct {
|
||||||
|
Nf []byte `protobuf:"bytes,1,opt,name=nf,proto3" json:"nf,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CompactSpend) Reset() { *m = CompactSpend{} }
|
||||||
|
func (m *CompactSpend) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*CompactSpend) ProtoMessage() {}
|
||||||
|
func (*CompactSpend) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_compact_formats_0da157b93a4fa3be, []int{5}
|
||||||
|
}
|
||||||
|
func (m *CompactSpend) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_CompactSpend.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *CompactSpend) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_CompactSpend.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *CompactSpend) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_CompactSpend.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *CompactSpend) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_CompactSpend.Size(m)
|
||||||
|
}
|
||||||
|
func (m *CompactSpend) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_CompactSpend.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_CompactSpend proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *CompactSpend) GetNf() []byte {
|
||||||
|
if m != nil {
|
||||||
|
return m.Nf
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type CompactOutput struct {
|
||||||
|
Cmu []byte `protobuf:"bytes,1,opt,name=cmu,proto3" json:"cmu,omitempty"`
|
||||||
|
Epk []byte `protobuf:"bytes,2,opt,name=epk,proto3" json:"epk,omitempty"`
|
||||||
|
Ciphertext []byte `protobuf:"bytes,3,opt,name=ciphertext,proto3" json:"ciphertext,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CompactOutput) Reset() { *m = CompactOutput{} }
|
||||||
|
func (m *CompactOutput) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*CompactOutput) ProtoMessage() {}
|
||||||
|
func (*CompactOutput) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_compact_formats_0da157b93a4fa3be, []int{6}
|
||||||
|
}
|
||||||
|
func (m *CompactOutput) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_CompactOutput.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *CompactOutput) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_CompactOutput.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *CompactOutput) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_CompactOutput.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *CompactOutput) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_CompactOutput.Size(m)
|
||||||
|
}
|
||||||
|
func (m *CompactOutput) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_CompactOutput.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_CompactOutput proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *CompactOutput) GetCmu() []byte {
|
||||||
|
if m != nil {
|
||||||
|
return m.Cmu
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CompactOutput) GetEpk() []byte {
|
||||||
|
if m != nil {
|
||||||
|
return m.Epk
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CompactOutput) GetCiphertext() []byte {
|
||||||
|
if m != nil {
|
||||||
|
return m.Ciphertext
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// An opaque blob of full transaction data, for fetching anything that is not
|
||||||
|
// in the compact format (e.g. the memo field).
|
||||||
|
type FullTransaction struct {
|
||||||
|
TxID *TxFilter `protobuf:"bytes,1,opt,name=txID,proto3" json:"txID,omitempty"`
|
||||||
|
Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *FullTransaction) Reset() { *m = FullTransaction{} }
|
||||||
|
func (m *FullTransaction) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*FullTransaction) ProtoMessage() {}
|
||||||
|
func (*FullTransaction) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_compact_formats_0da157b93a4fa3be, []int{7}
|
||||||
|
}
|
||||||
|
func (m *FullTransaction) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_FullTransaction.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *FullTransaction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_FullTransaction.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *FullTransaction) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_FullTransaction.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *FullTransaction) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_FullTransaction.Size(m)
|
||||||
|
}
|
||||||
|
func (m *FullTransaction) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_FullTransaction.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_FullTransaction proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *FullTransaction) GetTxID() *TxFilter {
|
||||||
|
if m != nil {
|
||||||
|
return m.TxID
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *FullTransaction) GetData() []byte {
|
||||||
|
if m != nil {
|
||||||
|
return m.Data
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Empty placeholder.
|
||||||
|
// Someday we may want to specify e.g. a particular chain fork.
|
||||||
|
type ChainSpec struct {
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *ChainSpec) Reset() { *m = ChainSpec{} }
|
||||||
|
func (m *ChainSpec) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*ChainSpec) ProtoMessage() {}
|
||||||
|
func (*ChainSpec) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_compact_formats_0da157b93a4fa3be, []int{8}
|
||||||
|
}
|
||||||
|
func (m *ChainSpec) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_ChainSpec.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *ChainSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_ChainSpec.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *ChainSpec) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_ChainSpec.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *ChainSpec) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_ChainSpec.Size(m)
|
||||||
|
}
|
||||||
|
func (m *ChainSpec) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_ChainSpec.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_ChainSpec proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proto.RegisterType((*BlockFilter)(nil), "proto.BlockFilter")
|
||||||
|
proto.RegisterType((*RangeFilter)(nil), "proto.RangeFilter")
|
||||||
|
proto.RegisterType((*TxFilter)(nil), "proto.TxFilter")
|
||||||
|
proto.RegisterType((*CompactBlock)(nil), "proto.CompactBlock")
|
||||||
|
proto.RegisterType((*CompactTx)(nil), "proto.CompactTx")
|
||||||
|
proto.RegisterType((*CompactSpend)(nil), "proto.CompactSpend")
|
||||||
|
proto.RegisterType((*CompactOutput)(nil), "proto.CompactOutput")
|
||||||
|
proto.RegisterType((*FullTransaction)(nil), "proto.FullTransaction")
|
||||||
|
proto.RegisterType((*ChainSpec)(nil), "proto.ChainSpec")
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proto.RegisterFile("compact_formats.proto", fileDescriptor_compact_formats_0da157b93a4fa3be)
|
||||||
|
}
|
||||||
|
|
||||||
|
var fileDescriptor_compact_formats_0da157b93a4fa3be = []byte{
|
||||||
|
// 485 bytes of a gzipped FileDescriptorProto
|
||||||
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0x5d, 0x8b, 0xd3, 0x50,
|
||||||
|
0x10, 0x6d, 0x9a, 0xb4, 0xdd, 0x4e, 0xba, 0x1f, 0x8e, 0xeb, 0x12, 0x8a, 0x2c, 0xe5, 0xea, 0x43,
|
||||||
|
0x41, 0x29, 0x52, 0x11, 0x04, 0x7d, 0x72, 0x65, 0xd7, 0x15, 0x45, 0xb8, 0xed, 0xab, 0xe8, 0xdd,
|
||||||
|
0xf4, 0x76, 0x13, 0xb7, 0x4d, 0x42, 0x32, 0x95, 0xfc, 0x0e, 0xff, 0xb0, 0x92, 0xc9, 0x4d, 0x36,
|
||||||
|
0x2d, 0x55, 0xf0, 0x29, 0x33, 0x73, 0xce, 0x9c, 0x99, 0x7b, 0x86, 0xc0, 0x23, 0x3f, 0x5e, 0x27,
|
||||||
|
0xca, 0xa7, 0x6f, 0xcb, 0x38, 0x5d, 0x2b, 0xca, 0x26, 0x49, 0x1a, 0x53, 0x8c, 0x1d, 0xfe, 0x88,
|
||||||
|
0xcf, 0xe0, 0xbe, 0x5b, 0xc5, 0xfe, 0xdd, 0x65, 0xb8, 0x22, 0x9d, 0xe2, 0x08, 0xdc, 0x9b, 0x22,
|
||||||
|
0xfd, 0xa0, 0xc3, 0xdb, 0x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 0xdf, 0xf0, 0xba, 0x4d, 0x73, 0x76, 0xed, 0x18, 0x9e, 0x99, 0xc2, 0x8e,
|
||||||
|
0x8b, 0xa2, 0x75, 0xd3, 0x65, 0xe0, 0xe5, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x28, 0x7b, 0xec,
|
||||||
|
0x5c, 0x07, 0x04, 0x00, 0x00,
|
||||||
|
}
|
|
@ -0,0 +1,74 @@
|
||||||
|
syntax = "proto3";
|
||||||
|
package proto;
|
||||||
|
|
||||||
|
// Remember that proto3 fields are all optional.
|
||||||
|
|
||||||
|
// A BlockFilter message contains identifiers to select a block: either a
|
||||||
|
// height or a hash.
|
||||||
|
message BlockFilter {
|
||||||
|
uint64 blockHeight = 1;
|
||||||
|
bytes blockHash = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message RangeFilter {
|
||||||
|
BlockFilter start = 1;
|
||||||
|
BlockFilter end = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// A TxFilter contains the information needed to identify a particular
|
||||||
|
// transaction: either a block and an index, or a direct transaction hash.
|
||||||
|
message TxFilter {
|
||||||
|
BlockFilter blockID = 1;
|
||||||
|
uint64 txIndex = 2;
|
||||||
|
bytes txHash = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 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 {
|
||||||
|
BlockFilter blockID = 1;
|
||||||
|
|
||||||
|
repeated CompactTx vtx = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message CompactTx {
|
||||||
|
// Index and hash will allow the receiver to call out to chain
|
||||||
|
// explorers or other data structures to retrieve more information
|
||||||
|
// about this transaction.
|
||||||
|
uint64 index = 1;
|
||||||
|
bytes hash = 2;
|
||||||
|
|
||||||
|
repeated CompactSpend spends = 3;
|
||||||
|
repeated CompactOutput outputs = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message CompactSpend {
|
||||||
|
bytes nf = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message CompactOutput {
|
||||||
|
bytes cmu = 1;
|
||||||
|
bytes epk = 2;
|
||||||
|
bytes ciphertext = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
// An opaque blob of full transaction data, for fetching anything that is not
|
||||||
|
// in the compact format (e.g. the memo field).
|
||||||
|
message FullTransaction {
|
||||||
|
TxFilter txID = 1;
|
||||||
|
bytes data = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Empty placeholder.
|
||||||
|
// Someday we may want to specify e.g. a particular chain fork.
|
||||||
|
message ChainSpec {}
|
||||||
|
|
||||||
|
service CompactTxStreamer {
|
||||||
|
rpc GetLatestBlock(ChainSpec) returns (BlockFilter) {}
|
||||||
|
rpc GetBlock(BlockFilter) returns (CompactBlock) {}
|
||||||
|
rpc GetBlockRange(RangeFilter) returns (stream CompactBlock) {}
|
||||||
|
rpc GetTransaction(TxFilter) returns (FullTransaction) {}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
package proto
|
||||||
|
|
||||||
|
//go:generate protoc --go_out=. compact_formats.proto
|
Loading…
Reference in New Issue