inputs is the previous blockchain
This is incorrect.
The input is the block header of the new block.
You build a block header with the following 80 bytes of information:
- (4 bytes) version number
- (32 bytes) Double sha256 hash of the most recent block in your blockchain
- (32 bytes) Merkle root of transaction list
- (4 bytes) timestamp
- (4 bytes) encoded current difficulty
- (4 bytes) nonce
The Merkle root is calculated by choosing the transactions that you want to include in your block, arranging them in the order you want them and then generating a Merkle tree using the SHA256 hash function.
The nonce is simply incremented after each calculation until
one of the following has occurred:
- You've tried all possible nonce values, and you now need to either update your timestamp or generate a new Merkle Root
- You've received a valid block from a peer, and you now need to start the process over with a new double sha256 hash of the most recent block in your blockchain
- You find a valid solution, and you now need to broadcast it to your peers and start the process over with a new double sha256 hash of the most recent block in your blockchain
then some mathematical formulas
Specifically a
SHA256 hash of the header, followed by a SHA256 hash of that result (often called a double SHA256 hash).
https://en.wikipedia.org/wiki/SHA-2out put a new block
Specifically, broadcast the block to all the peer that are connected to you.