What are the statistical methods used when calculating the transaction fee? Is there a document showing how the transaction fee is calculated? I want to examine it.
There are different methods that can be used to calculate the transaction fee. There is not just one method used.
The code and comments here:
https://github.com/bitcoin/bitcoin/blob/f646275b90b1de93bc62b4c4d045d75ac0b96eee/src/policy/fees.cpp#L78 describe what Bitcoin Core does to estimate fees. However not all places will use the same methodology.
Yes. What their actual algorithm is, I do not know.
Could you explain these blocks a little more?
As far as I know, miners receive 12.5 BTC awards per block. How do miners find the blocks?
I highly suggest that you do some research into how Bitcoin works. The developer documentation at bitcoin.org here:
https://bitcoin.org/en/developer-documentation is a good place for this detailed information.
A block is a data structure that contains transactions. Miners select the transactions that they want to include in a block by examining their own mempool. Typically they choose the transactions with the highest fees. Then the miners hash all of the transactions together to create a merkle root, the hash of all of the transactions. Then they build an 80-byte block header as described here:
https://bitcoin.org/en/developer-reference#block-headers. The block header has fields that can change such as the timestamp, the merkle root, and the nonce. What the miner then does is he hashes the block header and compares it to the current network target. The comparison is done by treating the hash and the target as large integers, not as strings. If the hash is less than the target, he sends the block to the network. If it is not, he changes one of the fields that can be changed (e.g. increments the nonce) and tries again. This is done until a hash that is less than the target is found.
The miner makes money because the very first transaction in the block (known as the coinbase transaction) contains no inputs and just outputs whose values add up to the block subsidy (currently 12.5 BTC) and all of the transaction fees paid by the transactions in his block.
I would like to learn about these input and output parameters. What input fields do these input parameters correspond to in my wallet?
My wallet fields has Pay to, Description, Amount, Fee sections. Is "180bytes per input" the sum of these input values in my wallet?
I highly suggest that you read the developer documentation I linked above. The raw transaction format is described here:
https://bitcoin.org/en/developer-reference#raw-transaction-formatThe transaction input contains nothing that you see in your wallet. It is actually a reference to the transaction output you are spending from (chosen by your wallet unless you do advanced stuff) and an input script. The transaction is valid when the scripts are validated and result in a non-zero stack or "True". This validation is done by appending the output script of the output you are spending from and the input script of your input. Then the script is evaluated command by command and once it is done, the stack is examined to check for non-zero or "True". If it is, it passes and the transaction is valid.
The input script of a transaction spending from '1...' addresses just contains a signature signing the hash of the spending transaction and the public key that maps to your address.
The 180 bytes thing is actually incorrect. The actual value is usually around 146 bytes because public keys are smaller now than before. This size is because the reference to the previous transaction is 36 bytes, and the script is ~106 bytes but can vary, and ~5 additional bytes of overhead (size parameter for script, and sequence number). 36+105+5=146 bytes.
When you spend Bitcoin, you spend from previous transaction outputs that become the inputs I just described. Each output becomes one input, they are not all aggregated together into one input. This means that if you spend from a lot of outputs (e.g. a lot of small outputs from faucet payouts) then you will end up having a lot of inputs and thus your transaction will increase in size.