Bitcoin: Does Bitcoin Core Validate ECDSA Signature Component r Using Mod N?

Valiidation Component Sign ECDSA with Uspolzing MOD N BITSKOIN UDRO

Electronic hand -breeding (ECG) and The Pass of the Digital Singure Algorithm (ECDSA) are the most popular components of bitcoin. In this state, we run the Bitcoin Core confract components ECDSA with the MOD N.

Penal Penia/Towards ECD

In the book “Bitcoin Programing” from Jimmi Song is impressive that the process of signatures/the ECDSA for the hash Z ZZ ZZ ZZ ZZ ZZ ZZ

  • Fold the public P with

  • Combining the signature of the Consistency has’ zshiale algorithm ecdsa:

re

Q = R * G^X MOD M

re

  • Check the signature, verification, complies with the li on the lining signature for the open key GIIV and the hasha:

C

V = r ^ x mod_p

S = S ^ V MOD after

re

fashion n validation

Bitcoin: Does Bitcoin Core Validate ECDSA Signature Component r Using Mod N?

For the ECDSA signatures with the MOD N, the favorable module M and the baselineg, which is pleased with the receipt in the property. Particular key – this modular exponentarization of the Generator of the Generator G.

In the nucleus, the partial key “erepress is sometimes" (P), Whea)). For the ECDSA signatures with the MOD N, the favorable module M YES:

* D^E ≡ 1 MOD M

* G^e ≡ g^X MOD M

The module we can choose the arbitrage M = P (Pervic Chil) and Remove the Module Exonentation Module to the GeneratorG. Social key “P” – this is just coordinates (x, y).

Realization in Bitcoin Core

To realize fashion N -wascation in Bitcoin Core, favorable, graceful SNIPS code:

`C

#include

// Distinguished structure for the presentation of the entries of the ECDSA

Typedef {

uint8_t r [4];

uint8_t x;

} S;

// Function for Compiling Signatures ECDSA and Reds that you don't use mod N

S ECDS_SIGN (Const Urine8_T Z, Const UIT64_T E, Const Uit8_T P) {

// Break up public components for

Const UIT32_T D = (Z [0] << 24) + (Z [1] << 16) + (Z [2] << 8) + Z [3];

S* Signature = new (Sizeof (s) s;

// ECDSA SUBSCRIBED AND ENTER THAT YOU'RE BEEN

Q R;

for (int I = 0; I <4; I ++) {

R.R [i] = (d >> (I * 8) & 255);

}

Signature-> R [3] = (Z [0] << 24) + (Z [1] << 16) + (Z [2] << 8) + Z [3];

Signature-> X = R.X;

// Pulling G^e ≡ g^x MOD MO

S g;

for (int I = 0; I <4; I ++) {

G.R [i] = Pow (G, R.R [i], P);

}

Signature of the Child;

}

// Function for Red

BOOOL ECDS_VERIFY (CONST S* Signature, Const Uuint64_T E, Const Uuint8_T Z, Const Uuint32_T P) {

// Break up public components for

Const UIT32_T D = (Z [0] << 24) + (Z [1] << 16) + (Z [2] << 8) + Z [3];

// Pulling G^e ≡ g^x MOD MO

S g;

for (int I = 0; I <4; I ++) {

G.R [I] = Pow (G, D >> (I * 8), P);

}

// comprete picked up with the signs of the signature

uint64_t r, x;

for (int I = 0; I <4; I ++) {

R += G.R [i];

X + = (Z [1] << 16) + (Z [2] << 8) + Z [3];

}

Return Pow (R, E, P) == X;

}

re

This realization provides the main basis for the ECDSA Wesing Mod N Bitcoin Core signature. This is just a primer, and you can coded into the correspondence with your conquest trees.

link

  • “Programing with Bitcoins” Jimmi Song (2019)

  • Specification Protocol bitcoins (section 5.1.8)

پاسخ دهید

آدرس ایمیل شما منتشر نخواهد شد. فیلدهای الزامی هستند.