Monday, September 16, 2019

Block Chain concepts

1- Simple Blockchain with DATA+HASH+Previous Hash
Insimple work blockchain in a colloection of blocks containing data in form of Ladger arranged in a sequential manner with following attributes
1- Immutable :- Cannot be changed
2- Sequence is maintained by storing its own and previous block unique address. Hence the first block which did not have any previous block is termed as Genesis block i.e. PreviouBlock address=0;
3- In shot it can be terms as a system in which a record of transactions made in cryptocurrency are maintained across several computers that are linked in a peer-to-peer network.
2- CINA concept in internet.
Confidentiality: This can be expalined by taking simple word
Let say User A want to send message to User B using internet how we can make sure Message is not been read by User C on net. This is what confidentiality stand for. We need to make sure only User A and User B are the right candidate for reading this messages.
Integrity:-
Let say User A send message to User B how we can make sure the message is not been tempered in between. i.e. if User A send message "Hello USer B" to Uesr B then how we can make sure no thrid party User C had modified it to "Hello User B1".
Non repuditions:-
Let say User A send Message to User B and how we will make sure that the user A has only send this messsage and he will not be able to neglect his ownership on the same.
Authentication:-
During exchange between the messsage from User A and User B how we can make sure that message is properly authenticate from both parties.
3- Cryptography :- Symmentric and Asymmentric Solutions
Cryptography = Crypto means secret/hidden and graphy means To handle Confidentiality in the above network aspect we have Symmentric and Asymmentric crytography
Symmentric Key Crytography :-
User A --> Encrypt the message using his User A key --------------------------> USer B on receiving the message decrypt them using Using User A key.
Above scenario work perfectly right but assume if we had huge messsage to send different other user we have to maintain huge key.
Asymmentric Key Cryptography :- In this we have two key (1) Public Key = email id and (2) Private Key = password.
User A --> encrypt the message using his public key and send message to User B ----------------> User B decrypt the message using his Private key.
This issues solved our confidentiality concern on Network. But what about our other concern like Integrity, Non Repuditions and Authentications for that we will use below Asymmentric key cryptography.
User A encrypt the message using his Private Key + user B Public key and send message -----------------> User B decrypt the message first using his private key and then using User A public key.
4- BitCoin Example one complete flow
You might be thinking why BitCoin name is so much famous whenever we talk about BlockChain ... reason behind Bitcoin was the first to implement BlockChain in public mode for cryptography. Lets try to firs understand how they did it
Let say User A want to send money to the User B
User A --> Create a ledger i.e. Transection notes it may contains data like FROM:UserA , TO:UserB, Amount=10 Rs. etc ... information. This ledger is then encrypted using HASH algorithum (We will disscuss about different algorithm later HASH, MD etc). Then using Asymentric Key cryptography i.e. encrypt using privae key of sender + public key transection is send to the User B where in User B will decrypt the same using public key of Sender User A and his own private key. This way one complete transection is done.
In this case the process of claiming the do the work that involve solving of some mathematical problem so that we can be entitiled to encrypting the ledger using hash code and creating a block is called POW [Proof of work]. Person who do this is called Minner and process of adding the Block into the chain is called minning. FYI currently Bitcoin pay 12.5 point for this.
5- Nodes and its types.
Now lets go in details of Node for Block chain Cryptography. There are two main type of Nodes
1- Full Nodes :- On this full nodes your whole block chanin exist i.e. today bitcoin 130 GB and on this node we maitain and service new and old block. To do this we need huge CPU and GPU.
2- Partial Nodes :- such node i.e. even our mobiule we only use to do some transections.
6- Algorithem MD5 and SHA 512 
We talk above about the crytography hash algorithm. Important point to note HASH algorithm suggest what ever and how much data you give as input it will produce unique byte of string as an out put. To be more clear let say we use SHS512 algorithum as an input if we give all the character of encylopidea or simple string like "My name is siddharatha dhumale" as an output it will give simple string of 512 character. for SHAH64 algo we get string of 64 character. Additional we are sure that slight change in the data will definately change hash value. Further adding this hash code will be unique their is very very less chance that it may be same as other... In real scenario this is called hash collosion and we had another way to handle it. Will keep this part away from discussion as of now.
7- Markel Tree concept.
Now when we talk about the hash code it is good time to talk about the Market tree. Let say in one ledger we had 10 trasection do we need to have 10 hashcode or we can have single hash code for all this transection
h12345678
h1234 h5678
h12 h34 h56
h1 h2 h3 h4 h5 h6... h10
As shown in above structure we can store the final single hash code h12345678 as signed value. This process of getting unique hash code from multiple hash code is called Markel tree.
8- Disection of One single Block :- Timestamp, Version, Market Tree Root, POW [Difficulty Target, Nonce] and Previous Hash
Now lets go in details of what a single Bock contain. Basically it contains follwoing 5 items
1- Timestamp on which it is created.
2- Version
3- Markel Hash code
4- Two values from POW i.e. Difficulty Target and Nouce
5- Previous hash code.
9- Security i.e. 10 min example to add and update block
Biggest quesiton is how we can say that block are secure it may be possible that admin can change the data of the block ...agreed with you but issue will be as soon as any one change the data inside the blog its hash code will change ... rememeber one block hash code is also stored in second consecutive block as a PREVIOUS BLOCK hash code. so once original has code change then its consecutive chain get break. To make this valid user also need to reiterate all the consecutive cascade block and again recalculate their new has code as per this new values to main the chain again.
Now someone will say what's wrong in this process with the help of new super computer we can do this .. I agree with you but in BITCOIN to update or add new block in the chain it consume 10 min and huge POW. So consider if even though we have 10 blocks chain it will take approximately 100 min to change and in mean while new block will be added to the end ..and hence this will make such process next to impossible to do.

10- Consesus Algorithm
One of the important of Block chain in use of Consesus algotirhm. Let me give you in details what this means. Let say we have team of 5 people. Any decision which need to be taken will have to be approved by all 5 team member. Even if the single team memeber resist on the same the chain break. This is called taking consesus before acting. Remember ACID properties in EJB same is this :).
11- Type of Block Chain
There are three type of block chain
1- Public :- This type of block chain are public in nature means its data can be seen by all other and only few has write to modify it i.e. bitcoin.
2- Private :-This type of block chain are private in nature means its data can be seen by agreed and authenticated user only and only few among them has write to modify it. i.e. Banking Blockchain or corporate block chain etc.
3- Hybride :- This is amalgamation on both Public and Private block chain. Few of the block are private in nature and rest are public in nature.
Remember Public block are huge in size and as it is huge it will be difficult for any one to modify it.

12- HyperLedger
We had done enough of Bitcoin discussion till now. In current market you will be listening to new terms as HyperLedger.
Does hyperledge is new ledger, is it block chain, is it new type of block chain answe is NO
In simple word it open source collobrative effort to provide users with frame work and tool/ide to develop new blockchain. It is the owner ship of linux world.
13- Smart Contract
Simple word to define is the contract which is executed by the code which is written by us between the two party is called smart contract. I know you did understand what i means to say :) let me take example
Let say User A want to use a site ABC.com to get some item having many discount... concern here is we try to avoid using this ABC site due to its authentication issues might be possible it happen that ABC hier another company XYZ to send the product to my house. XYX give product to ABC but ABC did not send the product to me..how i can handle such scenario at run time. To do this i will have smart contract .i.e. if ABC deliver product to me then i will pay amount to XYZ. In this case i will be sure that at any given movement of time if the product did not reach my contract did not executed.
14- Etherium
Purpose is to have Platform for B2C businesses and generalized  applications and Confidentiality as Transparent and Mode of Peer Participation as Public/Private and Permissionless Network along with Consensus Mechanism as PoW Algorithm: Consensus is reached by mining and Programming Language asSmart Contracts written in Solidity and Cryptocurrency Built-in cryptocurrency called Ether
15- Disadvantage- CSR
- It is complex to understand
- It required huge resource to deal with CPU and GPU and mathemaical process to solve.
- It has 51% issues i.e. if a block chain has 51% false owner then it is wrong block chain.

No comments: