Documentation ¶
Index ¶
- Constants
- func GeneratePrivKeyForNode(randseed int64) (crypto.PrivKey, error)
- func MineBlocks(bReceiver <-chan *Block, publisherTopic *pubsub.Topic)
- func PublickKeyToAddress(pubKey string) (string, error)
- func StartNode(port int, secio bool, randseed int64, connectAddr string) error
- type Block
- type Blockchain
- type ColorLogger
- func (c *ColorLogger) Error(v ...interface{})
- func (c *ColorLogger) Errorf(format string, v ...interface{})
- func (c *ColorLogger) Info(v ...interface{})
- func (c *ColorLogger) Infof(format string, v ...interface{})
- func (c *ColorLogger) Success(v ...interface{})
- func (c *ColorLogger) Successf(format string, v ...interface{})
- func (c *ColorLogger) Warn(v ...interface{})
- func (c *ColorLogger) Warnf(format string, v ...interface{})
- type Mempool
- type MyNotifiee
- type Transaction
- type UTXO
- type UTXOSet
Constants ¶
View Source
const ( Reset = "\033[0m" Red = "\033[31m" Green = "\033[32m" Yellow = "\033[33m" Blue = "\033[34m" )
Variables ¶
This section is empty.
Functions ¶
func MineBlocks ¶
func PublickKeyToAddress ¶
PublickKeyToAddress convert the base58-encoded public key pubkey to address
Types ¶
type Block ¶
type Block struct { Height int `json:"height"` TxData Transaction `json:"transaction_data"` Timestamps string `json:"timestamps"` Nonce int `json:"nonce"` Hash string `json:"hash"` PrevHash string `json:"prev_hash"` }
func NewBlock ¶
func NewBlock(tx Transaction) *Block
type Blockchain ¶
func NewBlockchain ¶
func NewBlockchain() *Blockchain
func (*Blockchain) AddBlock ¶
func (bc *Blockchain) AddBlock(b *Block)
type ColorLogger ¶
type ColorLogger struct {
// contains filtered or unexported fields
}
func NewColorLogger ¶
func NewColorLogger() *ColorLogger
func (*ColorLogger) Error ¶
func (c *ColorLogger) Error(v ...interface{})
func (*ColorLogger) Errorf ¶
func (c *ColorLogger) Errorf(format string, v ...interface{})
func (*ColorLogger) Info ¶
func (c *ColorLogger) Info(v ...interface{})
func (*ColorLogger) Infof ¶
func (c *ColorLogger) Infof(format string, v ...interface{})
func (*ColorLogger) Success ¶
func (c *ColorLogger) Success(v ...interface{})
func (*ColorLogger) Successf ¶
func (c *ColorLogger) Successf(format string, v ...interface{})
func (*ColorLogger) Warn ¶
func (c *ColorLogger) Warn(v ...interface{})
func (*ColorLogger) Warnf ¶
func (c *ColorLogger) Warnf(format string, v ...interface{})
type Mempool ¶
type Mempool struct {
// contains filtered or unexported fields
}
func NewMempool ¶
func NewMempool() *Mempool
func (*Mempool) AddTransaction ¶
func (m *Mempool) AddTransaction(tx *Transaction)
func (*Mempool) RemoveTransaction ¶
type MyNotifiee ¶
type MyNotifiee struct{}
func (*MyNotifiee) Connected ¶
func (n *MyNotifiee) Connected(net network.Network, conn network.Conn)
func (*MyNotifiee) Disconnected ¶
func (n *MyNotifiee) Disconnected(net network.Network, conn network.Conn)
func (*MyNotifiee) ListenClose ¶
func (n *MyNotifiee) ListenClose(net network.Network, addr ma.Multiaddr)
type Transaction ¶
type Transaction struct { TxID string `json:"trasaction_id"` Sender string `json:"sender"` Recipent string `json:"recipent"` Amount int `json:"amount"` Signature string `json:"signature"` Inputs []UTXO `json:"inputs"` Outputs []UTXO `json:"outputs"` }
func (*Transaction) Hash ¶
func (tx *Transaction) Hash() []byte
func (Transaction) String ¶
func (tx Transaction) String() string
Click to show internal directories.
Click to hide internal directories.