Block chain

in #block7 years ago


Blockchains are incredibly popular nowadays but what is a blockchain how do they work what problems do they solve and how can they be used like the name indicates a blockchain is a chain of blocks that contains information this technique was originally described in 1991

by a group of researchers and was originally intended to timestamp digital documents so that it's not possible to backdate them or to tamper with them almost like a notary however it went by mostly unused until it was adapted by Satoshi Nakamoto in 2009

to create the digital cryptocurrency Bitcoin now a blockchain is a distributed ledger

that is completely open to anyone they have an interesting property once some data has been recorded inside the blockchain it becomes very difficult to change it so how does that work well let's take a closer look at a block each block contains some data the hash of the block and the hash of the previous block the data that is stored inside a block depends on the type of blockchain the Bitcoin blockchain for example stores the details about a transaction in here such as the sender receiver and the amount of coins

a block also has a hash

you can compare a hash to a fingerprint it identifies a block and all of its contents and it's always unique just as a fingerprint once a block is created its hash is being calculated changing something inside the block will cause the hash to change so in other words hashes are very useful when you want to detect changes to blocks if the fingerprint of a block changes it no longer is the same block the third element inside each block is the hash ofthe previous block and this effectively creates a chain of blocks and it's this technique that makes a block chain so secure let's take an example

here we have a chain of three books as you can see each block has hash and the hash of the previous block so block number three points to block number two and number two points to number one

now the first block is a bit special it cannot point to previous blocks because while it's the first one we call this block the Genesis block now let's say that you tamper with the second block this causes the hash of the block tochange as well in turn that will make book three and all following blocks invalid because they no longer store a valid hash of the previous block so changing a single block will make all following blocks invalid but using hashes is not enough to prevent tampering computers these days are very fast and can calculate hundreds of thousands of hashes per second you could effectively tamper with a block and recalculate all the hashes of other blocks

to make your block chain valid again so to mitigate this block chains have something that is called proof of work it's a mechanism that slows down the creation of new blocks in bitcoins case it takes about 10 minutes to calculate the required proof of work

and add a new block to the chain this mechanism makes it very hard to tamper with the blocks because if you tamper with one block you'll need to recalculate the proof of work

for all the following blocks so the security of a block gene comes from its creative use of hashing and the proof of work mechanism
but there is one more way that block chains secure themselves and that is by being distributed instead of using a central entity to manage to chain block chains use a peer-to-peer network and everyone is allowed to join when someone joins this network

he gets a full copy of the blockchain the node can use this to verify that everything is still in order now let's see what happens when someone creates a new block that block is sent to everyone on the network each node then verifies the block to make sure that it hasn't been tampered with and if everything checks out each node

adds this block to their own blockchain all the nodes in this now or create consensus they agree about what blocks are valid and which aren't blocks that are tempered with will be rejected by other nodes

in the network so to successfully tamper with a blockchain you'll need to tamper with all the blocks on the chain redo the proof of work for each block and take control of more than 50% of the peer-to-peer network only then will your tampered block become accepted by everyone else so this is almost impossible to do block chains are also constantly evolving one of the most recent developments is the creation of smart contracts
these contracts are simple programs that are stored on the blockchain and can be used to automatically exchange coins based on certain conditions more on smart contracts in a later video the creation of blockchain technology peaked a lot of people's interests soon others realized that this technology could be used for other things like storing medical records creating a digital notary or even collecting taxes so now you know what a blockchain is how it works on a basic level and what problems it solves want to learn how you can implement a simple blockchain in JavaScript

Coin Marketplace

STEEM 0.27
TRX 0.20
JST 0.038
BTC 96715.05
ETH 3649.48
USDT 1.00
SBD 3.88