Documentation ¶
Index ¶
- Constants
- Variables
- func GetWallets(bc *Blockchain) error
- func HasDoubleSpend(transactions []Transaction) bool
- func LoadStoredHeaders(bc *Blockchain) error
- func LoadUnspent(bc *Blockchain) error
- func NewHash(val []byte) []byte
- func NewRandomHash() []byte
- func SanitizePubKey(pub []byte) string
- func SetupStorage(bc *Blockchain) error
- func StoreLastHeaders(bc *Blockchain) error
- func StoreUnspent(bc *Blockchain) error
- type Block
- type BlockHeader
- type Blockchain
- func (this *Blockchain) AddBlock(block *Block) bool
- func (this *Blockchain) AddTransationToWaiting(tx *Transaction) bool
- func (this *Blockchain) AreHeadersGood() bool
- func (this *Blockchain) BlocksHeight() int64
- func (this *Blockchain) Difficulty() int64
- func (this *Blockchain) Dispatch(cmd *dht.Custom) interface{}
- func (this *Blockchain) GetAvailableFunds(wallet []byte) int
- func (this *Blockchain) GetConnectedNodesNb() int
- func (this *Blockchain) GetEnoughOwnUnspentOut(value int) []UnspentTxOut
- func (this *Blockchain) GetInOutFromUnspent(value int, destWallet []byte, outs []UnspentTxOut) ([]TxIn, []TxOut)
- func (this *Blockchain) GetOwnHistory() []HistoryTx
- func (this *Blockchain) GetOwnWaitingTx() []HistoryTx
- func (this *Blockchain) Init()
- func (this *Blockchain) Logger() *logging.Logger
- func (this *Blockchain) Mine()
- func (this *Blockchain) NextDifficulty() int64
- func (this *Blockchain) ProcessingTransactionCount() int
- func (this *Blockchain) RemovePendingTransaction(insTx []Transaction)
- func (this *Blockchain) RemoveUnspentOut(wallet []byte, out *UnspentTxOut)
- func (this *Blockchain) Running() bool
- func (this *Blockchain) SendTo(value string) error
- func (this *Blockchain) ShowWallets()
- func (this *Blockchain) Start() error
- func (this *Blockchain) Stats() *Stats
- func (this *Blockchain) StatsLoop()
- func (this *Blockchain) Stop()
- func (this *Blockchain) StoredKeys() int
- func (this *Blockchain) Sync()
- func (this *Blockchain) Synced() bool
- func (this *Blockchain) TimeSinceLastBlock() int64
- func (this *Blockchain) UpdateUnspentTxOuts(block *Block)
- func (this *Blockchain) Wait()
- func (this *Blockchain) WaitingTransactionCount() int
- func (this *Blockchain) Wallets() map[string]*Wallet
- type BlockchainOptions
- type HistoryTx
- type Stamp
- type Stats
- type Transaction
- type TxIn
- type TxOut
- type UnspentTxOut
- type Wallet
Constants ¶
View Source
const ( COMMAND_CUSTOM_GET_INFO = iota COMMAND_CUSTOM_NEW_TRANSACTION COMMAND_CUSTOM_NEW_BLOCK )
View Source
const ( HASH_SIZE = 256 BUCKET_SIZE = HASH_SIZE / 8 )
Variables ¶
View Source
var EXPECTED_10_BLOCKS_TIME int64 = 600
Functions ¶
func GetWallets ¶
func GetWallets(bc *Blockchain) error
func HasDoubleSpend ¶
func HasDoubleSpend(transactions []Transaction) bool
func LoadUnspent ¶
func LoadUnspent(bc *Blockchain) error
func NewRandomHash ¶
func NewRandomHash() []byte
func SanitizePubKey ¶
func SetupStorage ¶
func SetupStorage(bc *Blockchain) error
func StoreLastHeaders ¶
func StoreLastHeaders(bc *Blockchain) error
func StoreUnspent ¶
func StoreUnspent(bc *Blockchain) error
Types ¶
type Block ¶
type Block struct { Header BlockHeader Transactions []Transaction }
func NewBlock ¶
func NewBlock(bc *Blockchain) *Block
func OriginBlock ¶
func OriginBlock(bc *Blockchain) *Block
func (*Block) Verify ¶
func (this *Block) Verify(bc *Blockchain) bool
func (*Block) VerifyOld ¶
func (this *Block) VerifyOld(bc *Blockchain) bool
type BlockHeader ¶
type Blockchain ¶
func New ¶
func New(options BlockchainOptions) *Blockchain
func (*Blockchain) AddBlock ¶
func (this *Blockchain) AddBlock(block *Block) bool
func (*Blockchain) AddTransationToWaiting ¶
func (this *Blockchain) AddTransationToWaiting(tx *Transaction) bool
func (*Blockchain) AreHeadersGood ¶
func (this *Blockchain) AreHeadersGood() bool
func (*Blockchain) BlocksHeight ¶
func (this *Blockchain) BlocksHeight() int64
func (*Blockchain) Difficulty ¶
func (this *Blockchain) Difficulty() int64
func (*Blockchain) Dispatch ¶
func (this *Blockchain) Dispatch(cmd *dht.Custom) interface{}
func (*Blockchain) GetAvailableFunds ¶
func (this *Blockchain) GetAvailableFunds(wallet []byte) int
func (*Blockchain) GetConnectedNodesNb ¶
func (this *Blockchain) GetConnectedNodesNb() int
func (*Blockchain) GetEnoughOwnUnspentOut ¶
func (this *Blockchain) GetEnoughOwnUnspentOut(value int) []UnspentTxOut
func (*Blockchain) GetInOutFromUnspent ¶
func (this *Blockchain) GetInOutFromUnspent(value int, destWallet []byte, outs []UnspentTxOut) ([]TxIn, []TxOut)
Used to create a transaction without loss
func (*Blockchain) GetOwnHistory ¶
func (this *Blockchain) GetOwnHistory() []HistoryTx
func (*Blockchain) GetOwnWaitingTx ¶
func (this *Blockchain) GetOwnWaitingTx() []HistoryTx
func (*Blockchain) Init ¶
func (this *Blockchain) Init()
func (*Blockchain) Logger ¶
func (this *Blockchain) Logger() *logging.Logger
func (*Blockchain) Mine ¶
func (this *Blockchain) Mine()
func (*Blockchain) NextDifficulty ¶
func (this *Blockchain) NextDifficulty() int64
func (*Blockchain) ProcessingTransactionCount ¶
func (this *Blockchain) ProcessingTransactionCount() int
func (*Blockchain) RemovePendingTransaction ¶
func (this *Blockchain) RemovePendingTransaction(insTx []Transaction)
func (*Blockchain) RemoveUnspentOut ¶
func (this *Blockchain) RemoveUnspentOut(wallet []byte, out *UnspentTxOut)
func (*Blockchain) Running ¶
func (this *Blockchain) Running() bool
func (*Blockchain) SendTo ¶
func (this *Blockchain) SendTo(value string) error
func (*Blockchain) ShowWallets ¶
func (this *Blockchain) ShowWallets()
func (*Blockchain) Start ¶
func (this *Blockchain) Start() error
func (*Blockchain) Stats ¶
func (this *Blockchain) Stats() *Stats
func (*Blockchain) StatsLoop ¶
func (this *Blockchain) StatsLoop()
func (*Blockchain) Stop ¶
func (this *Blockchain) Stop()
func (*Blockchain) StoredKeys ¶
func (this *Blockchain) StoredKeys() int
func (*Blockchain) Sync ¶
func (this *Blockchain) Sync()
func (*Blockchain) Synced ¶
func (this *Blockchain) Synced() bool
func (*Blockchain) TimeSinceLastBlock ¶
func (this *Blockchain) TimeSinceLastBlock() int64
func (*Blockchain) UpdateUnspentTxOuts ¶
func (this *Blockchain) UpdateUnspentTxOuts(block *Block)
func (*Blockchain) Wait ¶
func (this *Blockchain) Wait()
func (*Blockchain) WaitingTransactionCount ¶
func (this *Blockchain) WaitingTransactionCount() int
func (*Blockchain) Wallets ¶
func (this *Blockchain) Wallets() map[string]*Wallet
type BlockchainOptions ¶
type Stats ¶
type Transaction ¶
func NewCoinBaseTransaction ¶
func NewCoinBaseTransaction(bc *Blockchain) *Transaction
func NewTransaction ¶
func NewTransaction(value int, dest []byte, bc *Blockchain) *Transaction
func (*Transaction) Verify ¶
func (this *Transaction) Verify(bc *Blockchain) bool
Click to show internal directories.
Click to hide internal directories.