From 26c929da6637c02e4b67015cbf8e36b35d25e6f3 Mon Sep 17 00:00:00 2001 From: "Minh T. Nguyen" Date: Thu, 5 Jun 2014 23:04:48 -0700 Subject: [PATCH] A public key should be 520 bits / 65 bytes; reported by Issue #39 --- ch04.asciidoc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ch04.asciidoc b/ch04.asciidoc index 057298c2..64e62fb8 100644 --- a/ch04.asciidoc +++ b/ch04.asciidoc @@ -320,7 +320,7 @@ x = F028892BAD...DC341A y = 07CF33DA18...505BDB ---- -Here's the same public key shown as a 512-bit number (130 hex digits) with the prefix +04+ followed by +x+ and then +y+ coordinates, as +04 x y+: +Here's the same public key shown as a 520-bit number (130 hex digits) with the prefix +04+ followed by +x+ and then +y+ coordinates, as +04 x y+: .Uncompressed Public Key K shown in hex (130 hex digits) as +04xy+ ---- @@ -330,7 +330,7 @@ K = 04F028892BAD...505BDB [[comp_pub]] ===== Compressed Public Keys -Compressed public keys were introduced to bitcoin to reduce the size of transactions and conserve disk space on nodes that store the bitcoin blockchain database. Most transactions include the public key, required to validate the owner's credentials and spend the bitcoin. Each public key requires 513 bits (prefix \+ x \+ y), which when multiplied by several hundred transactions per block, or tens of thousands of transactions per day, adds a significant amount of data to the blockchain. +Compressed public keys were introduced to bitcoin to reduce the size of transactions and conserve disk space on nodes that store the bitcoin blockchain database. Most transactions include the public key, required to validate the owner's credentials and spend the bitcoin. Each public key requires 520 bits (prefix \+ x \+ y), which when multiplied by several hundred transactions per block, or tens of thousands of transactions per day, adds a significant amount of data to the blockchain. As we saw in the section <> above, a public key is a point (x,y) on an elliptic curve. Since the curve expresses a mathematical function, a point on the curve represents a solution to the equation and therefore if we know the x-coordinate we can calculate the y-coordinate by solving the equation y^2^ mod p = (x^3^ + 7) mod p. That allows us to store only the x-coordinate of the public key point, omitting the y-coordinate and reducing the size of the key and the space required to store it by 256 bits. A 50% reduction in size in every transaction adds up to a lot of data saved over time! @@ -342,7 +342,7 @@ image::images/pubkey_compression.png["pubkey_compression"] Here's the same public key generated previously, shown as a +compressed public key+ stored in 264-bits (66 hex digits) with the prefix +03+ indicating the +y+ coordinate is odd: -.Compressed Public Key K shown in hex (66 hex digits) as +K = {02 or 03} x+ +.Compressed Public Key K shown in hex (66 hex digits) as +K = {02 or 03} x+ ---- K = 03F028892BAD...DC341A ----