Have you read this? It is sort of technical, and goes into
How is difficulty calculated? and
How is difficulty stored in blocks?
re your comment about nonces: The nonce is not the difficulty. In the example below, I'm trying to find a sha256 that starts with 0. On my imaginary blockchain, a proof-of-work that starts with a single 0 is good enough. Notice that I don't change anything but the number after
foo. The number after foo can be thought of as the nonce. It's just some thing I change to get a new proof-of-work.
[I] ➜ ~ echo -n "foo" | shasum -a 256
[I] ➜ ~ echo -n "foo1" | shasum -a 256
[I] ➜ ~ echo -n "foo2" | shasum -a 256
[I] ➜ ~ echo -n "foo19" | shasum -a 256
06651ba147df6422edcd47690fd3d68795bc59636f37f10b67a94fa70fe1fdbb - yay
Compare that with miners on the bitcoin blockchain. Currently they have to find a sha256 hash that starts with 19 0's. e.g: