Documentation ¶
Index ¶
- func HandleBCmessage(s core.Server, conn net.Conn)
- func HashSha256(tohash []byte) string
- func IsBlockValid(newBlock, oldBlock Block) (bool, error)
- func StdAddListeners(s core.Server)
- func StdBCServer(sc core.ServerConfig) core.Server
- func StdReciveMessage(s core.Server, conn net.Conn) error
- type Block
- type Transaction
- type TxIn
- type TxOut
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HandleBCmessage ¶
HandleBCmessage : recive bc messages and answer them
func HashSha256 ¶
HashSha256 : returns the hash of a slice of bytes
func IsBlockValid ¶
IsBlockValid : chech if block is valid
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
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 Transaction ¶
Transaction : struct of a blockchain transaction
Click to show internal directories.
Click to hide internal directories.