Documentation ¶
Overview ¶
Package block is a generated protocol buffer package.
It is generated from these files:
block/block.proto
It has these top-level messages:
Signature Transaction Block PublicKey PrivateKey
Index ¶
- Variables
- func GenerateKey() (*ecdsa.PrivateKey, error)
- func MarshalKey(key *ecdsa.PrivateKey) ([]byte, error)
- func NewCurve() elliptic.Curve
- func NewHash() hash.Hash
- func UnmarshalKey(buff []byte, key *ecdsa.PrivateKey) error
- type Block
- func (*Block) Descriptor() ([]byte, []int)
- func (b *Block) First() bool
- func (m *Block) GetHash() []byte
- func (m *Block) GetParent() []byte
- func (m *Block) GetTimestamp() int64
- func (m *Block) GetTransactions() []*Transaction
- func (*Block) ProtoMessage()
- func (m *Block) Reset()
- func (m *Block) String() string
- func (b *Block) Valid(pubs []ecdsa.PublicKey) bool
- type PrivateKey
- type PublicKey
- type Signature
- func (*Signature) Descriptor() ([]byte, []int)
- func (s *Signature) GetA() *big.Int
- func (s *Signature) GetB() *big.Int
- func (m *Signature) GetHash() []byte
- func (m *Signature) GetSignatureA() []byte
- func (m *Signature) GetSignatureB() []byte
- func (m *Signature) GetTimestamp() int64
- func (*Signature) ProtoMessage()
- func (m *Signature) Reset()
- func (m *Signature) String() string
- type Transaction
- func (*Transaction) Descriptor() ([]byte, []int)
- func (m *Transaction) GetPayload() []byte
- func (m *Transaction) GetSignature() *Signature
- func (m *Transaction) GetType() Transaction_Type
- func (*Transaction) ProtoMessage()
- func (m *Transaction) Reset()
- func (m *Transaction) String() string
- func (t *Transaction) Valid(keys []ecdsa.PublicKey) bool
- type Transaction_Type
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrInvalidBlock = errors.New("Block Not Valid")
)
View Source
var Transaction_Type_name = map[int32]string{
0: "Raw",
1: "PublicKey",
}
View Source
var Transaction_Type_value = map[string]int32{
"Raw": 0,
"PublicKey": 1,
}
Functions ¶
func GenerateKey ¶
func GenerateKey() (*ecdsa.PrivateKey, error)
func MarshalKey ¶
func MarshalKey(key *ecdsa.PrivateKey) ([]byte, error)
func UnmarshalKey ¶
func UnmarshalKey(buff []byte, key *ecdsa.PrivateKey) error
Types ¶
type Block ¶
type Block struct { Timestamp int64 `protobuf:"varint,1,opt,name=timestamp" json:"timestamp,omitempty"` Parent []byte `protobuf:"bytes,2,opt,name=parent,proto3" json:"parent,omitempty"` Hash []byte `protobuf:"bytes,3,opt,name=hash,proto3" json:"hash,omitempty"` Transactions []*Transaction `protobuf:"bytes,4,rep,name=transactions" json:"transactions,omitempty"` }
Metadata about a block
func NewBlock ¶
func NewBlock(parent []byte, transactions []*Transaction) *Block
func (*Block) Descriptor ¶
func (*Block) GetTimestamp ¶
func (*Block) GetTransactions ¶
func (m *Block) GetTransactions() []*Transaction
func (*Block) ProtoMessage ¶
func (*Block) ProtoMessage()
type PrivateKey ¶
type PrivateKey struct { Public *PublicKey `protobuf:"bytes,1,opt,name=public" json:"public,omitempty"` D []byte `protobuf:"bytes,2,opt,name=d,proto3" json:"d,omitempty"` }
func (*PrivateKey) Descriptor ¶
func (*PrivateKey) Descriptor() ([]byte, []int)
func (*PrivateKey) GetD ¶
func (m *PrivateKey) GetD() []byte
func (*PrivateKey) GetPublic ¶
func (m *PrivateKey) GetPublic() *PublicKey
func (*PrivateKey) ProtoMessage ¶
func (*PrivateKey) ProtoMessage()
func (*PrivateKey) Reset ¶
func (m *PrivateKey) Reset()
func (*PrivateKey) String ¶
func (m *PrivateKey) String() string
type PublicKey ¶
type PublicKey struct { X []byte `protobuf:"bytes,1,opt,name=x,proto3" json:"x,omitempty"` Y []byte `protobuf:"bytes,2,opt,name=y,proto3" json:"y,omitempty"` Hint string `protobuf:"bytes,3,opt,name=hint" json:"hint,omitempty"` }
func (*PublicKey) Descriptor ¶
func (*PublicKey) ProtoMessage ¶
func (*PublicKey) ProtoMessage()
type Signature ¶
type Signature struct { Timestamp int64 `protobuf:"varint,1,opt,name=timestamp" json:"timestamp,omitempty"` Hash []byte `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"` SignatureA []byte `protobuf:"bytes,3,opt,name=signatureA,proto3" json:"signatureA,omitempty"` SignatureB []byte `protobuf:"bytes,4,opt,name=signatureB,proto3" json:"signatureB,omitempty"` }
metadat about a block signature
func NewSignature ¶
func (*Signature) Descriptor ¶
func (*Signature) GetSignatureA ¶
func (*Signature) GetSignatureB ¶
func (*Signature) GetTimestamp ¶
func (*Signature) ProtoMessage ¶
func (*Signature) ProtoMessage()
type Transaction ¶
type Transaction struct { Signature *Signature `protobuf:"bytes,1,opt,name=signature" json:"signature,omitempty"` Type Transaction_Type `protobuf:"varint,2,opt,name=type,enum=block.Transaction_Type" json:"type,omitempty"` Payload []byte `protobuf:"bytes,3,opt,name=payload,proto3" json:"payload,omitempty"` }
func NewTransaction ¶
func NewTransaction(priv *ecdsa.PrivateKey, payload []byte, t Transaction_Type) (*Transaction, error)
func (*Transaction) Descriptor ¶
func (*Transaction) Descriptor() ([]byte, []int)
func (*Transaction) GetPayload ¶
func (m *Transaction) GetPayload() []byte
func (*Transaction) GetSignature ¶
func (m *Transaction) GetSignature() *Signature
func (*Transaction) GetType ¶
func (m *Transaction) GetType() Transaction_Type
func (*Transaction) ProtoMessage ¶
func (*Transaction) ProtoMessage()
func (*Transaction) Reset ¶
func (m *Transaction) Reset()
func (*Transaction) String ¶
func (m *Transaction) String() string
type Transaction_Type ¶
type Transaction_Type int32
const ( Transaction_Raw Transaction_Type = 0 Transaction_PublicKey Transaction_Type = 1 )
func (Transaction_Type) EnumDescriptor ¶
func (Transaction_Type) EnumDescriptor() ([]byte, []int)
func (Transaction_Type) String ¶
func (x Transaction_Type) String() string
Click to show internal directories.
Click to hide internal directories.