How to set up a private chain/local testnet : reverse engineering the blockchain code Long story short, I want to set up a private chain/a testnet blockchain that can run locally just to fiddle and play with it just to learn how it works. So I have a general understanding of how things work and thought that to really learn I would need to reverse engineer and play with it as much as I can.

So, how would I go about that?
What I am looking for is ideally a step by step clear, beginner friendly explanation because I am aiming at blockchains written in javascript (lisk, nimiq) or, in python(bismuth)

Let me first tell you what I thought of or, what I think concerning ways to do that. I imagine I would have to:


Decide which existing blockchain would resemble the most with what I have in mind regarding the consensus algorithm 
Download it from GitHub 
Establish a dev environment 
Run different tests and let my brain do its magic


Now with regards to those steps, I have few questions:


Am I missing something like an intermediary step let’s say?
Regarding step 1 where should I look, what parts of a blockchain will be the deciding factors for me choosing one over the other say considering that I want to introduce a new consensus algorithm?
Regarding step 2, how would I download a blockchain but ignore the transaction history (this will be a new altcoin starting with genesis block) or is that more like something I change within the code not sure?
Regarding step 3, this is where I would appreciate a step by step response since I have no idea what to download and what steps to take to get from: "I have the code" stage to "I can play with it and test different things" stage.
Regarding step 4: except deleting part of the code, changing variables value, switch order or lines what else could help me to understand better how the code works?


Thank you
The question slightly exceeds capabilities of this q&amp;a forum. Maybe better to search bitcointalk.org, there these type of requests get often discussed. Join one of the discussions there!

Anyhow, we need developers, and people with fresh minds. 
Here my short shot at bitcoin, because we are in bitcoin q&amp;a forum. You would probably want to create an altcoin of it. For sure the relevant info and link to the code is on bitcoin.org.

To accomplish your goals, you would have to have an idea and sometimes excessive knowledge on the following:

Information Security
Overview of current crypto coin technologies
Finite Fields
Elliptic Curves
Elliptic Curve Cryptography
Signing/Verifying Messages
Parsing Transactions
Signing Transactions
Creating Transactions
Script parsing and processing
Address construction/Private Key WIF Format Construction
Extended Keys (XPriv and XPub)
Parsing Blocks
Validating Proof-of-Work
Difficulty Calculations
Merkle Tree Construction 
Merkle Proofs
Network Message Parsing


and maybe 

Segwit
Lightning
Altcoin
... 


The list can be for sure extended :-) So you choose to go for a steep learning curve. From what I read in your message, I think you are not (yet) there, but that's not an issue. You will probably want to read books like Andreas' "Mastering Bitcoin", and some more. They will bring you up to speed.

If you think of on the environments (like Ethereum or IOTA), I doubt that many devs are here to support. 


  1) decide which existing blockchain would resemble the most with what
  i have in mind in terms of consensus algorithm


this is s.th. we can't help you with, as you haven't presented anything. Do you want to use the community's power &amp; efforts to bring your project forward, but don't provide input to the community by hiding your logic and ideas? In general: we are very curious here for new ideas :-)


  2) download if from github


see the links on bitcoin.org


  3) establish a dev environment


You take a linux machine, and install the software, compile it, and see how you go. Alternativly you can try your luck in other OS, but support is way better on unixoide systems. Also the usage of virtual machines is very attractive. 


  4) run different tests and let my brain do it’s magic


again, this is up to your mind howto. But there are testcases deliverd with the software, so you can find relevant code for it, adopt it to your requirements, and go.