Documentation ¶
Index ¶
- Variables
- func HandleBCmessage(s core.Server, conn net.Conn)
- func HashSha256(tohash []byte) string
- func IsBlockValid(newBlock, oldBlock Block) (bool, error)
- func ProcessTx(Tx Transaction) bool
- func ReadyToValidate(s core.Server, conn net.Conn)
- func StdAddListeners(s core.Server)
- func StdBCServer(sc core.ServerConfig) core.Server
- func StdReciveMessage(s core.Server, conn net.Conn) error
- func Validate(s core.Server)
- type Block
- type Chain
- type Transaction
- type TxIn
- type TxOut
Constants ¶
This section is empty.
Variables ¶
View Source
var TxsQueue struct { sync.RWMutex Txs []Transaction }
Functions ¶
func HandleBCmessage ¶
HandleBCmessage : recive bc messages and answer them
func HashSha256 ¶
HashSha256 : returns the hash of a slice of bytes
func IsBlockValid ¶
IsBlockValid : check if block is valid
func ProcessTx ¶
func ProcessTx(Tx Transaction) bool
func StdAddListeners ¶
StdAddListeners : add the standard listeners to the server NEW CONNECTION NEW DOSCONNECTION
func StdBCServer ¶
func StdBCServer(sc core.ServerConfig) core.Server
StdBCServer : create a standard server
func StdReciveMessage ¶
StdReciveMessage : Standard function to recive messages
Types ¶
type Block ¶
type Block struct { Index int Timestamp string Transactions []Transaction Hash string PrevHash string }
Block : struct of a blockchan block
func GenerateBlock ¶
func GenerateBlock(oldBlock Block, txs []Transaction) (Block, error)
GenerateBlock : generate a new block from an old block and some txs
func GenerateGenesisBlock ¶
GenerateGenesisBlock : generate a genesis block
func (*Block) CalculateHash ¶
CalculateHash : calcumate has of the block
type Chain ¶
type Chain interface { Get() []Block GetBlock(int) (Block, error) Replace(Chain) bool Append(Block) bool Lock() RLock() Unlock() RUnlock() }
Chain type for chain and methods
type Transaction ¶
Transaction : struct of a blockchain transaction
Click to show internal directories.
Click to hide internal directories.