Reserved IP Address°C
01-15-2025
BSV
$54.3
Vol 34.24m
1.13%
BTC
$96977
Vol 55242.47m
2.32%
BCH
$438.41
Vol 165.45m
2.05%
LTC
$102.12
Vol 395.79m
3.6%
DOGE
$0.36
Vol 3101.72m
5.45%
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

BTC miner Bit Digital acquires Montreal site, new client announced
Bit Digital has spent $23 million on the Montreal site, which it will customize to host a 5MW data center...
January 10, 2025
Hive Digital shifts operations to Texas, targets Trump-era support
Hive also revealed that its operational hash rate shot up 50% due to operational efficiencies and lower power costs, and...
January 8, 2025
Advertisement
Advertisement
Advertisement