[howto] A blockchain from scratch

in #altcoin6 years ago (edited)

Hello Folks,

With this post i will start develope a blockchain. 

Your needs:

  • interest in programming
  • some knowledge on c++
  • some knowledge on boost

What we will do:

  • create a blockchain
  • create a way to save data on it
  • setting up a network

This is not a job offer! =D It is a tutorial!

So lets get started.

The first thing we have to think about the block himself. Why think first about the block? Because this is all we build everything around. So what did our block need?

First of all each block needs a index to identify it later. Then we need the time when it was created. A timestamp of the unix  time is the best way. Then of course we need a row for the data to store in and the hash of the previous block and an own hash to make it a chain.

//block.h
#include <iostream>
#include <ctime>

class Block {
   int iIndex;
   std::time_t tTimestamp;
   byte[] bData
   std::string strHash;
   std::strng strPrevHash;
}

Ok thats all for today. On the next tutorial we will fill this block with some functions and create a chain from the blocks.

Stay tuned and interested =D

Sort:  

That starts interesting, let it roll :)

Coin Marketplace

STEEM 0.18
TRX 0.18
JST 0.034
BTC 89179.04
ETH 3123.84
USDT 1.00
SBD 2.74