How and why difficulty and hashes protect the Bitcoin network.
If a user were to broadcast a transaction several times during the creation period of the same block, the second transaction would not go through because the miner would notice it and would not include the same funds being spent twice or more than twice.
Once a miner creates a block and the block becomes a part of the blockchain, the block is sealed and so if someone were to attempt to send money again in the future, the transaction, again, would not go through because there’s already a record on the blockchain about the funds being spent.
This is a simple explanation of how and why proof-of-work blockchains are so secure, but the security actually is much higher than that because there are several levels to it and this article explains why
For a transaction to become valid on the Bitcoin blockchain, it needs to get six confirmations from the network. A confirmation is an inclusion of the data about transaction into a block of the blockchain.
A miner picks up a transaction, includes it into a block of the blockchain and seals it with a winning hash. This is confirmation number one. This winning hash also becomes a part of the next block of the blockchain because this is how the blocks on the blockchain are connected to each other, via hashes. This means that now the record about the transaction is a part of two blocks of the blockchain. When the network finishes creating the subsequent block and it gets sealed with the hash from the previous block as a part of it, the transaction gets its second confirmations.
Simply speaking, six confirmations mean that to try and edit information about even one transaction, an attacker would need to change at least six blocks of the blockchain.
Today, this is practically impossible because an attacker would need not just to run operations to create new blocks, the attacker would also need dedicated hardware that is virtually impossible to find.
Hashrate and ASIC cards
An ASIC card is hardware that does only one thing, but does it really well. This one thing is the creation of hashes for a specific cryptography algorithm, which is why, for example, an ASIC card designed for the Bitcoin network will not work with the Ethereum network – the networks use different cryptography algorithms and a Bitcoin ASIC would be useless on the Ethereum network. The speed at which a piece of hardware can create hashes is called hashrate. The higher the hashrate, the faster the piece of hardware can be trying various hashes to come up with a winning one.
An ASIC card is a very expensive piece of equipment, yet it makes sense for miners to buy ASIC cards because they get rewards from cryptocurrency networks for compiling transactions into blocks of the blockchains.
At the same time, the fact that miners are buying ASIC cards and use them to get rewards from a network means that it is very unlikely that someone is buying ASIC cards and is currently not using them to mine coins, and is keeping them unused in hopes to perform an attack on the network in the future. The costs of doing so would probably be higher than the costs of an attack.
Not only is this unlikely, but the hashrate available to the attacker, will need to be bigger than the hashrate of the rest of the network, otherwise the network could keep creating the blocks faster than the attacker and the attacker would lose.
Another issue and layer of protection is that the value of ultra-specialized ASIC cards is intrinsically linked to the value of coins these cards are mining. In addition to this, miners buy all the expensive equipment and build mining rigs because they get rewards from the blockchains for creating new blocks.
Giving out rewards to miners is how many networks add coins to circulation.
For example, the Bitcoin network by design can only have twenty-one million bitcoins. For the first 210,000 blocks of the blockchain it was giving out 50 bitcoins per block as a reward to the miner to create one of the blocks. Then, the reward split in half and became 25 bitcoins for the next 210,000 blocks. The reward will keep splitting until the network reaches 21 million coins. To see how many coins the Bitcoin network has added to circulation as you are reading this article, how many coins it will add in the future and a lot of other interesting information, visit BitcoinHalfClock at http://www.bitcoinblockhalf.com/
This means several things. First, if you start buying ASIC cards with an attack in mind and are currently not using them on the blockchain network you are planning to attack, you are losing money that you could be earning today in a completely legitimate, 100% risk-free way.
For an attack to be profitable, either the value of the coin on the network needs to be high, such as Bitcoin, or the network needs to have a lot of users. In any case, the network needs to be popular. The biggest popular cryptocurrency networks by market capitalization have been around for a long time and are very secure.
For example, with Bitcoin many experts stopped even talking how much electricity it would take to attack the network and are now almost exclusively talking in terms of hashrate because with the existence of Bitcoin-specific ASIC cards, even if an attacker were to use a supercomputer to attack the network, the hash power of the supercomputer would be easily matched by a relatively small number of ASIC cards.
Also, miners on such networks are interested in the value of the coin staying high and would be not likely to support any attack.
Therefore, the choice of the attackers is: to be making money legitimately today or to try and risk tremendous sums of money to pull an attack that has very low chances of success.