Educational crypto related posts.

Bitcoin mining hardware evolution

When extracting gold you can you can use a pickaxel, since gold is a very profitable business many people and companies are interested in gold extraction so big companies started implementing high-tech equipment. While an amateur gold miner would find and earn half a gram of gold, a full equipped gold mining company would extract a lot more. Similar situation happens in cryptocurrency mining.

When Bitcoin first started it could be mined with a traditional laptop or PC. This is called CPU Mining (central processing unit). CPU is the part of the computer that performs the will of the software loaded.

CPU Mining

Lately someone discovered that he could use the power of his graphic card to mine Bitcoin. GPU Mining started. The graphics processing unit is a part of the video rendering system of the computer, this has the function of assisting with the rendering of 3D graphics and visual effects so the CPU doesn’t have to. This made CPU Mining economically unwise since the hashrate of the network augmented so much that the cost of the Bitcoins produced by CPU mining became lower than the cost of power it used. The user who discovered this is Artforz, a regular on #bitcoin-dev. A very interesting individual in Bitcoin history, someone who appeared out of nowhere but who understood a lot about Bitcoin and how to tweak mining hardware performance.
On December 2009 Satoshi Nakamoto warned about GPU Mining:

We should have a gentleman’s agreement to postpone the GPU arms race as long as we can for the good of the network. It’s much easier to get new users up to speed if they don’t have to worry about GPU drivers and compatibility. It’s nice how anyone with just a CPU can compete fairly equally right now.”in

Next step was FPGA, a user-programmable gate array which consumed less power. With FPGA Bitcoin went from hobby to industry. The FPGA is an integrated circuit designed to be configured by a customer or a designer after manufacturing.

Then BitSynCom LLC manufactured the first specialized chip for bitcoin mining, called Avalon ASIC – Application-Specific Integrated Circuit, game changer. ASIC chip performs strictly limited functions, , as it improves performance and energy efficiency of mining. The largest miners have their own warehouses filled with ASICs, or combine their computing powers with other miners into mining pools.

Antminer S9

New versions of ASIC appear constantly. One of the latest is Antminer S9 manufactured by Bitmain. It uses 0.1 Joules per Gigahash, making it really efficient. The total power consumption of the device works out to around 1350 watts with a variance of 7%

Bitcoin Mining: Understand what this process is about

Bitcoin mining it’s a descentralized computational process that serves 2 purposes: to confirm transactions in a trustful manner when enough computational power (effort) is devoted to the block, and to find new Bitcoins in each block.

What bitcoin mining is

What is a block?

A block is where the transaction data of the Bitcoin network is recorded. Each block contains a record of some or all recent transactions and a reference to the block that came before. It also contains an answer to a difficult-to-solve mathematical puzzle which is unique to each block. This new blocks cannot be submitted to the network (Blockchain) without the correct answer, the miners compete to be the next to find the answer that “solves” the current block.
There is a reward of brand new Bitcoins for solving each block, every block contains a record of Bitcoin addresses entitled to receive the reward. This record is known as a generation transaction or coinbase transaction and it is always the first transaction appearing in every block. Miners also get incentive to include transactions in their blocks because of the attached transtaction fees.
The number of Bitcoins generated per block started at 50 and is halved to half every 210,000 blocks which would be every 4 years.

Bitcoin reward halving

The network adjusts the difficulty of the mathematical problem automatically, such that it targets a goal of solving an average of 6 blocks per hour. Every 2016 blocks (solved in about two weeks), the Bitcoin network compare the actual number of blocks created with the goal and modify the target by the percentage that it varied. The network comes to a consensus and automatically increases or decreases the difficulty of generating blocks.

What is a block header in Bitcoin?

The main way of identifying a block in the blockchain is via its block header hash.
The block header hash is calculated by running the block header through the SHA256 algorithm twice.
A block header hash is not sent through the network but instead is calculated by each node as part of the verification process of each block.
The block header data is shown in the table below.

Block anatomy

The Bitcoin version number is used to keep track of upgrades and changes in the protocol. The previous block header hash is the linkage into the previous block and secures the chain.
The timestamp is the number of seconds since the first of January 1970 and the difficulty target of the block is the number of zeroes that must be found when hashing the block header in order to meet the required level of proof of work to maintain the block time at 10 minutes.
The nonce is the value that is altered by the miners to try different permutations to archieve the difficulty level required – the nonce has been appended by the extra nonce function which sits in the coinbase transaction – or the first transaction of the Merkle root signifying who to pay the block reward to – an extra counter to add permutations to as the nonce number can be used well within a second by mining equipment.

What is Proof-of-Work?

It’s a method to ensure that the information (this would be the new block) was difficult enough to be made (costly, time-consuming). For more information click here.

Proof of work in Bitcoin

How does a Bitcoin node verify a transaction?

A node will look at a transaction as it arrives and then run a series of checks to verify it.
Each node builds its own transaction pool, which are mostly the same.
The conditions can change and evolve over time and a present list can be checked through the AcceptToMemoryPool, CheckTransaction and Checkinputs functions in the Bitcoin client.

1. Transactions syntax and data structure are correct.
2. Input and outputs have values.
3. Transaction is less than the block size of 1 MB.
4. Values must be more than 0 and less than 21 million.
5. None of the inputs have a hash that is equal to 0.
6. Locktime is less than the maximum allowed number.
7. Transaction size is greater than or equal to 100 bytes.
8. Number of signatures is less than the signatute limit.
9. Unlocking script can only push numbers onto the stack.
10. Locking script must match isstandard format.
11. A matching transaction must exist.
12. If a transaction is missing move the transaction to the orphan transaction pool.
13. If the transaction is a coinbase transaction then it must have a maturity of 100 confirmations.
14. For each input the output must exist and not have been spent.
15. Check that each input value is in the required range.
16. Reject if the input value is less than the output value.
17. Reject if the transaction value is to low to get into an empty block.
18. Unlocking scripts for each input must be verified against the output locking scripts.

Register in and start mining!