This post was very first released on Medium.

We have actually executed ECDSA signature confirmation algorithm in Script. It can confirm if an approximate message is signed by a personal essential representing an offered public secret, while OP_CHECKSIG can just validate signatures when the message is the present costs deal ¹. Remarkably, this is done without presenting any brand-new opcode such as OP_DATASIGVERIFY ( aka, OP_CHECKDATASIG) on BCH.

Elliptic Curve Digital Signature Algorithm (ECDSA)

ECDSA is the algorithm utilized in Bitcoin for signature generation and confirmation. The confirmation algorithm is noted below.

ECDSA Signature Verification

Implementation

We have actually executed the algorithm as revealed listed below, utilizing the elliptic curve library we launched previously.

First, we require to extract r and s parts from the signature, which is encoded in DER format. Considering that they are big-endian, we need to transform to little-endian, which is how information is encoded in Script/sCrypt.

DER

After r and s are obtained, we just run the basic ECDSA confirmation algorithm.



ECDSA Contract

NOTE:

[1] More exactly, it confirms signature versus sighash.

New to Bitcoin? Have a look at CoinGeek’s Bitcoin for Beginners area, the supreme resource guide to get more information about Bitcoin– as initially visualized by Satoshi Nakamoto– and blockchain.

LEAVE A REPLY

Please enter your comment!
Please enter your name here