Author: MC 5760 2022-11-05 08:46:15
Published on: 2022-11-05T08:46:15+00:00
The given context describes the process of converting a private key into a compressed public key using Elliptic Curve Cryptography (ECC) and Bech32m encoding. The scriptPubkey is obtained by decoding the address using Bech32m and public key compression. The Segwit process involves using the double SHA-256 hash of the transaction input and index multiplied by the public key, added to the double SHA-256 hash of the unsigned raw transaction modulo the private key, and then applying modulo N to obtain a 32-byte number.To verify the Segwit process, ECC is used with the generator point G and the double SHA-256 hash of the transaction input and index to obtain x1 and y1 coordinates. Then, using the same generator point G and the double SHA-256 hash of the unsigned raw transaction modulo Segwit, p1 is obtained. Next, p2 is calculated by multiplying (x1,y1) with the x public key modulo Segwit using ECC, and then adding it to p1. Finally, the x2 coordinate of p2 is checked against the x public key, and if they match, the verification is successful.The given context includes a link to the relevant python code on Github for reference.
Updated on: 2023-05-22T22:47:21.848522+00:00