This protocol describes block chain systems & rules of kokonut.
{
"version":4,
"index":1,
"previousHash":"00000000000000000000000000000000000000000000000061bdff5e59b8ff4c",
"timestamp":1724547179867,
"data": {
"reward":16.230218,
"miner":"6c60b7550766d5ae24ccc3327f0e47fbaa51e599172795bb9ad06ac82784a92d",
"transactions":[],
"comment":"kokonut version 4"
},
"difficulty":6,
"nonce":1502929,
"hash":"000000f31571551dacab93769546843d2ef483fd0d26181fe8950de617b919ec"}
It is called genesis block which follows below :
{
"version":4,
"index":0,
"previousHash":"0",
"timestamp":1725108420520,
"data":{
"reward":0.0,
"ticker":"KNT",
"miner":"0000000000000000000000000000000000000000000000000000000000000000",
"transactions":[],
"comment":"Navigate beyond computing oceans"
},
"difficulty":0,
"nonce":0,
"hash":"000000000000000000000000000000000000000000000000190282d71244ac7a"
}
fun calculateHash(): String {
val input = "$version$index$previousHash$timestamp$data$difficulty$nonce"
hash = MessageDigest.getInstance("SHA-256")
.digest(input.toByteArray())
.fold("") { str, it -> str + "%02x".format(it) }
return hash
}