Documentation ¶
Overview ¶
This module contains the definition and implementation of the Block structure and its methods
This module contains the functions used to serialize and deserialize primitive type to binary gob data
This module contains the definition and implementation of the Transaction struct and its methods
This module contains the definition and implementation of the smaller component structures such as TXI, TXO and Address.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Address ¶
type Address struct { // Represents the bytes value of the address Bytes []byte // Represents the string value of the address String string // Represents the version/weave prefix of the address Prefix byte // Represents the adddress checksum Checksum Hash // Represents the hash of the public key of the address PublicKeyHash Hash }
A struct that represents the Address of a User/Wallet
func NewAddress ¶
A constructor function that generates and returns a new Address object from a given address string.
type Block ¶
type Block struct { // Represents the Block Header BlockHeader // Represents the Block Height BlockHeight int // Represents the no.of Transactions in the Block TXCount int // Represents the list of Transactions in the Block TXList []*Transaction // Represents the address of the Block origin (coinbase address) BlockOrigin Address // Represents the Hash of the Block Header BlockHash Hash }
A structure that represents a single Block on the Blockchain
func BlockDeserialize ¶
A function to deserialize a gob of bytes into a Block
type BlockHeader ¶
type BlockHeader struct { // Represents the consensus parameters of the Block ConsensusHeader // Represents the hash of the previous Block Priori Hash // Represents the timestamp of the Block at the point of creation Timestamp int64 // Represent the merkle root of transactions on the Block MerkleRoot Hash // Represents the weave network of the Block BlockWeave []byte // Represents the software version of Block Generator Version []byte }
A structure that represents the header of a Block
func BlockHeaderDeserialize ¶
func BlockHeaderDeserialize(gobdata Gob) *BlockHeader
A function to deserialize a gob of bytes into a BlockHeader
type ConsensusHeader ¶
An interface for all types of consensus headers
type Gob ¶
type Gob []byte
A type alias for a byte slice that represents a gob of data
func BlockHeaderSerialize ¶
func BlockHeaderSerialize(header *BlockHeader) Gob
A function to serialize a BlockHeader into gob of bytes
func BlockSerialize ¶
A function to serialize a Block into gob of bytes
func TXOListSerialize ¶
A function to serialize a TXOList into gob of bytes
func TxnSerialize ¶
func TxnSerialize(txn *Transaction) Gob
A function to serialize a Transaction into a gob of bytes
type PublicKey ¶
type PublicKey []byte
A type alias for a byte slice that represents a wallet public key
type TXI ¶
type TXI struct { // Represents the transaction ID of which the reference output is a part ID Hash // Represents the index of reference output in the transaction OutIndex int // Represents the signature of the transaction Signature []byte // Represents the public key of the sending address PublicKey PublicKey }
A structure that represents the inputs in a transaction which are really just references to previous outputs
type TXO ¶
type TXO struct { // Represents the token value of a given transaction output Value int // Represents the hash of the public key of the recieving address PublicKeyHash Hash }
A structure that represents the outputs in a transaction
type TXOList ¶
type TXOList []TXO
A type alias for a slice of transaction outputs
func TXOListDeserialize ¶
A function to deserialize a gob of bytes into a TXOList
type Transaction ¶
type Transaction struct { // Represents the ID of the transaction obtained from its hash ID Hash // Represents the list of transaction inputs Inputs TXIList // Represents the list of transaction outputs Outputs TXOList }
A structure that represents a transaction on the Animus Blockchain
func TxnDeserialize ¶
func TxnDeserialize(gobdata Gob) *Transaction
A function to deserialize a gob of bytes into a Transaction
func (*Transaction) GenerateHash ¶
func (txn *Transaction) GenerateHash() Hash
A method of Transaction that generates a hash of the Transaction
func (*Transaction) GenerateSafeCopy ¶
func (txn *Transaction) GenerateSafeCopy() Transaction
A method of Transaction that generates a safe version of the Transaction that does not include the signature and public keys of its transaction inputs
func (*Transaction) GenerateString ¶
func (txn *Transaction) GenerateString() string
A method of Transaction that generates the string representation of a transaction and all its inputs and outputs. TODO: NEEDS REWORK FOR FORMATTING
func (*Transaction) IsCoinbaseTxn ¶
func (txn *Transaction) IsCoinbaseTxn() bool
A method of Transaction that checks if it is a Coinbase Transaction