How to do a Blockchain Cryptocurrency Transactions effectively?

       
          In the crypto world, there are 3 important layers are implemented. The Layer-1 is the Technology or Blockchain. Layer-2 includes Protocol and Coin. Protocol is a set of rules that guides participants over the network to communicate with each other and dictates how to come to a consensus. It also dictates the public key and signatures to be used for authentication. Protocols are required for the whole network to function correctly. For ex, TCP, IP, HTTP etc., HTTP allows the browsers to display the website correctly. IP allows all the participant in the network. In the protocol layer, we have the Bitcoin, Ethereum, Ripple, Neo etc., This protocol relies on the Blockchain technology. Each Protocol has its own coins attached to it. Bitcoin is not just a currency. It is a protocol. It is used to reward people for mining, adding blocks in the blockchain, to purchase things from each other and so on.  Layer-3 is the Token. ICO is actually about tokens rather than coins. Token relies on smart contracts which are built on top of a different protocol. Bitcoin & Ripple does not have tokens which do not facilitate the smart contract. Ethereum is popular for creating smart contracts. There are hundreds of tokens in Ethereum. Waves and Neo have the tokens. In CoinMarketcap, you can see the market capitalization of each cryptocurrency, the tokens and its platform. If somebody investing in coins, they are investing in the protocol of the underlying coins. This is our road map of everything that fits in.



BitCoin EcoSystem: A  whitepaper of peer-peer electronic cash system submitted in 2008 that helps you to understand all the things. It includes the following participants.
       * There are Nodes. It is the term for devices the people use which they are mining the network and transacting with each other.
       * The miners are the people helps the blockchain to grow by mining and adding the transactions into blocks.
      *  Mining Pools are work together for mining process.

Understand the Mining Difficulty:  If you are a miner, mining the bitcoin, you should know how to  impose the current target and mining difficulty. In our previous example, we agreed to express target with leading Zeros. By setting the target of 4 leading zeros, we are reducing the pool size to quarter. If you
request one leading zero, you can effectively reduce the pool size by 16 times.  For ex,
Current Target = 18 leading zeros in 64 hexadecimal digit
Probability:
Total possible 64 Hexa Decimal numbers = 16 * 16 ....16 = 1664    1077
Total Valid Hashes (with 18 leading zeros)  = 16* 16 ....16 = 1664-18   2 * 1055

So, the probability that your randomly picked hash is valid by: 2 * 1055 / 1077   = 2 * 10-22

            The mining difficulty can be calculated as Current Target / Max Target. Max target is set in Blockchain.com, you can see the hash that has the current target of 18 or 19 leading zeros and the Mining difficulty. The difficulty gets adjusted every 2 weeks, so it shows the steps. Due to the decentralized system, the difficulty gets adjusted by nodes themselves. If you install the bitcoin software, the difficulty adjusted on its own because the algorithm coded in the bitcoin protocol. It may necessary that trillion times to find the golden Nonce to solve the cryptographic puzzle place at the inception of Bitcoin. The difficulty is adjusted at every 2016 blocks(or)2 weeks and the block should be released every 10 minutes.

Mining Process: The transactions to the miners come from mempool which is attached to every
node and every miner. Basically, these are unconfirmed transactions gets stored here before it gets included in the block. Blocks are added every 10 minutes. But, the transactions happen all the time. MemoryPool is the staging area for transactions. Fees in the Mempool are arbitrary that ranges from 0 to high fees. If the miner successfully created the block, he will get the fees. Normally, the miner will pick the transactions from higher fees. Now, the challenge to the miner is to find the golden nonce. The nonce will be in the range from 0 to 4 billion. They have the timestamp to find the nonce in every sec. If they don't find the nonce, they will change the configuration with the lowest data in the mempool. The algorithm works to solve these problem effectively.

Transactions and UTXOs in BlockChain: UTXOs stands for Unspent Transactions Outputs. In Bitcoin, the transaction lives after it has been executed until the other transactions built of the UTXOs. For ex, consider the transactions like,


Suppose, I want to buy a computer for 0.6 BTC. Before, You spent to the computer shop, you need to choose the transactions that link into an input. Any movement of money is the transactions in Blockchain. so, It can be described as,

TRANSACTION

           INPUT                                      OUTPUT
  0.7 BTC from Helen      Send 0.6 BTC to the computer shop.
                                            Then, 0.1 BTC back to myself.


Once the transaction is finished(Helen send to me of 0.7 BTC), it will no longer be UTXO. Now, you have new UTXO for the computer shop and to me as shown in the picture.

Then, I need to buy a bicycle for 1.0 BTC. Now, We need to construct the input as,

TRANSACTION

       INPUT                                      OUTPUT
0.1 BTC from Mark              Send 1.0 BTC to the Bike Shop.
0.5 BTC from Susan            The Bike Shop has UTXO for this transactions.
0.4 BTC from Sam

Now, I have only one UTXO of 0.1BTC. This is considered as my balance. There is a transaction fee in the blockchain. If you want your transaction to be accepted, you need to put the fee. The higher the fee, it will more likely to be accepted sooner. It can be calculated as the total input minus the total output and the difference is assumed as a fee. In the real world, we can look at the UTXOs  transactions that come from somewhere else that goes to other places and the amount. The tree chart that grows bigger when clicking the child.
       So, the wallet identifies all the transactions that ended up something coming to me and sees those transactions that still have UTXOs. Then, it adds up this amount and get the balance in your wallet.

The Private key, Public Key and Signatures: In the Blockchain, you can clearly see who is sending or receiving the money. Anybody can calculate the UTXO and may hack your money. So, you need the private key for the security of wallet. When you create a cryptocurrency, you are assigned a private key. This is your unique identifier. It is considered as the password to your bank account. From the private key, you can generate a public key. But, you cannot reverse the private key from the public key. You need to share the public key to others to send money. For ex, you want to send the message that can be text or anything. In cryptocurrency, it is the transaction. The private key combines with a message together generates the signature. Basically, the private key is used to sign the message. In Blockchain, there is a verification function algorithm. Anybody who has the message and signature, they can put them to the verification function with your public key. This will result to confirm or deny the transactions.
      In the Signature demo,  you can generate the random private key which will generate the public key. Similarly, In the signatures, when you edit your messages and click the sign button, the signatures will be created. In the verify, you can see the messages, signature and public key. They can use these 3 inputs to verify that the signature belongs to the holder of a private key behind the holder of the public key. It will not get verified when anybody changes the messages or put the fake signature.  You might see in the transactions tab, the messages have been replaced with the amount.

Public Key Vs Bitcoin Address: BitCoin Address is derived from the public key. It simply applied by the SHA256 function. As you know the sha256 function is deterministic. So, if you have the public key, you will always get the same address. It will never generate for 2 different public key to the same address. It is that address to ask the people to send money. Also, they can directly send to the public key as well. The sha256 function will provide additional protection for getting back your private key. So, if you have the bitcoin address, they can not get it back your public key.

HD (Hierarchically Deterministic) Wallets: HD wallets has the Master Private Key. The Private Keys are generated from the Master Private key. Then, the Public key uses the private key which uses for the Bitcoin Address. The private key and master private key are kept secure. You can generate as many private keys from the Master Private Key. It is very deterministic. It means you can regenerate the private key from the master key at any point in time. It is very useful when you send and receive money to put different public key and address. If the organization uses the Bitcoin for the products or services to run their business, they can use different private keys for each department from the Master Private key. From the Master Private Key, you can see all the transactions associated with any of the private keys. From the private keys, you can see the transactions associated with that address only. The Master Public Key will be useful in generating different public keys. The wallets will do all the things at the background.



Comments