Reserved IP Address°C
05-03-2025
BSV
$37.27
Vol 24.69m
-6.21%
BTC
$95971
Vol 20864.8m
-1.04%
BCH
$367.66
Vol 229.7m
-0.62%
LTC
$86.54
Vol 283.03m
-2.9%
DOGE
$0.17
Vol 864.64m
-1.75%
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

L1 vs L2 scaling: Paul Sztorc joins CoinGeek Weekly Livestream
In this CG Weekly Livestream episode, Sztorc laid out being open to big blocks on the second layer and explained...
May 2, 2025
TCS unveils AI solutions for data sovereignty, cybersecurity
The AI solutions—SovereignSecure Cloud, DigiBolt, and TCS Cyber Defense Suite—were introduced to improve data protection, efficiency, and innovation.
May 2, 2025
Advertisement
Advertisement
Advertisement