Why aren't public-private keys sufficient to build a block chain? Why do we need proof of work/stake? Taking the simple case of Bitcoin here:
If all nodes can validate published transactions by checking the signature (created using the private key of the sender) of the transaction against the public key of the sender, why isn't that sufficient to validate a block?
I understand that we also solve the puzzle of finding a nonce that when combined with a block's contents, gives us a hash that has N number of leading zeroes. Why do we need this at all? Isn't it enough to check the validity of each transaction in the block?
As for double spending, if a miner decides erroneously to include both transactions, nodes can see there isn't enough balance and reject such blocks. As for which transaction of the two to take, the code could have a way to order transactions and if an attacker decides to do the opposite intentionally and decides to spam the network (since there's no proof of work cost) but how does the attacker benefit from that?
Since Blockchain is a decentralized system, it has to stop malicious behaviour [which may just be disruptive if not benefiting the attacker directly] and collusion.
Proof of work achieves that by introducing a very large computational cost.
It also removes the burden on the nodes of checking transaction ordering. Also the code is running in parallel in multiple nodes so how is theany transaction ordering going to be universal without local copies being different?