[howto] A blockchain from scratch

in altcoin •  6 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

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

That starts interesting, let it roll :)