Versions in this module Expand all Collapse all v0 v0.0.2 Dec 28, 2020 Changes in this version + func Base58Decode(input []byte) []byte + func Base58Encode(input []byte) []byte + func DBExists() bool + func HashPubKey(pubKey []byte) []byte + func IntToHex(n int64) []byte + func ReverseBytes(data []byte) + func ValidateAddress(address string) bool + type Block struct + Hash []byte + Nonce int + PrevBlockHash []byte + Timestamp int64 + Transactions []*Transaction + func DeserializeBlock(d []byte) *Block + func NewBlock(transactions []*Transaction, prevBlockHash []byte) *Block + func NewGenesisBlock(coinbase *Transaction) *Block + func (b *Block) HashTransactions() []byte + func (b *Block) Serialize() []byte + type Blockchain struct + DB *bolt.DB + Tip []byte + func CreateBlockchain(address string) *Blockchain + func NewBlockChain(address string) *Blockchain + func (bc *Blockchain) FindTransaction(ID []byte) (Transaction, error) + func (bc *Blockchain) FindUTXO() map[string]TXOutputs + func (bc *Blockchain) Iterator() *BlockchainIterator + func (bc *Blockchain) MineBlock(transactions []*Transaction) *Block + func (bc *Blockchain) SignTransaction(tx *Transaction, privKey ecdsa.PrivateKey) + func (bc *Blockchain) VerifyTransaction(tx *Transaction) bool + type BlockchainIterator struct + DB *bolt.DB + func (i *BlockchainIterator) Next() *Block + type MerkleNode struct + Data []byte + Left *MerkleNode + Right *MerkleNode + func NewMerkleNode(left, right *MerkleNode, data []byte) *MerkleNode + type MerkleTree struct + RootNode *MerkleNode + func NewMerkleTree(data [][]byte) *MerkleTree + type ProofOfWork struct + func NewProofOfWork(b *Block) *ProofOfWork + func (pow *ProofOfWork) PrepareData(nonce int) []byte + func (pow *ProofOfWork) Run() (int, []byte) + func (pow *ProofOfWork) Validate() bool + type TXInput struct + PubKey []byte + Signature []byte + Txid []byte + Vout int + func (in *TXInput) UsesKey(pubKeyHash []byte) bool + type TXOutput struct + PubKeyHash []byte + Value int + func NewTXOutput(value int, address string) *TXOutput + func (out *TXOutput) IsLockedWithKey(pubKey []byte) bool + func (out *TXOutput) Lock(address []byte) + type TXOutputs struct + Outputs []TXOutput + func DeserializeOutputs(data []byte) TXOutputs + func (outs TXOutputs) Serialize() []byte + type Transaction struct + ID []byte + Vin []TXInput + Vout []TXOutput + func NewCoinbaseTX(to, data string) *Transaction + func NewUTXOTransaction(from, to string, amount int, UTXOSet *UTXOSet) *Transaction + func (tx *Transaction) Hash() []byte + func (tx *Transaction) Sign(privateKey ecdsa.PrivateKey, prevTXs map[string]Transaction) + func (tx *Transaction) TrimmedCopy() Transaction + func (tx *Transaction) Verify(prevTXs map[string]Transaction) bool + func (tx Transaction) IsCoinbase() bool + func (tx Transaction) Serialize() []byte + type UTXOSet struct + Blockchain *Blockchain + func (u UTXOSet) FindSpendableOutputs(pubKeyHash []byte, amount int) (int, map[string][]int) + func (u UTXOSet) FindUTXO(pubKeyHash []byte) []TXOutput + func (u UTXOSet) Reindex() + func (u UTXOSet) Update(block *Block) + type Wallet struct + PrivateKey ecdsa.PrivateKey + PublicKey []byte + func NewWallet() *Wallet + func (w Wallet) GetAddress() []byte + type Wallets struct + Wallets map[string]*Wallet + func NewWallets() (*Wallets, error) + func (ws *Wallets) CreateWallet() string + func (ws *Wallets) LoadFromFile() error + func (ws Wallets) GetWallet(address string) Wallet + func (ws Wallets) SaveToFile()