genproto

package
v0.0.0-...-63dd8f1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 19, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Node_Handshake_FullMethodName         = "/Node/Handshake"
	Node_HandleTransaction_FullMethodName = "/Node/HandleTransaction"
)

Variables

View Source
var File_blockchain_proto protoreflect.FileDescriptor
View Source
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: "blockchain.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 Block

type Block struct {
	Header       *BlockHeader   `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"`
	PublicKey    []byte         `protobuf:"bytes,2,opt,name=publicKey,proto3" json:"publicKey,omitempty"`
	Signature    []byte         `protobuf:"bytes,3,opt,name=signature,proto3" json:"signature,omitempty"`
	Transactions []*Transaction `protobuf:"bytes,4,rep,name=transactions,proto3" json:"transactions,omitempty"`
	// contains filtered or unexported fields
}

func (*Block) Descriptor deprecated

func (*Block) Descriptor() ([]byte, []int)

Deprecated: Use Block.ProtoReflect.Descriptor instead.

func (*Block) GetHeader

func (x *Block) GetHeader() *BlockHeader

func (*Block) GetPublicKey

func (x *Block) GetPublicKey() []byte

func (*Block) GetSignature

func (x *Block) GetSignature() []byte

func (*Block) GetTransactions

func (x *Block) GetTransactions() []*Transaction

func (*Block) ProtoMessage

func (*Block) ProtoMessage()

func (*Block) ProtoReflect

func (x *Block) ProtoReflect() protoreflect.Message

func (*Block) Reset

func (x *Block) Reset()

func (*Block) String

func (x *Block) String() string

type BlockHeader

type BlockHeader struct {
	Version int32 `protobuf:"varint,1,opt,name=version,proto3" json:"version,omitempty"`
	// Block height in the blockchain (sequential ID)
	Height int32 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"`
	// Hash of the previous block in the chain
	PrevHash []byte `protobuf:"bytes,3,opt,name=prevHash,proto3" json:"prevHash,omitempty"`
	// Merkle root hash of all transactions in this block
	RootHash []byte `protobuf:"bytes,4,opt,name=rootHash,proto3" json:"rootHash,omitempty"`
	// Unix timestamp when the block was created
	Timestamp int64 `protobuf:"varint,5,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
	// contains filtered or unexported fields
}

func (*BlockHeader) Descriptor deprecated

func (*BlockHeader) Descriptor() ([]byte, []int)

Deprecated: Use BlockHeader.ProtoReflect.Descriptor instead.

func (*BlockHeader) GetHeight

func (x *BlockHeader) GetHeight() int32

func (*BlockHeader) GetPrevHash

func (x *BlockHeader) GetPrevHash() []byte

func (*BlockHeader) GetRootHash

func (x *BlockHeader) GetRootHash() []byte

func (*BlockHeader) GetTimestamp

func (x *BlockHeader) GetTimestamp() int64

func (*BlockHeader) GetVersion

func (x *BlockHeader) GetVersion() int32

func (*BlockHeader) ProtoMessage

func (*BlockHeader) ProtoMessage()

func (*BlockHeader) ProtoReflect

func (x *BlockHeader) ProtoReflect() protoreflect.Message

func (*BlockHeader) Reset

func (x *BlockHeader) Reset()

func (*BlockHeader) String

func (x *BlockHeader) String() string

type NodeClient

type NodeClient interface {
	Handshake(ctx context.Context, in *NodeInfo, opts ...grpc.CallOption) (*NodeInfo, error)
	HandleTransaction(ctx context.Context, in *Transaction, opts ...grpc.CallOption) (*emptypb.Empty, 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 NodeInfo

type NodeInfo 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 is an address the node is listening on for connections.
	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 (*NodeInfo) Descriptor deprecated

func (*NodeInfo) Descriptor() ([]byte, []int)

Deprecated: Use NodeInfo.ProtoReflect.Descriptor instead.

func (*NodeInfo) GetHeight

func (x *NodeInfo) GetHeight() int32

func (*NodeInfo) GetListenAddr

func (x *NodeInfo) GetListenAddr() string

func (*NodeInfo) GetPeerList

func (x *NodeInfo) GetPeerList() []string

func (*NodeInfo) GetVersion

func (x *NodeInfo) GetVersion() string

func (*NodeInfo) ProtoMessage

func (*NodeInfo) ProtoMessage()

func (*NodeInfo) ProtoReflect

func (x *NodeInfo) ProtoReflect() protoreflect.Message

func (*NodeInfo) Reset

func (x *NodeInfo) Reset()

func (*NodeInfo) String

func (x *NodeInfo) String() string

type NodeServer

type NodeServer interface {
	Handshake(context.Context, *NodeInfo) (*NodeInfo, error)
	HandleTransaction(context.Context, *Transaction) (*emptypb.Empty, error)
	// contains filtered or unexported methods
}

NodeServer is the server API for Node service. All implementations must embed UnimplementedNodeServer for forward compatibility.

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 {

	// prevTxHash is the hash of the previous transaction that this input is spending from.
	PrevTxHash []byte `protobuf:"bytes,1,opt,name=prevTxHash,proto3" json:"prevTxHash,omitempty"`
	// prevTxOutIndex (UTXO id) is the index of the output in the previous transaction that this input is spending from.
	PrevTxOutIndex uint32 `protobuf:"varint,2,opt,name=prevTxOutIndex,proto3" json:"prevTxOutIndex,omitempty"`
	PublicKey      []byte `protobuf:"bytes,3,opt,name=publicKey,proto3" json:"publicKey,omitempty"`
	// signature signs the transaction hash and the public key of the sender.
	Signature []byte `protobuf:"bytes,4,opt,name=signature,proto3" json:"signature,omitempty"`
	// contains filtered or unexported fields
}

func (*TxInput) Descriptor deprecated

func (*TxInput) Descriptor() ([]byte, []int)

Deprecated: Use TxInput.ProtoReflect.Descriptor instead.

func (*TxInput) GetPrevTxHash

func (x *TxInput) GetPrevTxHash() []byte

func (*TxInput) GetPrevTxOutIndex

func (x *TxInput) GetPrevTxOutIndex() uint32

func (*TxInput) GetPublicKey

func (x *TxInput) GetPublicKey() []byte

func (*TxInput) GetSignature

func (x *TxInput) GetSignature() []byte

func (*TxInput) ProtoMessage

func (*TxInput) ProtoMessage()

func (*TxInput) ProtoReflect

func (x *TxInput) ProtoReflect() protoreflect.Message

func (*TxInput) Reset

func (x *TxInput) Reset()

func (*TxInput) String

func (x *TxInput) String() string

type TxOutput

type TxOutput struct {
	Amount int64 `protobuf:"varint,1,opt,name=amount,proto3" json:"amount,omitempty"`
	// Address of the recipient
	Address []byte `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"`
	// contains filtered or unexported fields
}

func (*TxOutput) Descriptor deprecated

func (*TxOutput) Descriptor() ([]byte, []int)

Deprecated: Use TxOutput.ProtoReflect.Descriptor instead.

func (*TxOutput) GetAddress

func (x *TxOutput) GetAddress() []byte

func (*TxOutput) GetAmount

func (x *TxOutput) GetAmount() int64

func (*TxOutput) ProtoMessage

func (*TxOutput) ProtoMessage()

func (*TxOutput) ProtoReflect

func (x *TxOutput) ProtoReflect() protoreflect.Message

func (*TxOutput) Reset

func (x *TxOutput) Reset()

func (*TxOutput) String

func (x *TxOutput) String() string

type UnimplementedNodeServer

type UnimplementedNodeServer struct{}

UnimplementedNodeServer must be embedded to have forward compatible implementations.

NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.

func (UnimplementedNodeServer) HandleTransaction

func (UnimplementedNodeServer) Handshake

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL