Search code examples
blockchainbitcoincryptocurrency

How should i start learning code of any cryptocurrency?


I want to learn about the code of cryptocurrency with all it's features including POS and master node features, currently I have XSN code (stake-net coin) and i want to learn it so i can make use of it to learn different features of blockchain. There is no purpose to clone it or anything. How should i start learning it? I mean from which file should i start learning the code. I have learned basics of c++ but unfortunately I'm not that much good with c++. So from which file should i start learning it there is a lot .cpp and header files. Is there any one can had the same experience learning it?


Solution

  • Well, you should not start learning by looking at someone else's source code. The only real way to learn about blockchain programming is to take isolated problems and try to implement it yourself in minimum examples.

    You can start by coding each one of them separately in its own example application:

    • Blockchain data structures and their serialisation (network / disk)
    • Storing block data into rolling binary blob file on disk containing the serialised blocks, while at the same time having some sort of indexed database for looking up block hashes and getting their disk-position of the block when a block needs to be "loaded" into memory.
    • P2P networking component, where you organise your unstructured P2P environment under the premise that most nodes will have a limit on inbound socket connection or be behind a NAT
    • In the same context you can dig into asynchronous network programming and how to properly do it with select() / epoll()
    • Proof of work scaling mechanism, which comes up with a hash target value depending on the time that was needed for the last X blocks
    • "Dominating chain" connector, where the "predominant" chain gets selected out of many multiple chain candidates (forking)

    When you are done understanding these first simple building blocks, you can think about the next step; the actual functions of the Blockchain like maintaining balances and transferring coins.