Wakacoin Developer
 

Wakacoin Blockchain

The block chain provides a public ledger of Wakacoin, an ordered and timestamped record of transactions. This system is used to protect against double spending and modification of previous transaction records.

Each node in the Wakacoin network independently stores a block chain containing only blocks validated by that node. When several nodes all have the same blocks in their block chain, they are considered to be in consensus. The validation rules these nodes follow to maintain consensus are called consensus rules.


Block

type Block struct {
	Header       *BlockHeader
	Transactions []*Transaction
}

Block Header

type BlockHeader struct {
	Version    uint32
	PrevBlock  [32]byte
	MerkleRoot [32]byte
	Timestamp  int64
	Difficulty uint8
	Nonce      uint64
}

Transaction

type Transaction struct {
	ID      [32]byte
	Version uint32
	Vin     []TXInput
	Vout    []TXOutput
}

TXInput

type TXInput struct {
	Block     [32]byte
	Txid      [32]byte
	Index     int8
	Signature []byte
	PubKey    []byte
}

TXOutput

type TXOutput struct {
	Value      uint32
	PubKeyHash [20]byte
}

Wakacoin Blockchain Structure

Wakacoin Blockchain Structure

Command-Line Interface

printchain -page PAGE - Print all the blocks of the blockchain by PAGE

printransaction -blockid BLOCKID -txid TXID - Print the transaction of the block

printxsbucket - Print all the transactions in the txsBucket

reindexutxo - Rebuilds the UTXO set

startnode -miner ADDRESS - Start a node with ID specified in NODE_ID env. var. -miner enables mining

statistic - The statistic of the blockchain

validate - Validate the blockchain