Crypto Academy / Season 3 / Week 8 - Homework Post for @stream4u | Let's Open the Cryptography

in hive-108451 •  4 years ago  (edited)


5_cryptography-and-data-protection-100768038-large.jpg
Source

Introduction

It is a great week in the crypto academy as Prof @stream4u opens up cryptography deeply to the understanding of students. Thank you Prof.

1. Blockchain Cryptography

Before I open what blockchain cryptography is, I would love to first talk a bit about blockchain.

Blockchain is a decentralized database that records and securely stores transaction information in block where these transaction information cannot be meddled with or altered. The information stored in a block is distributed and updated on other blocks that are in the chain. Hence the name Blockchain can also be viewed as chain of blocks.

Cryptography is a composition of two words which are crypto and graphy. Literally, crypto means secret. Therefore cryptography is the security added to the blockchain to enact safe and trustless transactions, protect the blockchain against double-spending of funds and also eliminates the presence of central authority in the blockchain network.

Blockchain cryptography is therefore the added technology on the blockchain for the purpose of ensuring optimum security to every transaction executed in the blockchain network. This cryptography algorithm used by blockchain are of two types, namely;

  • Assymmetric-keys algorithm

  • Hash function

Asssymetric-keys algorithmis is the function that uses two different but related digital keys to verify and sign transactions in the blockchain network. These two digital keys are the public keys and the private keys. The public key helps to verify transactions while the private keys helps in securing the wallet, and is also used to sign and broadcast transactions.

Hash function helps compress lengthy transaction file or data file into fixed length, comprising of both alphabet and numbers. Any slight difference in the data can alter the output. this is to say that every or each input has its dynamic output, provided the input and the output are through hash function.

of Blockchain Cryptography

  • It gives optimum security to datas which are stored in the blockchain.

  • It helps in the encryption of sensitive data which can only decrypted by the receiver who has the public key associated with the private key used to encrypt the data.

  • It makes data alteration impossible, thereby maintaining the integrity of data in the block.

The above mentioned are some salient benefit of cryptography.

Some popular blockchain are the Bitcoin blockchain, Ethereum blockchain, Stellar blockchain, Steemit blockchain, Binance smart chain etc.

3W72119s5BjVs3Hye1oHX44R9EcpQD5C9xXzj68nJaq3CeFGHg4aXRoSVKBjAah2jfmhpobj1ieDNV9hazM4y1pgK3cN2fQ3NkvnE8p4sNkk847PojWAMt.png

2. Public Key Cryptography

Public key cryptography otherwise known as asymmetric cryptography is a component of the cryptographic protocol that makes use of two distinct keys of which one is a secret or private key and the other is a public or non-secret key. These two keys are used to encrypt and decrypt data for the purpose of securing the data from being accessed by unauthorized party.

If I want to send encrypted data for example, i will first sign the transaction with my private key. After the encryption, I will now send the data to the recipient and the recipient will use the public key associated with my account to decrypt the data I sent to him or her. This idea is used to send sensitive data or information to another person over insecure media like the Internet.

This therefore means that private keys are used to sign transactions before it is broadcasted while the public key on the other end helps the receiver to decrypt the transaction being sent. These asymmetric-keys helps in the verification of transactions before the transactions are recorded in the blockchain.

Key Benefits of The Public Key Cryptography

  • It ensures the security of data sent over insecure interface

  • It allows users to have their digital signatures during transaction broadcast.

3W72119s5BjVs3Hye1oHX44R9EcpQD5C9xXzj68nJaq3CeFGHg4aXRoSVKBjAah2jfmhpobj1ieDNV9hazM4y1pgK3cN2fQ3NkvnE8p4sNkk847PojWAMt.png

3. What is Private Key Cryptography?

Private key cryptography is another unique class of the asymmetric-key protocol which is meant to be kept private, unseen by any other person except the owner of the associated key. It is a confidential key that is used to secure the assets in the wallet and it is also used to send funds from the wallet.

Every decentralized digital wallet has its unique private key which lets the wallet owner to be in complete authority of the wallet. If the private key is disclosed by the owner of the wallet, then it means the owner of the wallet is no more in complete control of that wallet and the funds in the wallet is at risk. This is to say that the private key is meant to be private, not to be disclosed and must be kept a complete secret.

Key Benefits of Private Key Cryptography?

  • It gives a user total authority of his or her digital fortune.

  • It is used to secure funds in a wallet

  • It allows the wallet owner to sign transactions before it is broadcasted.

3W72119s5BjVs3Hye1oHX44R9EcpQD5C9xXzj68nJaq3CeFGHg4aXRoSVKBjAah2jfmhpobj1ieDNV9hazM4y1pgK3cN2fQ3NkvnE8p4sNkk847PojWAMt.png

4. What is Digital Signatures Cryptography?

Digital signature is a unique feature of the asymmetric-keys algorithm that is used to authorize transactions broadcast.

Before transactions are executed in the blockchain network, the initiator of the transaction or the sender of the data first need to authorize the transaction by signing it with his private key. After the signing, the transaction or data transfer will now be broadcasted to the miners in the network. The miners will now validate the transaction by verifying it using the corresponding public key of the transaction initiator. And then the transaction data or information will now be added to the receiving block in the chain of the blockchain network.

To further breakdown this process, I will love draw our attention to the real life authorization done in institutions or entities. If a transaction is to be executed in the financial institution like banks, the owner of the account will have to traditionally authorize the transaction by signing the transaction slip. The signature provided now means that the owner of the account has attested that he has approved the transaction to be executed.
Similar thing happens in the blockchain network, but in the blockchain, everything is done digitally.

Therefore, digital signature uses two modalities for a transaction to be completely executed. These modalities are;

  • Signature which the owner of the account makes use of his or her private key to bind his authority on transactions or data.

  • Verification, which is done digitally by miners using the public key associated with the wallet from which the transaction was broadcasted will now be carried out on that transaction so as to validate the transaction.

3W72119s5BjVs3Hye1oHX44R9EcpQD5C9xXzj68nJaq3CeFGHg4aXRoSVKBjAah2jfmhpobj1ieDNV9hazM4y1pgK3cN2fQ3NkvnE8p4sNkk847PojWAMt.png

5. What is Symmetric and Asymmetric Cryptography?

Symmetric Cryptography

The symmetric cryptography is the type of cryptography that makes use of just an individual key to both encrypt and decrypt electronic information. The encrypted message is transcribed in a format that can never be understood by any third party exception of the receiver who also have the secret key or password used to encrypt the information.

In the symmetric cryptography, the sender first encrypt the information to be sent by signing with a secret key. After the encryption, the nodes in the network will now take the data to the receiving account and the receiving account owner will now use the same key which was used to encrypt the data to decrypt the data and read the content of the data.

The symmetric cryptography is divided into two which are;

  • Block Algorithms: Here, specific amount of the electronic information are being encrypted in blocks while the system retains the data in its memory for the blocks to be completely filled.

  • Stream Algorithms: Here, as the electronic data are being streamed, they are as well encrypted rather than being retained first in the system's memory.

Examples of symmetric cryptography include; AES (Advanced Encryption Standard), DES (Data Encryption Standard), IDEA (International Data Encryption Algorithm), Blowfish (Drop-in replacement for DES or IDEA), RC4 (Rivest Cipher 4), RC5 (Rivest Cipher 5), and RC6 (Rivest Cipher 6) ref

Among the above mentioned, AES, DES, IDEA, Blowfish, RC5 and RC6 are mostly used in block algorithm of the symmetric cryptography. RC4 is used in the stream algorithm of the symmetric cryptography

Use Case Of Symmetric Cryptography

It is used for payment that Personal Identification Information (PII) is necessary so as to guard against identity theft.

Asymmetric Cryptography

The asymmetric cryptography is the type of cryptography that uses two distinct key to encrypt and decrypt electronic data. The two distinct keys are the private key and the public key.

Assuming I want to send a message to someone, I will first encrypt the electronic message with my private before sending it to my friend. My friend in the other end will use the corresponding public key of my account and decrypt the message in order to understand the message.

Therefore in the asymmetric cryptography, two distinct keys are utilized and these keys are the public key and the private key.

Use Case Of Asymmetric Cryptography

Asymmetric cryptography greatly employed in the blockchain technology to enact security on every transaction or data broadcast.

To conclude this very question I want to as an addition to the question asked spell out the clear distinctions between the symmetric cryptography and the asymmetric cryptography.

Symmetric CryptographyAsymmetric Cryptography
Just an individual key or password is needed to encrypt and decrypt electronic informationTwo distinct keys (private and public) is needed to encrypt and decrypt electronic information.
Identity theft is very less prevalent here.There are some cases of identify theft.
Electronic information can be encrypted and decrypted in bulkBulk Electronic information encryption and decryption is not really prevailing here.

3W72119s5BjVs3Hye1oHX44R9EcpQD5C9xXzj68nJaq3CeFGHg4aXRoSVKBjAah2jfmhpobj1ieDNV9hazM4y1pgK3cN2fQ3NkvnE8p4sNkk847PojWAMt.png

6. Blockchain Wallets Cryptography And How It Works

Crypto wallets are simply digital wallets that are used to send, receive and store crypto assets in a decentralized way.

Crypto wallets have three salient components which are; the wallet private key, the wallet public key and the wallet address.

Crypto wallet private key is the key that gives a user total control of his or her digital fortune. This very key allows a user to send funds or crypto assets to another user. It also helps to import funds from a previous wallet that got compromised or that was in a lost or stolen device to a new wallet. This is why it is ideal to store private keys offline, written down in a diary rather than saving it online.

In a nutshell, crypto wallets is the official signature that binds a user to his or her digital fortune.

Below is an example of how private key look like.

2T9S6ECD05423889B66626970A33DR41CB2BEDB8CC8284A4AZRI1245D749F907

Crypto wallet public key is the key used for transaction or data verification for the purpose of adding the transaction or data to the block of the chain in the Blockchain. It helps to decrypt information.
Below is an example of crypto wallet public key.

QsErstNC2Tr8fLiQHKa6NvvFkQim8xyzFRU

Wallet address of a crypto wallet is the pathway or channel through which crypto assets are received into the crypto wallet. The wallet address for each bkockchain network have their own uniqueness. Some blockchain network like Bitcoin, Ethereum, Tron etc have a speculated length for their wallet addresses. No two wallet can have the same address.
Below are examples of wallet addresses of some networks in the blockchain technology.

Bitcoin wallet address: 1CKWa6UVKzZnKCzdyAH8h3cPVfdZzrhQ5j

Ethereum wallet address: 0x6ef7db8e8df973c0065d8e74ea7763d15cde15fb

TronLink wallet address: TG1RN9HYQnp5S2sfB5dUkXYCN9xg89Ho5v

Types Of Crypto Wallet

There are majorly two types of crypto wallet. They are;

  • Hot wallet
  • Cold wallet

Hot wallet: This type of crypto wallets are connected to the Internet. This means that to access this type of wallet, the user must have an Internet connection.

The Hot wallet have other sub wallets which are mobile wallet, desktop wallet and web wallet.

Hot wallet are susceptible to attacks by cyber theft or hackers, bugs, etc. because they are connected to the Internet. It is therefore pertinent for hot wallet users to be good risk managers by protecting their private keys by storing it offline, avoid clicking on phishing links, and avoid disclosing their private key to another person.
Some few example of hot wallets are ; Blockchain wallet, Electrum bitcoin wallet, Metamask, TronLink wallet etc.

Pros of Hot Wallet

  • They give users instant access to their digital fortune at any time or any moment users wants to access their funds or transact.

  • Most hot wallets are so flexible in that they allow users to store different types of cryptocurrencies in them.

  • Most hot wallets are very user friendly. They can easily be installed, funds can easily be sent and funds can easily be received. Some hot wallets even have a swap function which allow users to swap one cryptocurrency for another. And some of them are connected to popular exchanges while some have their built-in exchange.

  • Transactions in some hot wallets are totally free.

Cons Of Hot Wallet

  • They are susceptible to attacks by theft.

  • There is a high risk of digital fortune (asset) loss if the exchange or network that offered the wallet shuts down.

Cold Crypto Wallet

Cold crypto wallets are wallets that are not connected to the Internet.

They are divided into two types which are Hardware wallet and paper wallet.

Hardware wallets are the wallets we can see, touch and feel. They are created in form of hard drive, universal serial bus (USB) etc. and are just plugged in to the computer before the funds in there can be accessed or transferred.

Hardware wallets are more secure than hot wallets and are less susceptible to attacks from hacks but are not free from bugs and viruses.
Example of hardware wallets are; Ledger Nano X, Exodus, Trezor Model T, Mycelium, etc.

Another type of cold wallet is the paper wallet where the private key of the wallet are printed and stored offline.

Pros Of Cold Wallet

  • They are less susceptible to hacks because they are not online wallets.

  • They have seed phrases of 12 to 24 words which helps in the recovery of funds should incase the wallet gets stolen or damaged.

Cons of Cold Wallet

  • They are expensive to purchase.

  • They really are not flexible in that they don't accept most cryptocurrencies that are not really popular.

  • Assuming that user is in a place where there is no computer, he or she can't use the wallet on the go.

3W72119s5BjVs3Hye1oHX44R9EcpQD5C9xXzj68nJaq3CeFGHg4aXRoSVKBjAah2jfmhpobj1ieDNV9hazM4y1pgK3cN2fQ3NkvnE8p4sNkk847PojWAMt.png

7. Merkel Tree And Its Importance

Merkel tree is a unique data structure that gives a complete summary of transactions in a block, make verification of bulk data to be efficiently and securely verified and also ensures consistency in the verification process.

The Merkel tree is primarily composed of the leaf, the branches and the root.
The leaves are the bottom hashes, the branches are the intermediate hashes while the root are the top hashes. The top hashes are securely stored in the header. All of these three components of the Merkel tree helps in the swift verification of transactions in the block.

The Merkel tree plays a great role in shortening the duration used to verify data in the blockchain, manages the memory consumed, shortens the computing power and makes any alteration in data already added to the blocks impossible.

How Merkel Tree Work

It is evident that each block in the blockchain contain some transactions. If I want to find the hash of a particular transaction, it will kind of be so hectic. So with the use of the Merkel tree, it becomes so seamless.


STEEM WORK 1.jpg
Image designed with Corel Draw

From this image here, let's assume we have 4 transactions in a block, what we will do is first find the hash value of HASH 1 and HASH 2, and the hash value of HASH 3 and HASH 4. Then we'll find the hash value of HASH (1,2) and the hash value of HASH (3,4) then finally find the hash value of HASH (1,2,3,4).

But what if there is an odd node in the tree?


STEEM WORK 3.jpg
Image designed with Corel Draw

If there is an odd node, the hash value will be repeated such that it will be HASH 1, HASH 2, HASH 3 and HASH 3. The last hash value which is odd is repeated.
HASH (1,2), HASH (3,3) and the root has will contain the hash value of HASH (1,2,3,3).

With this Merkel tree, it will be easier to find the hash value of a particular transaction.

Importance Of Merkel Tree

  • The Merkel tree makes transactions to be swiftly verifiable and easy transfer of bulk data are from one node to another on the peer-to-peer network is achievable.

  • It helps in shortening the rate of memory consumption in a block.

  • It helps in managing the computing power of the block nodes.

  • It secures the data that are verified and added to the blocks, making it impossible to be altered.

3W72119s5BjVs3Hye1oHX44R9EcpQD5C9xXzj68nJaq3CeFGHg4aXRoSVKBjAah2jfmhpobj1ieDNV9hazM4y1pgK3cN2fQ3NkvnE8p4sNkk847PojWAMt.png

8. Practical And Theory; The functionality of Key, Signature, Transaction and Blockchain

In order to answer question in this very question, I will first visit https://andersbrownworth.com/blockchain/public-private-keys/keys

Keys: There two basic cryptographic keys here which are the public key and the private key. These keys are set of alphanumeric signature which are assigned to every newly created wallet.

PicsArt_08-21-01.13.16.jpg

On the homepage of https://andersbrownworth.com/blockchain/public-private-keys/keys, the keys here are uniquely created in such a way that no one can guess the keys break through it. Below are keys on the screenshot above.

Private key:

54406482875945691124491673591140670457579321604196450650021656159529357893927

Public key:

04a3b7c6c326eb093efd7724eeae26ed233fadea9b3f7dc68ab3fd93e4cf3b1ebf2bfcf306ac658351c344a3a7b70ea54e09ee8f81647c59d278464b19c9c3612c

PicsArt_08-21-01.14.10.jpg

On this screenshot, I clicked on random and the keys automatically changed from the initial key to a new set of key. And the details in the screenshot are below;

Private key:

52989359072675069072254955819085025057457484945492545185365922574011505461902

Public Key:

043e5c3aa7e230b2a4f5345d463a67a6421bd1eeb054bd6b76b210c8aaffb2f9451d148b4964496b3792379e89aca16e3e2abaebac9e46ddb3717a999460aa437b

PicsArt_08-21-01.18.39.jpg

On this very screenshot, I tweaked the private key. I changed it to 19967 and the public key was also changed. This justifies the fact that every private key has its accompanied public key and it is function of the asymmetric-key protocol.

Signature: This feature allows for encryption and decryption of electronic messages. So if I want to send a message, I will first first input the message, then use my private key to sign. The miners on the other end will use the public key associated with this my private key to decrypt the message so that they will be able to verify it and add it to the blocks.

Below is a practical example.


PicsArt_08-21-01.24.09.jpg

In the message box, I typed my message which reads "I LOVE CHILDREN", then my private key which is 19967 the click on sign


PicsArt_08-21-01.36.53.jpg

The message is now signed and here is the message signature with the hash:

3045022100c072448342e3780ffaf3a6273862c8f8bd9312a96e6ed4f91e54641e2a606da502205bcef01007d54c4a958a3268ea7d49cdbfdf31193af255bf1580a896cc6895eb


PicsArt_08-21-01.38.13.jpg

Assuming I am the miner that wants to verify the electronic message, I will switch to verify, the public key associated with that private key is provided already by the keys directorate, and the click on verify.


PicsArt_08-21-01.38.59.jpg

The color of the block here has changed to green color, meaning that the verification is successful.

Transaction: This feature deals with transaction broadcast using the private key to sign, and the public key to verify.

PicsArt_08-21-01.41.27.jpg

On this field, I inputted $10 as the amount I want to broadcast. I supplied my private key which is 19967 and then clicked on sign.

PicsArt_08-21-01.44.27.jpg

It processed and generated the message signature which is

3046022100ec6432109bd42ca3cc349588f98136c9a6c358aaa590a43a47d6b24a02b30f63022100ecd47d31f3dc2270755210ee908eed0e2ecf8d141d0a549163b5d628c1db8878

PicsArt_08-21-01.47.22.jpg

The miner on the other end will switch to verify and then since the public key is already supplied, i will then hit the verify button.

PicsArt_08-21-01.48.40.jpg

The block color changed to green meaning that the transaction has been verified and added to the block.

Blockchain: This feature shows how transactions are securely and validly stored in the blocks via the cryptography.

PicsArt_08-21-02.14.11.jpg

Here are valid transactions that are stored in the blocks with all the necessary transaction details. I will tweak the first transaction in block #2. I will change the amount there from $10 to $6.

PicsArt_08-21-02.17.29.jpg

Here is the result of the alteration. It rendered every other preceding transaction blocks as invalid and the color changed from green to red. To validate them , I will have to click on mine for each of them to be re-mined.

Block 2 to 5 became invalid because any alterations on any block in the chain renders the preceding blocks as invalid. What really makes a valid block is the Nonce. To validate the invalid block again, I will have to change the Nonce which can easily be achieved by hitting the mine button.

PicsArt_08-21-02.21.18.jpg
I clicked mine for block #2

PicsArt_08-21-02.24.08.jpg
Block #2 is now valid. I then clicked mine for block #3

PicsArt_08-21-02.27.13.jpg
Block #3 is now valid. I then clicked mine for block #4

PicsArt_08-21-02.29.13.jpg
Block #4 is now valid. I then clicked mine for block #5

PicsArt_08-21-02.30.20.jpg
Here are the results of the re-mined blocks with their corresponding Nonce. The blocks are now valid again.

Every alteration on a particular block always render the preceding blocks as invalid by changing their initial colors which was green to red because every block in the chain are very sensitive to changes.

3W72119s5BjVs3Hye1oHX44R9EcpQD5C9xXzj68nJaq3CeFGHg4aXRoSVKBjAah2jfmhpobj1ieDNV9hazM4y1pgK3cN2fQ3NkvnE8p4sNkk847PojWAMt.png

Conclusion

Cryptography is a great revolution that has made storage of data or transaction information very innovative with optimum security added to data which a re stored in the blockchain.

Cryptography with its great component like the Hash function and the asymmetric-key function are great tools that secures the transaction information until it gets to its targeted destination and gets verified in the blocks. This really is a great technology that should be widely embraced.

Thank you Prof @stream4u for this nice lecture

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  
Loading...