Taproot and Schnorr Signatures - Crypto Academy / S5W6 - Homework post for @pelon53

in hive-108451 •  3 years ago 

Hello Steemians,

0001-15338703183_20211225_233528_0000.png
Designed on Canva

A5tMjLhTTnj4UJ3Q17DFR9PmiB5HnomwsPZ1BrfGqKbjddsm2yryLMZpkag6p3MpXTppwMX3qtt9vdzUYtBHCu2TA9St5KJQygtsgS6dxxqPYJp1JnwppmTDQ2oZcq...vf4dCGuM2U6djjRHRUmVb3zf4149oVJ2XB5SabZQACLaiMcbvdfAjGsuQAvwzkM717GWYf6zhAPhJYAvirzHVEpiCuJrCHhWZsMp6Rr7KdqfND3H8Kkt19ayxi.png

Question 1

Explain in detail the P2SH and P2PKH, show the differences between both directions
A5tMjLhTTnj4UJ3Q17DFR9PmiB5HnomwsPZ1BrfGqKbjddsm2yryLMZpkag6p3MpXTppwMX3qtt9vdzUYtBHCu2TA9St5KJQygtsgS6dxxqPYJp1JnwppmTDQ2oZcq...vf4dCGuM2U6djjRHRUmVb3zf4149oVJ2XB5SabZQACLaiMcbvdfAjGsuQAvwzkM717GWYf6zhAPhJYAvirzHVEpiCuJrCHhWZsMp6Rr7KdqfND3H8Kkt19ayxi.png

Before any transaction is made in the Bitcoin network, an address containing about 30 - 35 alphanumeric figures would be required. In most cases, this address exists in two forms which includes the P2SH and P2PKH format.
P2SH and P2PKH are basically formats of the Bitcoin addresses. Many people are actually confuse on these formats and alot of questions have been asked concerning this two addresse formats. Having gone through the lecture that was taught by our professor, I got to understand this formats more clearly. So I will be explaining them in details below, starting from the P2SH.


What is P2SH

The full meaning of P2SH is Pay to Script Hash, and it is a widely used Bitcoin address format today, because it helps in giving more higher and better features than the P2PKH format. Every wallets, as well as exchanges make use of this address format.
The first way to notice a P2SH address format is that it always starts with a 3, followed by about 30 - 35 alphanumeric figures. The P2SH uses a process called P2WPKH-in-P2SH to give access to transactions that are non native segwit, which means the transactions would be smaller in size when compared to the P2PKH format, and because of that the transaction fees required are equally smaller.

All the other BTC address formats supports the P2SH address format which means that transactions can be made from P2SH to any other BTC address without any much issues.

How does P2SH works?

In this address format, developers can create what is called redeem scripts which would be hashed, whereby producing the redeem scripts hash.
So for a transaction to be made, the unlocking scripts as well as the redeem scripts hash must have to be inserted. And in this case, the redeem scripts hash will equally serve as the unlocking scripts. Below is a diagram for more clarification.
iMarkup_20211225_172941.jpg

Like in the case of this image I designed, my computer (Preye's Computer) where I generated a Redeem Script using my private key. The redeem scripts hash was produced and the receiver's hash was equally provided.


What is P2PKH

The full meaning of P2PKH is Pay to PubKey Hash, and what this simply implies is that payment would be made to the receiver's public key. When Satoshi Nakamoto created Bitcoin, the initial address format he used was the P2PKH address format, and till now this address format is still in use.
Unlike the P2SH address format, the first way to notice a P2PKH address format is that it always starts with a 1, followed by about 30 - 35 alphanumeric figures. This address format doesn't support transactions of non native segwit, which means the transactions carried out here are usually large in size, and the transaction fees required are equally high.

How does P2PKH works?

In this address format, public and private keys must have to be created by the receiver, after this creation, the receiver sends the public keys to the sender that would make transaction.
The Bitcoin address which is the receiver's hash is then generated during the process of the encoding.

Differences between P2SH and P2PKH
P2SHP2PKH
it always starts with a 3, followed by about 30 - 35 alphanumeric figuresit always starts with a 1, followed by about 30 - 35 alphanumeric figures
Transactions could be smaller in size when compared to the P2PKH format, resulting to low feesTransactions are mostly bigger in size when compared to the P2SH format, resulting to high fees
The P2SH address format support transactions of non native segwit.This address format doesn't support transactions of non native segwit.

A5tMjLhTTnj4UJ3Q17DFR9PmiB5HnomwsPZ1BrfGqKbjddsm2yryLMZpkag6p3MpXTppwMX3qtt9vdzUYtBHCu2TA9St5KJQygtsgS6dxxqPYJp1JnwppmTDQ2oZcq...vf4dCGuM2U6djjRHRUmVb3zf4149oVJ2XB5SabZQACLaiMcbvdfAjGsuQAvwzkM717GWYf6zhAPhJYAvirzHVEpiCuJrCHhWZsMp6Rr7KdqfND3H8Kkt19ayxi.png

Question 2

It is required to transfer 10 BTC that belong to a 3 of 5 multi-signature portfolio, to the MTC company, for the purchase of some equipment.
A5tMjLhTTnj4UJ3Q17DFR9PmiB5HnomwsPZ1BrfGqKbjddsm2yryLMZpkag6p3MpXTppwMX3qtt9vdzUYtBHCu2TA9St5KJQygtsgS6dxxqPYJp1JnwppmTDQ2oZcq...vf4dCGuM2U6djjRHRUmVb3zf4149oVJ2XB5SabZQACLaiMcbvdfAjGsuQAvwzkM717GWYf6zhAPhJYAvirzHVEpiCuJrCHhWZsMp6Rr7KdqfND3H8Kkt19ayxi.png


Using the ScriptSig and the ScriptPubKey to explain the steps that are followed.

Sending 10 BTC that belongs to a 3 out of 5 multi-signature portfolio would require 3 available addresses. Let's say address 1, 2, 3, 4 and 5 are about to perform the transaction of 10 BTC to the MTC company and only 3 out of 5 will provide their private keys for the transaction. In this situation, any of the 3 address can be used in two forms, which includes ScriptPubkey and Scriptsig.

The ScriptPubkey would be used to ascertain weather the 3 available addresses can be used to correlate all the keys that are present for the transaction. The mechanism used for this process is called the OP_CHECKMULTISIG, which would confirm, unlock and allow the transaction process to continue after detecting that 3 keys are correlated

The final step here requires the use of the Scriptsig where by the Hash of the SHA-256 produced by OP_HASH160 will be confirmed if it correlates to the scriptsig. After that, the code of the OP_HASH160 will equally be checked and confirmed if it correlates with the code of the OP_EQUAL. If the the correlation is checked and confirmed, then the transaction of 10 BTC to the MTC company will be made successfully.

Explain What happens if the transaction is made using Schnorr Signatures?

If the transaction to the MTC company by the address 1, 2, 3, 4 and 5 were done by the Schnorr signatures, then a combination of the 5 different public keys will be blended together to form 1 new transaction key. The privacy of the 5 different addresses will be kept secret in such a way that no other individual would know the creators of this new key.
Now that it's a single transaction key, it would be easier for that transaction process to be executed, and the transaction size will be lesser, as well as scalable.
iMarkup_20211225_212955.jpg

A5tMjLhTTnj4UJ3Q17DFR9PmiB5HnomwsPZ1BrfGqKbjddsm2yryLMZpkag6p3MpXTppwMX3qtt9vdzUYtBHCu2TA9St5KJQygtsgS6dxxqPYJp1JnwppmTDQ2oZcq...vf4dCGuM2U6djjRHRUmVb3zf4149oVJ2XB5SabZQACLaiMcbvdfAjGsuQAvwzkM717GWYf6zhAPhJYAvirzHVEpiCuJrCHhWZsMp6Rr7KdqfND3H8Kkt19ayxi.png

Question 3

Why do you think that Taproot and Schnorr firms will help the privacy of the Bitcoin network? Explain.
A5tMjLhTTnj4UJ3Q17DFR9PmiB5HnomwsPZ1BrfGqKbjddsm2yryLMZpkag6p3MpXTppwMX3qtt9vdzUYtBHCu2TA9St5KJQygtsgS6dxxqPYJp1JnwppmTDQ2oZcq...vf4dCGuM2U6djjRHRUmVb3zf4149oVJ2XB5SabZQACLaiMcbvdfAjGsuQAvwzkM717GWYf6zhAPhJYAvirzHVEpiCuJrCHhWZsMp6Rr7KdqfND3H8Kkt19ayxi.png

Right from the creation of Bitcoin, they have been some issues surrounding it and the biggest issue was it's scalability issue. Nevertheless, they have been recent updates and technology in the the Bitcoin space, some new updates which includes the Taproot technology and the Schnorr firms was introduced to solve the blockchain trilemma. The blockchain trilemma states that 3 of the basic requirements of a blockchain can not exist at the same time.
Bitcoin has security and decentralization but no scalability. Although they are layer 2 scaling solutions out there but the blockchain trilemma still remains a problem to the Bitcoin world.
So the Taproot and Schnorr firms are basically for the provision of security as well as scalability.
Multiple-signature transactions can now be done through the Schnorr Signatures, whereby providing security and scalability to the network. This update is really beneficial to the Bitcoin world as it goes a long way in solving the scalability issues facing BTC, and this will equally reduce the fees required for transactions.

A5tMjLhTTnj4UJ3Q17DFR9PmiB5HnomwsPZ1BrfGqKbjddsm2yryLMZpkag6p3MpXTppwMX3qtt9vdzUYtBHCu2TA9St5KJQygtsgS6dxxqPYJp1JnwppmTDQ2oZcq...vf4dCGuM2U6djjRHRUmVb3zf4149oVJ2XB5SabZQACLaiMcbvdfAjGsuQAvwzkM717GWYf6zhAPhJYAvirzHVEpiCuJrCHhWZsMp6Rr7KdqfND3H8Kkt19ayxi.png

Question 4

Using the Blockchain Demo, write exactly the following message: Schnorr Signatures, generate the message signature and verify the message. Then delete the first character from the message signature and check again. What happened? Explain. Screenshots required.
A5tMjLhTTnj4UJ3Q17DFR9PmiB5HnomwsPZ1BrfGqKbjddsm2yryLMZpkag6p3MpXTppwMX3qtt9vdzUYtBHCu2TA9St5KJQygtsgS6dxxqPYJp1JnwppmTDQ2oZcq...vf4dCGuM2U6djjRHRUmVb3zf4149oVJ2XB5SabZQACLaiMcbvdfAjGsuQAvwzkM717GWYf6zhAPhJYAvirzHVEpiCuJrCHhWZsMp6Rr7KdqfND3H8Kkt19ayxi.png

The first step I took was to go to the Blockchain Demo, and I went to the signing section where I would insert the Schnorr Signatures message.

As instructed by our professor, I inserted the Schnorr Signatures message and I clicked on Sign. I got a signature message with the following code:
30460221009d2f38e5b11ac0f4ceb91cbc47b7958fcbf0f957fe8bc5aeca27e7f0289992d30221008e4a21e01f23b0b3e767fc0c394ece235dafbbd0a24d10ef0d475518a7747ca7

iMarkup_20211225_231728.jpg

To verify the message, I inserted Schnorr Signatures and then I clicked on verify.
iMarkup_20211225_232546.jpg

After clicking on verify, the whole background turned into greenish colour, which signifies that the message correlates with the signature.
iMarkup_20211225_232655.jpg

As directed by our professor, I deleted the first character from the message signature, and then I clicked on verify again,
iMarkup_20211225_232859.jpg

But this time I got a red background colour, which means that there's an error and the signature messages are not correlated.
iMarkup_20211225_233013.jpg

A5tMjLhTTnj4UJ3Q17DFR9PmiB5HnomwsPZ1BrfGqKbjddsm2yryLMZpkag6p3MpXTppwMX3qtt9vdzUYtBHCu2TA9St5KJQygtsgS6dxxqPYJp1JnwppmTDQ2oZcq...vf4dCGuM2U6djjRHRUmVb3zf4149oVJ2XB5SabZQACLaiMcbvdfAjGsuQAvwzkM717GWYf6zhAPhJYAvirzHVEpiCuJrCHhWZsMp6Rr7KdqfND3H8Kkt19ayxi.png

Conclusion

A5tMjLhTTnj4UJ3Q17DFR9PmiB5HnomwsPZ1BrfGqKbjddsm2yryLMZpkag6p3MpXTppwMX3qtt9vdzUYtBHCu2TA9St5KJQygtsgS6dxxqPYJp1JnwppmTDQ2oZcq...vf4dCGuM2U6djjRHRUmVb3zf4149oVJ2XB5SabZQACLaiMcbvdfAjGsuQAvwzkM717GWYf6zhAPhJYAvirzHVEpiCuJrCHhWZsMp6Rr7KdqfND3H8Kkt19ayxi.png

Really interesting topic by our professor because I was made to understand that the Bitcoin address exist in two major formats which includes P2SH meaning Pay to Script Hash, and P2PKH meaning Pay to PubKey Hash. There both play significant parts in the transactions of Bitcoin as they have their advantages and disadvantages.
I equally got to know that Taproot and Schnorr firms are new updates that has come to help in the security and scalability of Bitcoin.

Performing this task made me to understand some new things, and am grateful to professor @pelon53 for bringing such an educative lecture to us this week.

Thank you for your time.

Note: All screenshots were taken by me on Blockchain Demo and designed using iMarkup.

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...