Educational sample of minimal working mining code I would like if someone could point me to a minimal program source code that does solo minig on a CPU. (Can assume a running bitcoind/full node)
Something that in theory (obviously not in practice) would actually be able to mine a block from the live network. This is intended for educational purposes, not for profit. Good code structure is therefore more important than performance.
I think that these articles are great for educational purpose:
Bitcoin mining the hard way: the algorithms, protocols, and bytes
This article explains Bitcoin mining in details, right down to the hex data and network traffic. If you've ever wondered what really happens in Bitcoin mining, you've come to the right place.
http://www.righto.com/2014/02/bitcoin-mining-hard-way-algorithms.html

Mining Bitcoin with pencil and paper: 0.67 hashes per day
I decided to see how practical it would be to mine Bitcoin with pencil and paper. It turns out that the SHA-256 algorithm used for mining is pretty simple and can in fact be done by hand. Not surprisingly, the process is extremely slow compared to hardware mining and is entirely impractical. But performing the algorithm manually is a good way to understand exactly how it works.
http://www.righto.com/2014/09/mining-bitcoin-with-pencil-and-paper.html

The first one include also small programs in python that mines a block and connect to a mining pool stratum server.