Risk warning: Trading is risky. Your capital is at risk. Exinity Limited is regulated by FSC (Mauritius).
Risk warning: Trading is risky. Your capital is at risk. Exinity Limited is regulated by FSC (Mauritius).

Blockchains: Mining for bitcoins

Blockchains: Mining for bitcoins

About the Author: Andreas Thalassinos (BSc, MSc, MSTA, CFTe, MFTA), Head of Education at FXTM. Highly respected FX educator and Certified Technical Analyst and an authority in algorithmic trading.

Learn Forex Trading

Blockchain technology is at the heart of cryptocurrencies, including the most famous one of all - bitcoin. In its simplest form, a blockchain consists of blocks of information. Each block contains: transactions (in the case of bitcoin, the amounts being transferred), the time it was created, a digital signature that is unique to its contents, and a code that links it to the previous block. So, in a nutshell, blockchain is a sequence of blocks linked together, creating a chain of blocks.

Building Blocks

In its entirety, a blockchain consists of every transaction that occurred since the beginning of bitcoin, starting with the very first block known as Genesis.

As illustrated in the example above (which has been simplified to contain only one transaction per block), if Alice wanted to send 1 Bitcoin to Bob, a new block would be created to record the relevant information. A block number (in this case, 15) would be assigned to the transaction itself, as well as a link to the previous block (0000abxf6h12gh) and a digital signature (00008cnj21lxt3jh) that is unique to the entire content of the block.

Digital Signature

The digital signature is the result of a mathematical function (or cryptographic hash algorithm), known as SHA-256 or double SHA-256, to be more precise (for more details, read the Bitcoin Keys and Addresses article). The SHA-256 accepts a file of data, runs a cryptographic algorithm on this data, and generates an output of 64 alphanumeric characters known as the digital signature. The length of this code is always 64 alphanumeric characters, no matter what the length of the received data file is.

Interestingly, if just one letter or number is changed in the data, then the SHA-256 algorithm will produce a completely different signature. Also note that each digital signature begins with 4 zeroes.

Now, if Bob was to try and “fool” the system by changing the amount of bitcoins he received from Alice from 1 to 100, then the corresponding digital signature would change as well, including all the previous signatures since the beginning of time. In other words, it would be impossible for Bob to do this:

Block Header – the main identifier of any given block in a blockchain.

Contents of a Block Header

Version

The latest version of the blockchain, for ex: v20000000

Hash of Previous Block Header

A link to the previous block – for ex: 0000abxf6h12gh

Hash of Merkle Root

The summary of all transactions in the block in encrypted form

Timestamp

The time when the block was created

Target

A 256-bit number

Nonce

A number to calculate the correct digital signature of the block header

Once the transactions are validated by the nodes (i.e. computers in the Bitcoin network), they are selected (or confirmed) for inclusion in the block and the process of mining begins. It is a race against time where the fittest and luckiest nodes will win.

Bitcoin Mining

In order to mine bitcoin you need to download software and purchase a purpose-built computer. In terms of software, there are a number of options, the most popular being: CGminer, BFGminer, BitMinter, and BTCMiner. A Miner, or group of miners, aim to calculate a hash of the block that is equal to or less than the specified target. As long as all information in the block header remains constant, the result of SHA-256 will always be the same. That’s why the nonce is included (in cryptography, a nonce is an arbitrary number that can only be used once). Every time the calculated hash of the block header fails to meet the targeted range, this number is increased and the hash is re-calculated until it reaches the specified target.

The miner that is equipped with the most powerful and fastest computing devices will have an advantage in reaching their target first. Though power and speed are important in mining, another decisive factor is luck! Since there is no logic when calculating the winning hash, the longest route of brute force should be followed. Brute force is an exhaustive search technique that enumerates all possible answers until the correct one is reached. The number of answers to be calculated is close to 1077, which requires a lot of calculating power and speed.

Once the winning targeted hash is calculated, the block is included in the blockchain and the reward (which is, at the time of writing, 12.5 bitcoins) is granted to the victorious miner. Currently, a block is included in the blockchain every 10 or so minutes and a single block may contain approximately 1,000 transactions.

Conclusion

Once a block is included in the blockchain, it becomes permanent and irreversible. All nodes (computers) in the network keep a copy of this decentralized ledger. When new nodes join the network, another copy of the blockchain or ledger is downloaded. If anyone attempts to change a piece of information in a block, even if it’s as small as 1 bit, then it is inevitable that he or she will have to recalculate all block hashes since genesis. This is close to impossible with today’s technology. Even if, for the sake of argument, that would be possible, this new fraudulent chain would be rejected as long as the majority of the nodes are honest. The blockchain that is accepted by a majority of the nodes always has the majority of the approvals from other nodes (i.e. proof-of-work).

Previous bitcoin articles:

The Origins of the Digital Currency: A Beginning of a Long New Road

Uncovering Bitcoin Transactions: How they Work

Bitcoin Keys and Addresses: What you need to know

Disclaimer: This written/visual material is comprised of personal opinions and ideas. The content should not be construed as containing any type of investment advice and/or a solicitation for any transactions. It does not imply an obligation to purchase investment services, nor does it guarantee or predict future performance. FXTM, its affiliates, agents, directors, officers or employees do not guarantee the accuracy, validity, timeliness or completeness of any information or data made available and assume no liability for any loss arising from any investment based on the same.

Risk Warning: There is a high level of risk involved with trading leveraged products such as forex and CFDs. You should not risk more than you can afford to lose, it is possible that you may lose more than your initial investment. You should not trade unless you fully understand the true extent of your exposure to the risk of loss. When trading, you must always take into consideration your level of experience. If the risks involved seem unclear to you, please seek independent financial advice.

Scroll Top