I have a super smart friend who I’m trying to nerd-snipe into getting interested in working on Bitcoin Core. My super sneaky plan is to point him to some particularly juicy parts of the codebase to try to pique his interests.
Does anyone have any favorite parts of the Bitcoin Core codebase? They could be particularly elegant, do something particularly impressive, or be particularly interesting theoretically. I’ll definitely also point him to libsecp256k1!
I like the EvalScript code in script/interpreter.cpp, it’s a simple stack based language that you can build your own interpreter for to learn how it works. Fun exercise!
That’s a great discussion! I’ll definitely link him there. Anything in the existing codebase, like a file or function, which is particularly interesting?
I find the most interesting parts are in validation.cpp. In particular, the re-org logic and rolling back ConectBlock/DisconnectBlock, AcceptBlock, AcceptBlockHeader.
There are several interesting cases around DoS preventions in mempool related functions. Basically, what happens when there is new block in validation.cpp. There is also an integration test in python feature_block.py that tests lots of interesting scenarios hitting codepaths in validation.cpp.
Second, interpreter.cpp and scripting engine. miniscript.cpp is also is an interesting dive in itself.
Yes, the function would be BlockAssembler::addPackageTxs, which is the transaction selection algorithm for the next block in the chain, taking the presumed best transactions from the mempool.