account

package
v0.0.0-...-27dc87b Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitBlockchain

func InitBlockchain(Coins uint64) (Blockchain, Account, error)

Types

type Account

type Account struct {
	Identifier ed25519.PublicKey

	Balance uint64
	// contains filtered or unexported fields
}

func (Account) CreateOp

func (acc Account) CreateOp(receiver ed25519.PublicKey, moneyAmount uint64) (Operation, error)

type Block

type Block struct {
	BlockId      hash.Hash
	PrevHash     hash.Hash
	Transactions []Transaction
}

func CreateBlock

func CreateBlock(prevHash hash.Hash, transactions []Transaction) (Block, error)

func (Block) String

func (b Block) String() string

type Blockchain

type Blockchain struct {
	CoinDatabase map[string]uint64
	BlockHistory []Block
	Coins        uint64
}

func (*Blockchain) AddBlock

func (bch *Blockchain) AddBlock(b Block) error

func (Blockchain) CreateTransaction

func (bch Blockchain) CreateTransaction(SetOfOperations []Operation) (Transaction, error)

func (*Blockchain) NewAccount

func (bch *Blockchain) NewAccount(pair keypair.KeyPair) Account

func (Blockchain) String

func (bch Blockchain) String() string

func (Blockchain) Verify

func (bch Blockchain) Verify(op Operation) bool

type Depository

type Depository struct {
	Identifier ed25519.PublicKey

	Balance         uint64
	DepositDatabase map[[32]byte]uint64
	// contains filtered or unexported fields
}

func NewDepository

func NewDepository(pair keypair.KeyPair, faucetCoins uint64) Depository

func (Depository) SendInterests

func (d Depository) SendInterests(rec ed25519.PublicKey, amount uint64) (Operation, error)

type Operation

type Operation struct {
	Sender        ed25519.PublicKey
	Receiver      ed25519.PublicKey
	Amount        uint64
	SignedMessage signature.SignedMessage
}

func CreateOp

func CreateOp(sender ed25519.PublicKey, message signature.SignedMessage) (Operation, error)

func (Operation) String

func (op Operation) String() string

func (Operation) ToByte

func (op Operation) ToByte() []byte

type PaymentMessages

type PaymentMessages struct {
	Sender      ed25519.PublicKey
	Receiver    ed25519.PublicKey
	MoneyAmount uint64
}

func (*PaymentMessages) Decode

func (message *PaymentMessages) Decode(input []byte)

func (PaymentMessages) Encode

func (message PaymentMessages) Encode() []byte

type Transaction

type Transaction struct {
	TransactionID   hash.Hash
	SetOfOperations []Operation
}

func (Transaction) String

func (tx Transaction) String() string

func (Transaction) ToByte

func (tx Transaction) ToByte() ([]byte, error)

Jump to

Keyboard shortcuts

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