Introdução ao Blockchain
Para entender o que é uma blockchain, você deve primeiro estar familiarizado com alguns termos básicos de criptomoeda; ou seja, as duas palavras raiz que compõem "blockchain".
Bloqueie. Conforme aplicado à criptomoeda, um "bloco" refere-se a uma unidade de armazenamento que contém todos os dados para transações que ocorrem em uma rede de criptomoedas (como Bitcoin, Litecoin, Ethereum, etc.) dentro de um determinado período de tempo. Para bitcoin, o tempo de bloqueio é de aproximadamente 10 minutos. Para Litecoin, são aproximadamente 2 minutos. Para o Ethereum, são aproximadamente 10-19 segundos. As transações dentro de uma rede de moedas não podem ser confirmadasou verificadas até que sejam adicionadas a um bloco por um minerador. Quanto menor for o período de tempo de bloqueio, mais rápido uma transação pode ser confirmada e suas moedas liberadas para o destinatário da transação.
A corrente. Embora exista apenas como uma metáfora aplicada às ações realizadas pelo software de rede de uma criptomoeda, uma "cadeia" é o que une todos os blocos, quase sempre de forma linear. Isso significa que os blocos são sequencialmente ordenados por número (#1, #2, #3, #4, etc.), com cada novo bloco sendo colocado na frente do bloco antes dele ao ser adicionado ao blockchain. Os blocos estão ligados a uma cadeia usando um nonce, ou um número importante descoberto por um mineiro durante o processo de mineração. Após a descoberta bem-sucedida de um nonce, um mineiro é recompensado com um certo número de moedas por sua contribuição de adicionar um novo bloco à cadeia.
Assim, uma blockchain é uma sequência de blocos, encomendados em uma sequência de tempo linear, que contém todas as informações de transação para uma rede de criptomoedas. As blockchains são por prova de adulteraçãode design, o que significa que seus conteúdos são difíceis de alterar. Ao residir em múltiplas fontes, elas são distribuídas, e por conter um histórico sequencial de todas as transações para uma moeda, eles agem como um livro-razão. Abaixo está uma visualização de três blocos de uma blockchain, cada um com 10 minutos de informações sobre transações, abrangendo um período total de tempo de meia hora.
O que exatamente é um Blockchain?
O dicionário define a palavra "blockchain" como tal:
cadeia de blocos
יbläkəCHān
Substantivo
um livro-razão digital no qual transações feitas em bitcoin ou outra criptomoeda são registradas cronologicamente e publicamente.
“we can actually have a look at the blockchain and see evidence of what’s going on”
Investopedia, an online encyclopedia for terms related to financial investments, gives a slightly more detailed definition:
A blockchain is a digitized, decentralized, public ledger of all cryptocurrency transactions. Constantly growing as ‘completed’ blocks (the most recent transactions) are recorded and added to it in chronological order, it allows market participants to keep track of digital currency transactions without central recordkeeping. Each node (a computer connected to the network) gets a copy of the blockchain, which is downloaded automatically.
Basically, a blockchain is a ledger (or record) of all cryptocurrency transactions that have ever taken place within a cryptocurrency network. Each network participant (known as a node) keeps a copy of the blockchain on their computer. All nodes are in continuous communication with one another, constantly verifying, updating, and downloading the blockchain to the computer (or server) of each participant.
Anybody can be a node so long as they are connected to the internet, running the cryptocurrency network software, and have downloaded the coin’s entire blockchain to their hard drive. This is what allows for a cryptocurrency to be decentralized, or out of the control of any one person or group of individuals. If one node is shut down, or a bunch of nodes are all simultaneously shut down, a cryptocurrency can continue to function so long as there is at least one active node still present and running the coin’s software, keeping the blockchain up-to-date and alive.
Once recorded to a blockchain, the transaction data contained in any given block cannot be changed without alteration of all subsequent blocks, which requires a consensus of the network majority (at least 50% of all nodes need to agree on any changes made to a blockchain in order for them to be implemented). This prevents a single node (or group of nodes) from altering the blockchain in their favor, making a blockchain secure against malicious activity or “bad actors” who would attempt to manipulate transaction information for their own financial gain.
Origins of the Blockchain
The concept of the blockchain was invented in 2008 by the mysterious cryptography enthusiast and computer programmer Satoshi Nakamoto. While Nakamoto remains anonymous, disappearing altogether in 2012, he is credited with not only releasing the world’s first cryptocurrency (bitcoin) but successfully using the blockchain for the first time as well, as a mechanism for not only securing bitcoin but allowing it to function as well.
Nakamoto invented the blockchain as a solution to a problem: how do you make a digital currency that cannot be forged, counterfeited, or manipulated by other programmers (or hackers)? In his original whitepaper for the world’s first cryptocurrency, titled “Bitcoin: A Peer-to-Peer Electronic Cash System”, Nakamoto outlined his idea, which involved creating a network of users who all kept a copy of the blockchain on their own hard drives that was secured through computer cryptography.
The bitcoin network went live on January 3, 2009, with its genesis block (block #0) containing a reward of 50 bitcoins and the following message in its metadata, also known as a coinbase:
The Times 03/Jan/2009 Chancellor on brink of second bailout for banks.
As of June 2018, there have been over 526,000 blocks added to the bitcoin blockchain. The total size of the bitcoin blockchain is now approaching 175 GB. Due to the exponential increase in bitcoin’s popularity since its launch in 2009, the size of its blockchain has been growing at an exponential rate, and this factor prevents most users from downloading the entire blockchain and running their own node. Instead, they rely on 3rd party services (such as web wallets like Coinbase and mobile wallets like Mycelium) to maintain a copy of the blockchain for them, from which individual wallets are updated and transacted upon.
Since each block in the bitcoin network has a maximum capacity of 1 MB of transaction data, the trend of exponential blockchain growth cannot continue, and the curve depicted in the graph above will likely flatten out and become more linear in the future.
How Does a Blockchain Work?
Because the technical detail of how a blockchain actually functions is long, complicated and requires intricate knowledge of mathematics, computer science and cryptography, we will just lay out the basics for the purposes this guide. The idea of the blockchain is actually quite revolutionary. Not only does it solve the problem of double-spending of a digital currency, it allows for the concurrent provision of public inspection (open sourced software), security (cryptographically secured) and non-regulated control / access (decentralization). Bitcoin and most other cryptocurrencies provide all 3 of these elements through usage of a blockchain.
To understand how a blockchain works, you must first have a basic grasp of the following concepts:
Cryptography. The science of cryptography has been around for ages, well before the invention of computers and even electricity. Basically, cryptography is the process of making information unreadable (otherwise known as encrypting) to everybody that does not possess the code or key (known as a cipher) needed to transcribe (decrypt) it. The reason for doing this is to keep sensitive information out of the hands of third parties, criminals or bad actors who would use such information for purposes other than it was intended.
One of the most successful examples of encryption was that of the Navajo Code Talkers. During World War II, the United States military employed the use of hundreds of Native Americans whose job it was to transmit top secret information over radio frequencies in the form of their native language, which was undecipherable by enemy forces. Famously, the Navajo code was the only spoken military code never to have been deciphered by the enemy, and it was used up through the Vietnam War of the ‘60s-‘70s.
Hashing Algorithm. A hashing algorithm, also known as a hash function, is basically a mathematical formula used to convert data of any size into a fixed size in an orderly format. Satoshi Nakamoto, founder of bitcoin, used a hashing algorithm developed by the NSA as the basis for cryptographically securing bitcoin wallets and transactions. Bitcoin’s Secure Hash Algorithm 256 (SHA-256) became the basis for hundreds of coins to follow suit, and thus far it has proven to be unhackable. A bitcoin address is derived from its private key, which is generated (along with the public key) during the key generation process. The specifications for this process are contained within the Bitcoin Core client, better known as the software required to maintain a full bitcoin wallet (complete with full copy of the blockchain), or to run a bitcoin node.
Bitcoin cryptography is one-way, meaning it is mathematically possible to determine a bitcoin address from a private key, but impossible to determine a private key from an address. A bitcoin private key is 51 or 52 characters in length, containing any letters from A-Z (lower and upper case) and any numbers from 0-9. Because this combination of characters is so long and so varied, there are 2^96 possibilities when generating a new private key. To put things in perspective, it is estimated that there are only 2^63 grains of sand on all of the beaches of planet earth combined, and you would have a better chance of correctly guessing a lottery number than you would guessing the exact private key of a bitcoin address.
Mining. Cryptocurrency mining is the process of discovering a nonce, or secret number needed to tie an incoming block to the blockchain. In the classic method of mining known as Proof of Work (PoW, used by bitcoin and many other coins), hash power is generated by a computer (or an ASIC) to discover the correct nonce as generated by a coin’s hash algorithm. Upon discovery of the correct nonce, a new block is added to the chain, the transactions within the block become validated (or confirmed) and the miner is rewarded with a set amount of newly-generated coins (plus the transaction fees for all transactions contained within the block).
In this way, miners are absolutely essential for the survival of a cryptocurrency blockchain. If there are no miners committing hash power to a coin network, no new blocks can be added to the chain. Thus, no new transactions can be verified, and all coins remain in a state of stasis, effectively spelling the death (or hibernation) of a cryptocurrency. Cryptocurrency mining is an extremely lucrative business, with miners spending a combined billions of dollars a year on ASICs, graphics cards and other computer hardware that can be used in the process of nonce discovery. Back when bitcoin started in 2009, it was possible to mine bitcoins using one’s own computer (in a process known as solo mining), however this has not been the case for quite some time.
Genesis Block. A genesis block allows for the initial creation of coins in a cryptocurrency network without any blocks or transactions preceding it. It is usually known as “block #0” in a blockchain (sometimes “block #1”) and is not mined; rather it part of the instructions hardcoded into client software (such as a wallet) and sets a cryptocurrency network in motion by providing it with its first set of coins. Future blocks are subsequently tied to the genesis block by miners during the mining process. All coins generated afterward are the result of the mining process, which as we will explain later, can take place using a variety of methods.
Data Contained Inside a Block. Each block contains the following information, all of which is actively required for the continued functioning of a cryptocurrency network:
Timestamp: the exact time and date a block was added to the chain, according to the UTC time zone.
Height: the block number, assigned in sequential order.
Inputs: all sender addresses for transactions contained within the block.
Outputs: all recipient addresses for transactions contained within the block.
Transaction Amounts: the amount of cryptocurrency sent in each transaction, as well as the total transaction output.
Transaction Fee Amounts: the total amount of fees assigned to each transaction in the block, collected by the miner as part of the miner reward.
Nonce: a number discovered by the miner during the mining process which allows a new block to be tied to the last block of a blockchain.
Metadata: other information required for the addition of a new block, as well as optional, user-defined data attached by the sender of a transaction (such as the messaged added by Satoshi Nakamoto in the genesis block of bitcoin).
Hash: a number used to identify a block, which also acts as a signature.
Previous Block Hash: the hash number of the preceding block in a blockchain.
Can A Blockchain Be Hacked?
In short, the answer is “yes,” although it remained “no” up until very recently. The bitcoin blockchain – along with the vast majority of all popular altcoins – remains unhacked after over 9 years of being in operation. The chances of a hack taking place on the bitcoin blockchain remain incredibly slim and highly theoretical, but we will review the two most cited ways in which a hack may be possible:
51% Attack. Since the correct version of a blockchain is always the one used by more than 50% of all hash power which allow a cryptocurrency network to operate, this would mean that a hacker would need at least 51% of control over a coin’s network in order to perform the attack. For the longest time, this type of attack only existed in theory, but in June 2018 a few less popular coins (including a fork of bitcoin) suffered this type of attack.
Nakamoto theorized this type of attack would be highly unlikely on the network of a successful coin because the amount of resources expended to carry out such an attack would outweigh the financial benefits of such an attack. In a 51% Attack, the attacker gains control of the majority of a coin’s network, replacing the correct version of a blockchain with one that favors them financially. By doing so, the attackers would have access to massive amounts of coins which they may then sell on an exchange. However, the attack would soon be noticed, and in combination with a hacker dumping copious amounts of coins on an exchange, the price of the coin would be driven down very rapidly, rendering the rest of coins held by a hacker near worthless.
Quantum Computing Attack. Short of tampering with the contents of a blockchain itself, the only other way theorized to “hack” the security of a robust blockchain (such as bitcoin) would be to brute force guess the private key of a wallet which contained coins. As mentioned previously, there are more possible private keys for bitcoin than grains of sand in the world, so simply guessing a private key for a bitcoin wallet is an impossible task using even the fastest of currently-available supercomputers.
A quantum computer, however, could theoretically perform enough computations per second to successfully guess a private key in a matter of weeks, days or even hours, though computers of such power remain well out of the grasp of human technology. In response to this theoretical threat, a number of new coins being released to the public advertise themselves as “quantum resistant,” meaning their private keys are generated in such a manner that they cannot be cracked even by using a fully-functional quantum computer. For now, there is no need to worry as such computers do not even exist as of 2018.
What Are the Different Types of Blockchains?
Throughout this guide, we have discussed extensively only one method used to mine cryptocurrencies; that being Proof of Work (PoW). Other major coins that employ PoW systems include Litecoin (LTC), Ethereum (ETH) and Bitcoin Cash (BCH). PoW coins rely on “work” in the form of computer power and electricity being used to correctly find the nonce of an upcoming block. However, since the inception of bitcoin, this idea has been expanded upon to encourage a reduction in electricity usage, as the bitcoin network now consumes more electricity than many small- to mid-sized countries. This makes its continued growth unsustainable due to the increasing difficulty in finding the nonce to a block and has encouraged the formation of other methods of mining. Some of these include:
Proof of Stake (PoS) (NXT, BLK, PPC). Mining rewards are issued to open wallets acting as nodes in a process known as “staking.” The reward is proportional to the amount of coins being held in each wallet. Thus, the more coins that are “staked” by a wallet, the higher chance they have of finding the next block, or the more coins they will receive as a staking reward.
Proof of Burn (PoB) (XCP). Pre-existing coins (usually bitcoin) are deposited to an address for which there is no private key and coins in the form of a new cryptocurrency are issued to depositors proportional to the amount sent to the “burn” address. Usually, no new coins are created for the new cryptocurrency after the specified “burn period” has closed, and in the case of Counterparty (XCP), the coin operates on the back of the network of another cryptocurrency (BTC).
Proof of Importance (PoI) (XEM). A combination of number of coins staked by a node and the amount of activity incurred by the node (number of transactions within a given period) determines the likelihood of a node finding the next block and receiving the miner reward.
Blockchains "sem bloco" (MIOTA, GBYTE). Essas criptomoedas de terceira geração usam sistemas alternativos de registro semelhantes a uma blockchain, mas não exigem que um participante da rede mantenha todo o histórico de transações de rede para operar. Normalmente, eles podem obter uma quantidade rival de segurança de rede usando informações criptográficas obtidas de transações imediatamente anteriores e alguns outros nós, a fim de manter um saldo de contas correto e verificável.
Quais são alguns outros usos de um blockchain?
Os benefícios da tecnologia blockchain estão agora começando a atrair empresas, corporações, governos e outras entidades que buscam uma maneira mais eficiente e segura de realizar transações e manter registros ou bancos de dados. Em suma, Satoshi Nakamoto conseguiu criar não apenas a primeira moeda digital viável, mas uma nova abordagem radical para resolver problemas inerentes aos métodos convencionais de registro. O blockchain está sendo aplicado agora para encontrar uma solução para outros problemas além daqueles de manter o controle de uma moeda digital em uma ampla variedade de indústrias. Algumas delas incluem fazer melhorias em:
- Serviços governamentais: como o
- proteção de sistemas e infraestrutura contra ataques cibernéticos
- redução de custos operacionais, burocracia embelezada
- melhoria na manutenção de registros para benefícios do serviço social e elegibilidade
- melhoria na rastreabilidade das despesas orçamentárias, e
- redução da fraude fiscal
- Registros de Saúde: uso por seguradoras de saúde e vida para fornecer uma maneira privada e resistente a adulterações para armazenar dados confidenciais de clientes e informações médicas
- Propriedade fundiária / Imóveis: uso por governos e corretores de imóveis para manter um registro preciso de direitos de propriedade, títulos, escrituras, emissores e portadores
- Logística: mantendo informações precisas sobre a origem, transferência, qualidade e quantidade de alimentos, medicamentos, produtos embarcados e outros produtos de consumo.
Conclusão
Em resumo, o blockchain tem servido como um método muito confiável para manter um registro de transações digitais dentro de uma rede. Ao armazená-lo em vários servidores, é descentralizado,difícil de falsificar e imune a intervenções injustificadas. Através do uso de funções de hash criptográfico, é muito seguro e quase inhackable. A invenção de Satoshi Nakamoto provou ser muito confiável para o bitcoin e centenas de outras moedas seguirem o exemplo. O sucesso do Bitcoin levou milhares de pessoas em todo o mundo a explorar o potencial do blockchain como uma solução para outros problemas enfrentados pela sociedade, em inúmeras áreas. De fato, o blockchain está atualmente tendo um efeito transformador no mundo facial como o conhecemos, revolucionando processos antigos e interrompendo modelos de negócios em várias indústrias diferentes.