Documentation ¶
Index ¶
- Constants
- type Block
- type Blockchain
- func (bc *Blockchain) AddTransaction(sender string, recipient string, value float32, ...) bool
- func (bc *Blockchain) CalculateTotalAmount(blockchainAddress string) float32
- func (bc *Blockchain) CopyTransactionPool() []*Transaction
- func (bc *Blockchain) CreateBlock(nonce int, previousHash [32]byte) *Block
- func (bc *Blockchain) LastBlock() *Block
- func (bc *Blockchain) MarshalJSON() ([]byte, error)
- func (bc *Blockchain) Mining() bool
- func (bc *Blockchain) Print()
- func (bc *Blockchain) ProofOfWork() int
- func (bc *Blockchain) ValidProof(nonce int, previousHash [32]byte, transactions []*Transaction, difficulty int) bool
- func (bc *Blockchain) VerifyTransactionSignature(senderPublicKey *ecdsa.PublicKey, s *utils.Signature, t *Transaction) bool
- type Transaction
Constants ¶
View Source
const ( MINING_DIFFICULTY = 3 MINING_SENDER = "BLOCKCHAIN REWARD SYSTEM (e.g. minting & fees)" MINING_REWARD = 1.0 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Block ¶
type Block struct {
// contains filtered or unexported fields
}
func (*Block) MarshalJSON ¶
type Blockchain ¶
type Blockchain struct {
// contains filtered or unexported fields
}
func NewBlockchain ¶
func NewBlockchain(blockchainAddress string, port uint16) *Blockchain
func (*Blockchain) AddTransaction ¶
func (*Blockchain) CalculateTotalAmount ¶
func (bc *Blockchain) CalculateTotalAmount(blockchainAddress string) float32
func (*Blockchain) CopyTransactionPool ¶
func (bc *Blockchain) CopyTransactionPool() []*Transaction
func (*Blockchain) CreateBlock ¶
func (bc *Blockchain) CreateBlock(nonce int, previousHash [32]byte) *Block
func (*Blockchain) LastBlock ¶
func (bc *Blockchain) LastBlock() *Block
func (*Blockchain) MarshalJSON ¶ added in v1.29.0
func (bc *Blockchain) MarshalJSON() ([]byte, error)
func (*Blockchain) Mining ¶
func (bc *Blockchain) Mining() bool
func (*Blockchain) Print ¶
func (bc *Blockchain) Print()
func (*Blockchain) ProofOfWork ¶
func (bc *Blockchain) ProofOfWork() int
func (*Blockchain) ValidProof ¶
func (bc *Blockchain) ValidProof(nonce int, previousHash [32]byte, transactions []*Transaction, difficulty int) bool
func (*Blockchain) VerifyTransactionSignature ¶ added in v1.27.0
func (bc *Blockchain) VerifyTransactionSignature(senderPublicKey *ecdsa.PublicKey, s *utils.Signature, t *Transaction) bool
type Transaction ¶
type Transaction struct {
// contains filtered or unexported fields
}
func NewTransaction ¶
func NewTransaction(sender string, recipient string, value float32) *Transaction
func (*Transaction) MarshalJSON ¶
func (t *Transaction) MarshalJSON() ([]byte, error)
func (*Transaction) Print ¶
func (t *Transaction) Print()
Click to show internal directories.
Click to hide internal directories.