Documentation
¶
Index ¶
- Constants
- Variables
- func RegisterNodeServer(s grpc.ServiceRegistrar, srv NodeServer)
- type Ack
- type Block
- func (*Block) Descriptor() ([]byte, []int)deprecated
- func (x *Block) GetHeader() *Header
- func (x *Block) GetPublicKey() []byte
- func (x *Block) GetSignature() []byte
- func (x *Block) GetTransactions() []*Transaction
- func (*Block) ProtoMessage()
- func (x *Block) ProtoReflect() protoreflect.Message
- func (x *Block) Reset()
- func (x *Block) String() string
- type Header
- func (*Header) Descriptor() ([]byte, []int)deprecated
- func (x *Header) GetHeight() int32
- func (x *Header) GetPrvHash() []byte
- func (x *Header) GetRootHash() []byte
- func (x *Header) GetTimestamp() int64
- func (x *Header) GetVersion() int32
- func (*Header) ProtoMessage()
- func (x *Header) ProtoReflect() protoreflect.Message
- func (x *Header) Reset()
- func (x *Header) String() string
- type NodeClient
- type NodeServer
- type None
- type Transaction
- func (*Transaction) Descriptor() ([]byte, []int)deprecated
- func (x *Transaction) GetInputs() []*TxInput
- func (x *Transaction) GetOutputs() []*TxOutput
- func (x *Transaction) GetVersion() int32
- func (*Transaction) ProtoMessage()
- func (x *Transaction) ProtoReflect() protoreflect.Message
- func (x *Transaction) Reset()
- func (x *Transaction) String() string
- type TxInput
- func (*TxInput) Descriptor() ([]byte, []int)deprecated
- func (x *TxInput) GetPrvHash() []byte
- func (x *TxInput) GetPrvOutIndex() uint32
- func (x *TxInput) GetPublicKey() []byte
- func (x *TxInput) GetSignature() []byte
- func (*TxInput) ProtoMessage()
- func (x *TxInput) ProtoReflect() protoreflect.Message
- func (x *TxInput) Reset()
- func (x *TxInput) String() string
- type TxOutput
- type UnimplementedNodeServer
- type UnsafeNodeServer
- type Version
- func (*Version) Descriptor() ([]byte, []int)deprecated
- func (x *Version) GetHeight() int32
- func (x *Version) GetListenAddr() string
- func (x *Version) GetPeerList() []string
- func (x *Version) GetVersion() string
- func (*Version) ProtoMessage()
- func (x *Version) ProtoReflect() protoreflect.Message
- func (x *Version) Reset()
- func (x *Version) String() string
Constants ¶
const ( Node_Handshake_FullMethodName = "/Node/Handshake" Node_HandleTransaction_FullMethodName = "/Node/HandleTransaction" )
Variables ¶
var File_proto_types_proto protoreflect.FileDescriptor
var Node_ServiceDesc = grpc.ServiceDesc{ ServiceName: "Node", HandlerType: (*NodeServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Handshake", Handler: _Node_Handshake_Handler, }, { MethodName: "HandleTransaction", Handler: _Node_HandleTransaction_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "proto/types.proto", }
Node_ServiceDesc is the grpc.ServiceDesc for Node service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterNodeServer ¶
func RegisterNodeServer(s grpc.ServiceRegistrar, srv NodeServer)
Types ¶
type Ack ¶
type Ack struct {
// contains filtered or unexported fields
}
func (*Ack) Descriptor
deprecated
func (*Ack) ProtoMessage ¶
func (*Ack) ProtoMessage()
func (*Ack) ProtoReflect ¶
func (x *Ack) ProtoReflect() protoreflect.Message
type Block ¶
type Block struct { Header *Header `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` Transactions []*Transaction `protobuf:"bytes,2,rep,name=transactions,proto3" json:"transactions,omitempty"` PublicKey []byte `protobuf:"bytes,3,opt,name=publicKey,proto3" json:"publicKey,omitempty"` Signature []byte `protobuf:"bytes,4,opt,name=signature,proto3" json:"signature,omitempty"` // contains filtered or unexported fields }
func (*Block) Descriptor
deprecated
func (*Block) GetPublicKey ¶
func (*Block) GetSignature ¶
func (*Block) GetTransactions ¶
func (x *Block) GetTransactions() []*Transaction
func (*Block) ProtoMessage ¶
func (*Block) ProtoMessage()
func (*Block) ProtoReflect ¶
func (x *Block) ProtoReflect() protoreflect.Message
type Header ¶
type Header struct { Version int32 `protobuf:"varint,1,opt,name=version,proto3" json:"version,omitempty"` Height int32 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"` PrvHash []byte `protobuf:"bytes,3,opt,name=prvHash,proto3" json:"prvHash,omitempty"` RootHash []byte `protobuf:"bytes,4,opt,name=rootHash,proto3" json:"rootHash,omitempty"` // merkle root of txs Timestamp int64 `protobuf:"varint,5,opt,name=timestamp,proto3" json:"timestamp,omitempty"` // contains filtered or unexported fields }
func (*Header) Descriptor
deprecated
func (*Header) GetPrvHash ¶
func (*Header) GetRootHash ¶
func (*Header) GetTimestamp ¶
func (*Header) GetVersion ¶
func (*Header) ProtoMessage ¶
func (*Header) ProtoMessage()
func (*Header) ProtoReflect ¶
func (x *Header) ProtoReflect() protoreflect.Message
type NodeClient ¶
type NodeClient interface { Handshake(ctx context.Context, in *Version, opts ...grpc.CallOption) (*Version, error) HandleTransaction(ctx context.Context, in *Transaction, opts ...grpc.CallOption) (*Ack, error) }
NodeClient is the client API for Node service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
func NewNodeClient ¶
func NewNodeClient(cc grpc.ClientConnInterface) NodeClient
type NodeServer ¶
type NodeServer interface { Handshake(context.Context, *Version) (*Version, error) HandleTransaction(context.Context, *Transaction) (*Ack, error) // contains filtered or unexported methods }
NodeServer is the server API for Node service. All implementations must embed UnimplementedNodeServer for forward compatibility
type None ¶
type None struct {
// contains filtered or unexported fields
}
func (*None) Descriptor
deprecated
func (*None) ProtoMessage ¶
func (*None) ProtoMessage()
func (*None) ProtoReflect ¶
func (x *None) ProtoReflect() protoreflect.Message
type Transaction ¶
type Transaction struct { Version int32 `protobuf:"varint,1,opt,name=version,proto3" json:"version,omitempty"` Inputs []*TxInput `protobuf:"bytes,2,rep,name=inputs,proto3" json:"inputs,omitempty"` Outputs []*TxOutput `protobuf:"bytes,3,rep,name=outputs,proto3" json:"outputs,omitempty"` // contains filtered or unexported fields }
func (*Transaction) Descriptor
deprecated
func (*Transaction) Descriptor() ([]byte, []int)
Deprecated: Use Transaction.ProtoReflect.Descriptor instead.
func (*Transaction) GetInputs ¶
func (x *Transaction) GetInputs() []*TxInput
func (*Transaction) GetOutputs ¶
func (x *Transaction) GetOutputs() []*TxOutput
func (*Transaction) GetVersion ¶
func (x *Transaction) GetVersion() int32
func (*Transaction) ProtoMessage ¶
func (*Transaction) ProtoMessage()
func (*Transaction) ProtoReflect ¶
func (x *Transaction) ProtoReflect() protoreflect.Message
func (*Transaction) Reset ¶
func (x *Transaction) Reset()
func (*Transaction) String ¶
func (x *Transaction) String() string
type TxInput ¶
type TxInput struct { // The previous hash of the transaction // containing the output we want to spend PrvHash []byte `protobuf:"bytes,1,opt,name=prvHash,proto3" json:"prvHash,omitempty"` // The index of the output of the previous // transaction we want to spend PrvOutIndex uint32 `protobuf:"varint,2,opt,name=prvOutIndex,proto3" json:"prvOutIndex,omitempty"` PublicKey []byte `protobuf:"bytes,3,opt,name=publicKey,proto3" json:"publicKey,omitempty"` Signature []byte `protobuf:"bytes,4,opt,name=signature,proto3" json:"signature,omitempty"` // contains filtered or unexported fields }
func (*TxInput) Descriptor
deprecated
func (*TxInput) GetPrvHash ¶
func (*TxInput) GetPrvOutIndex ¶
func (*TxInput) GetPublicKey ¶
func (*TxInput) GetSignature ¶
func (*TxInput) ProtoMessage ¶
func (*TxInput) ProtoMessage()
func (*TxInput) ProtoReflect ¶
func (x *TxInput) ProtoReflect() protoreflect.Message
type TxOutput ¶
type TxOutput struct { Amount int64 `protobuf:"varint,1,opt,name=amount,proto3" json:"amount,omitempty"` Address []byte `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` // contains filtered or unexported fields }
func (*TxOutput) Descriptor
deprecated
func (*TxOutput) GetAddress ¶
func (*TxOutput) ProtoMessage ¶
func (*TxOutput) ProtoMessage()
func (*TxOutput) ProtoReflect ¶
func (x *TxOutput) ProtoReflect() protoreflect.Message
type UnimplementedNodeServer ¶
type UnimplementedNodeServer struct { }
UnimplementedNodeServer must be embedded to have forward compatible implementations.
func (UnimplementedNodeServer) HandleTransaction ¶
func (UnimplementedNodeServer) HandleTransaction(context.Context, *Transaction) (*Ack, error)
type UnsafeNodeServer ¶
type UnsafeNodeServer interface {
// contains filtered or unexported methods
}
UnsafeNodeServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to NodeServer will result in compilation errors.
type Version ¶
type Version struct { Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` Height int32 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"` ListenAddr string `protobuf:"bytes,3,opt,name=listenAddr,proto3" json:"listenAddr,omitempty"` PeerList []string `protobuf:"bytes,4,rep,name=peerList,proto3" json:"peerList,omitempty"` // contains filtered or unexported fields }
func (*Version) Descriptor
deprecated
func (*Version) GetListenAddr ¶
func (*Version) GetPeerList ¶
func (*Version) GetVersion ¶
func (*Version) ProtoMessage ¶
func (*Version) ProtoMessage()
func (*Version) ProtoReflect ¶
func (x *Version) ProtoReflect() protoreflect.Message