Documentation ¶
Index ¶
- Constants
- type Block
- type Blockchain
- func (bc *Blockchain) Close()
- func (bc *Blockchain) FindTransaction(ID *transaction.IDType) (tx *transaction.Transaction, err error)
- func (bc *Blockchain) Iterator() *Iterator
- func (bc *Blockchain) MineBlock(txs []*transaction.Transaction) (err error)
- func (bc *Blockchain) SignTransaction(tx *transaction.Transaction, prv *ecdsa.PrivateKey) (err error)
- func (bc *Blockchain) UTXOs(addr string, amt int) (utxos []*transaction.OutputWraper, tot int, err error)
- func (bc *Blockchain) VerifyTransaction(tx *transaction.Transaction) (valid bool, err error)
- type Iterator
- type PoW
Constants ¶
View Source
const MaxNonce = math.MaxInt64
View Source
const TargetBits uint = 20
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Block ¶
type Block struct { Timestamp int64 PrevBlockHash, Hash []byte Transactions []*transaction.Transaction Nonce int }
func DeserializeBlock ¶
func NewBlock ¶
func NewBlock(txs []*transaction.Transaction, prevBlockHash []byte) *Block
func NewGenesisBlock ¶
func NewGenesisBlock(coinbase *transaction.Transaction) *Block
func (*Block) HashTransactions ¶
type Blockchain ¶
type Blockchain struct {
// contains filtered or unexported fields
}
func CreateBlockchain ¶
func CreateBlockchain(addr string) (bc *Blockchain, err error)
func LoadBlockchain ¶
func LoadBlockchain() (bc *Blockchain, err error)
func (*Blockchain) Close ¶
func (bc *Blockchain) Close()
func (*Blockchain) FindTransaction ¶
func (bc *Blockchain) FindTransaction(ID *transaction.IDType) (tx *transaction.Transaction, err error)
func (*Blockchain) Iterator ¶
func (bc *Blockchain) Iterator() *Iterator
func (*Blockchain) MineBlock ¶
func (bc *Blockchain) MineBlock(txs []*transaction.Transaction) (err error)
func (*Blockchain) SignTransaction ¶
func (bc *Blockchain) SignTransaction(tx *transaction.Transaction, prv *ecdsa.PrivateKey) (err error)
func (*Blockchain) UTXOs ¶
func (bc *Blockchain) UTXOs(addr string, amt int) (utxos []*transaction.OutputWraper, tot int, err error)
func (*Blockchain) VerifyTransaction ¶
func (bc *Blockchain) VerifyTransaction(tx *transaction.Transaction) (valid bool, err error)
Click to show internal directories.
Click to hide internal directories.