Internet has changed many things, and one of them is our way of seeing the money. It has gone from being something physical to be an intangible asset, a number on a page. We know it’s there because we trust the authority of banks, we believe in its value because we know that entities manage it as if it were physical and tangible money, but we cannot get it out of the air.
However, with Bitcoin, P2P currency booming, the matter is different. No entities in which trust. There is no bank that assures us “this money is true”. Instead, the validity of Bitcoin lies in its technology, in all techniques that ensure that functions as if it were a real currency. Let’s explain what that technology. It is a complex issue considerably, so first draw a simplified diagram of how it works and then we will be entering into the details, which are actually the most important and ensuring the validity of Bitcoin.
I said that Bitcoin technology is very complex, and we will use some technical terms as hash or digital signature. Before we start, let’s see what they are so that you can understand without problems we will talk. If you already know these terms, you can move to the next section.
- Hash: A hash of an object (a text string, a number or anything that can be represented in bits) is the equivalent of our fingerprint. It is a unique and constant identification. Two different objects have (theoretically) hashesdifferent. It also has the peculiarity that is a function “one – way”. That is, if you have the object is very easy to get your hash. However, if you have the hash it is extremely difficult to obtain the original object from which it comes. For Bitcoin, it is SHA256 algorithm.
- Digital signature: It is a process that allows anyone to verify the originality of an object. Similar to when you put your signature on a document, the digital signature certifies that you who have created, verified, or accepted that object. For this, two keys, one public and one private are used. The private key is “combined” with the message to be signed and the signature is obtained. Then, to verify the signature is “combining” public key of the signer with the signature, which should result in the original message. Bitcoin uses ECDSA, elliptic curve digital signature, also a very secure algorithm.
Transactions and blocks, the pillars of Bitcoin
Bitcoin is based on two pillars: one is the transaction, and another block. The transaction is, as you may have guessed, sending bitcoins from one user to another.
A transaction has inputs and outputs: where the money comes from and where it goes. Your ID (identification) is a hash combo ticket ID and the ID of the recipient (public key). Thus fixed unequivocally who the recipient and where did they come currencies. Then, the ID is signed with the private key of the issuer of the transfer, leaving certificate that money has transferred its owner.
Transfers are grouped into blocks. Each block also has a time stamp, a number of verification (see later what it is) and the ID of the previous block. Thus, a chain block, which contains the entire history of transfers of bitcoins is generated.
The blocks are generated by miners, and before creating them check the validity of all transfers (i.e. a user would not have spent money already transferred). A transfer that has been left out of the chain block is invalid, and likewise a transfer within the chain is considered valid without further operations.
When a node generates a block issues it to other nodes. These verify that the block is built correctly and that their transfers are valid. If there is no problem, they will begin to work with the new block as the end of the chain.
It is possible that at a given moment have two branches of the chain: a node has issued a block and at the same time another node has issued a different block. In this case, the two branches are retained until one of them is longer: this will be to stay, and the other is discarded.
The creation of the block chain: proof-of-work
The above approach would have no problem if all nodes that are creating blocks were honest. But we all know that’s impossible. As we have explained the creation of blocks, a malicious node could create a block with an invalid transfer (money that has been spent twice) and then generate more blocks in bulk.
When generating valid blocks quickly, the invalid transfer is buried in the chain. When the remaining nodes receive this chain, which will be the longest of the entire environment, verify as much the last block, the branch will be valid and the invalid transaction go unnoticed.
Therefore, we must implement a method that prevents blocks can be generated indiscriminately, something that requires nodes to invest time in generating the block. This is known as proof-of-work.
The job is to find the nonce, the number of verification we mentioned earlier, so that the hash of the block is less than a certain value (target or target). The search for that number is trial and error: we started at zero and calculate the hash. If the target is less than perfect, we found it. If not, we increase by one the nonce and re-verify. To give you an idea of the work involved with the target current probability of finding a nonce valid is one among 2 10 to 16 (one two followed by sixteen zeros).
You may also like to read another article on iMindsoft: How to Use a Credit Card to chargeback
The target value is chosen such that it takes about 10 minutes to generate a block. This time to remain tight recalculates every 2016 blocks: nodes pick up the time it took to generate those blocks and compared with the theoretical time it should have taken (approximately 2 weeks) and the target is reset. Thus, it is achieved that the generation time of a block to remain stable over time regardless of the processing capacity of the nodes.
Those 10 minutes it takes to check each block are the barrier that prevents attackers take control of Bitcoin. Thus, they cannot generate blocks quickly to hide transactions and spend money twice.
How to store any transaction history?
Next problem that we are in Bitcoin: The storage space. How can we save the entire block chain (which is considerably longer) without wasting disk space?
Recall that, to verify a transaction, we need to check that entries coins have already been verified. Typically, customers checked several transactions back and consider the rest are valid.
That is, we need a way to store and check transactions that are in the blocks. As mentioned earlier, each block contains the combined hash of transfers: check then it is as simple as picking the hash to verify the transfer, combine it with the rest of hashes block transfers and check having the same output.
But this approach has a problem: we keep many transfers that do not serve us all. For example, suppose that in a block, has spent money and verified all transfers except one. We will not need the rest to verify anything because we will not get so deep in the chain. However, we must keep them to verify that the transfer has not been worn, the hash remains the same.
The solution is to use a tree of hashes or Merkle tree. Hashes of transfers are combining two to two in the form of binary tree (each node has two children), as you can see in the figure. So when we do not need two brothers (two nodes that share the same father), we can delete them and stay with the parent node without losing the ability to check all other nodes of the tree. This greatly reduces the need to store whole story space, and in fact allows us to keep only the most recent transfers and forget the rest.
Mining: generating currencies
Bitcoin is a currency without a central entity to control inflation or introducing more money into the market. Therefore, again it has to rely on technique to control this aspect: the mining of coins.
When a node creates a block, plus all transfers verified includes another: a transfer without tickets. Each time a block is verified; new coins are introduced into the system. The rate at which new release is controlled bitcoins is such that every 4 years is reduced by 50%. Thus, it is estimated that the number of bitcoins in circulation never go out of 21 million.
This is an incentive for network nodes: the more blocks verify, more bitcoins win. Furthermore, this approach in many cases is more cost effective than honest malicious node (a node that enables double spending bitcoins). It also allows control the appearance of “scarcity” that arose yesterday Alejandro as a requirement to consider Bitcoin as a currency.
In short, Bitcoin has a considerably complex technology behind, and guarantees that can be used as currency : without anyone to create money for good, ensuring that you can only spend your money once and not reused, and controlling the introduction of new coins in the market. In addition, by relying on safe technologies (SHA256, ECDSA) it seems difficult (not I daresay nothing in any sense) that is vulnerable.