https://www.luno.com/blog/en/post/bitcoins-hash-rate-is-hitting-record-highs-but-does-it-even-matter
https://www.baeldung.com/java-blockchain
https://medium.com/programmers-blockchain/create-simple-blockchain-java-tutorial-from-scratch-6eeed3cb03fa
My Simple Pseudo BLock Chain in JavaScript
class Block {
constructor(index, timestamp, data, prevHash = '') {
this.index = index;
this.timestamp = timestamp;
this.data = data;
this.prevHash = prevHash;
this.hash = this.calculateHash();
}
calculateHash(){
return 'need to calc the hash';
}
}
class Blockchain{
constructor(){
this.chain = [this.createGenesisBlock()];
}
createGenesisBlock(){
return new Block(0, "09/01/2021", "Genesis block", "0");
}
getLatestBlock(){
return this.chain[this.chain.length - 1];
}
addBlock(newBlock){
newBlock.prevHash = this.getLatestBlock().hash;
newBlock.hash = newBlock.calculateHash();
this.chain.push(newBlock);
}
}
let myCoin = new Blockchain();
myCoin.addBlock(new Block(1, "09/20/2021", {amount: 4}));
myCoin.addBlock(new Block(2, "09/27/2021", {amount: 5}));
console.log(JSON.stringify(myCoin, null, 4));
Console output:
{
"chain": [
{
"index": 0,
"timestamp": "09/01/2021",
"data": "Genesis block",
"prevHash": "0",
"hash": "need to calc the hash"
},
{
"index": 1,
"timestamp": "09/20/2021",
"data": {
"amount": 4
},
"prevHash": "need to calc the hash",
"hash": "need to calc the hash"
},
{
"index": 2,
"timestamp": "09/27/2021",
"data": {
"amount": 5
},
"prevHash": "need to calc the hash",
"hash": "need to calc the hash"
}
]
}
}
This pseudo block chain is missing the nonce, which is what gets the block's hash to start with appropriate number of leading zeros.
Gambling in Vegas Is a Profitable Casino
ReplyDeleteHere are 과천 출장마사지 some 강릉 출장마사지 gambling facts that could help you 김해 출장샵 make better 구미 출장안마 gambling decisions online. Gambling in Vegas casinos is illegal. If you Jul 1, 2015 · Uploaded by MGM 영천 출장안마