Documentation
¶
Overview ¶
Package types contains types like structs and interfaces that are commonly used in go-chain.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Block ¶
type Block struct {
Timestamp int64 `json:"timestamp"`
LastHash string `json:"lastHash"`
Hash string `json:"hash"`
Transactions []Transaction `json:"transactions"`
Difficulty uint64 `json:"difficulty"`
Nonce int `json:"nonce"`
}
Block is chained with other Blocks (lastHash) to form the blockchain.
type Signature ¶
Signature is composed of a pair of integers that is the result of the Sign function.
type Transaction ¶
type Transaction struct {
ID uuid.UUID `json:"id"`
Input Input `json:"input"`
Outputs []Output `json:"outputs"`
Signature Signature `json:"signature"`
}
Transaction gets created and signed by an account. Will be added to a "Block" by miners.
func (Transaction) Hash ¶
func (t Transaction) Hash() ([]byte, error)
Hash returns a sha256 string based on the given transaction.
func (Transaction) IsValid ¶
func (t Transaction) IsValid() bool
IsValid returns "true" if transaction is valid
func (Transaction) String ¶
func (t Transaction) String() string
type Wallet ¶
type Wallet struct {
Address Address `json:"address"`
PublicKey ecdsa.PublicKey `json:"publicKey"`
PrivateKey ecdsa.PrivateKey `json:"privateKey"`
Balance Balance `json:"balance"`
}
Wallet represents a single user/client wallet in the go-chain.
Click to show internal directories.
Click to hide internal directories.