summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoding Enthusiast <CodingEnthusiast@protonmail.com>2020-05-18 11:05:21 +0430
committerGitHub <noreply@github.com>2020-05-18 11:05:21 +0430
commit9bb9824cab7abed139ec8e62c9e34e1605293c57 (patch)
tree6543995321274c7b6cbd2467bfaee8ab7c5a69a7
parent4fb2c5290e10270c8e4a6df357fe98bfab2ddfe9 (diff)
downloadbips-9bb9824cab7abed139ec8e62c9e34e1605293c57.tar.xz
[BIP-0137] Correct small mistakes
RecId indicates address/script types not key types (technically there is no key type). Value for P2WPKH is 39 not 35. Turned ranges to a bulleted list.
-rw-r--r--bip-0137.mediawiki10
1 files changed, 5 insertions, 5 deletions
diff --git a/bip-0137.mediawiki b/bip-0137.mediawiki
index 7ef89f4..19dd536 100644
--- a/bip-0137.mediawiki
+++ b/bip-0137.mediawiki
@@ -52,11 +52,11 @@ The header byte has a few components to it. First, it stores something known as
===Procedure for signing/verifying a signature===
-As noted above the signature is composed of three components, the header, r and s values. r/s can be computed with standard ECDSA library functions. Part of the header includes something called a recId. This is part of every ECDSA signature and should be generated by the ECDSA library. The recId is a number between 0 and 3 inclusive. The header is the recId plus a constant which indicates what time of Bitcoin private key this is. For P2PKH uncompressed keys, this value is 27. For P2PKH compressed keys, this value is 31. For P2SH Segwit keys, this value is 35 and for bech32 keys, this value is 35. So, you have the following ranges:
-27-30: P2PKH uncompressed
-31-34: P2PKH compressed
-35-38: Segwit P2SH
-39-42: Segwit Bech32
+As noted above the signature is composed of three components, the header, r and s values. r/s can be computed with standard ECDSA library functions. Part of the header includes something called a recId. This is part of every ECDSA signature and should be generated by the ECDSA library. The recId is a number between 0 and 3 inclusive. The header is the recId plus a constant which indicates what type of Bitcoin address this is. For P2PKH address using an uncompressed public key this value is 27. For P2PKH address using compressed public key this value is 31. For P2SH-P2WPKH this value is 35 and for P2WPKH (version 0 witness) address this value is 39. So, you have the following ranges:
+* 27-30: P2PKH uncompressed
+* 31-34: P2PKH compressed
+* 35-38: Segwit P2SH
+* 39-42: Segwit Bech32
To verify a signature, the recId is obtained by subtracting this constant from the header value.