Reserved IP Address°C
03-11-2025
BSV
$31.42
Vol 48.02m
-5.14%
BTC
$81801
Vol 57119.41m
-0.71%
BCH
$336.54
Vol 313.98m
-8.15%
LTC
$88.72
Vol 1000.82m
-8.54%
DOGE
$0.16
Vol 2513.66m
-7.88%
Getting your Trinity Audio player ready...

This post was first published on Medium.

We have implemented ECDSA signature verification algorithm in Script. It can verify if an arbitrary message is signed by a private key corresponding to a given public key, while OP_CHECKSIG can only verify signatures when the message is the current spending transaction¹. Surprisingly, this is done without introducing any new opcode such as OP_DATASIGVERIFY (aka, OP_CHECKDATASIG) on BCH.

Elliptic Curve Digital Signature Algorithm (ECDSA)

ECDSA is the algorithm used in Bitcoin for signature generation and verification. The verification algorithm is listed below.

ECDSA Signature Verification

Implementation

We have implemented the algorithm as shown below, using the elliptic curve library we released before.

First, we need to extract r and s components from the signature, which is encoded in DER format. Since they are big-endian, we have to convert to little-endian, which is how data is encoded in Script/sCrypt.

DER

After r and s are retrieved, we simply run the standard ECDSA verification algorithm.


ECDSA Contract

***

NOTE:

[1] More precisely, it verifies signature against sighash.

Recommended for you

Building a solid ecosystem: Babbage to host BSV Hackathon in Texas
The US$55,000 prize money is up for grabs at the inaugural BSV Hackathon in Austin, Texas, which Babbage will host...
March 3, 2025
GPT-4.5 is not the AGI moment OpenAI teased
While he previously called for lower expectations over GPT-4.5, Sam Altman was lured into dubbing it the closest step to...
March 3, 2025
Advertisement
Advertisement
Advertisement