From 0bacae85fb8bfd339a350c5a87027185129c12bf Mon Sep 17 00:00:00 2001 From: Mike Hearn Date: Tue, 15 Mar 2011 13:54:58 +0000 Subject: [PATCH] Improve JavaDocs in ECKey to try and help people understand the difference between pubkeyhashes and pubkeys. The getting started guide was also updated. --- src/com/google/bitcoin/core/ECKey.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/com/google/bitcoin/core/ECKey.java b/src/com/google/bitcoin/core/ECKey.java index 5e24c91c..927ac65b 100644 --- a/src/com/google/bitcoin/core/ECKey.java +++ b/src/com/google/bitcoin/core/ECKey.java @@ -98,7 +98,10 @@ public class ECKey implements Serializable { return pubKeyHash; } - /** Gets the raw public key value. */ + /** + * Gets the raw public key value. This appears in transaction scriptSigs. Note that this is not the same + * as the pubKeyHash/address. + */ public byte[] getPubKey() { return pub; } @@ -110,7 +113,10 @@ public class ECKey implements Serializable { return b.toString(); } - + /** + * Returns the address that corresponds to the public part of this ECKey. Note that an address is derived from + * the RIPEMD-160 hash of the public key and is not the public key itself (which is too large to be convenient). + */ public Address toAddress(NetworkParameters params) { byte[] hash160 = Utils.sha256hash160(pub); return new Address(params, hash160);