Bitcoin Forum
November 16, 2024, 01:29:17 PM *
News: Check out the artwork 1Dq created to commemorate this forum's 15th anniversary
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Javascript ECDSA / Bitcoin address generation  (Read 3016 times)
🏰 TradeFortress 🏰 (OP)
Bitcoin Veteran
VIP
Legendary
*
Offline Offline

Activity: 1316
Merit: 1043

👻


View Profile
January 06, 2013, 09:19:09 AM
 #1

I really can't figure out how to get the ECDSA public key of a private key in Javascript. I looked in SJCL but it apparently does it in some non-standard way and isn't compatible with everything else Huh
BkkCoins
Hero Member
*****
Offline Offline

Activity: 784
Merit: 1009


firstbits:1MinerQ


View Profile WWW
January 06, 2013, 09:38:12 AM
 #2

Look at bitaddress.org source code. It's very easy to read. Near the end there is the wallet details tab. You'll see there which functions are called to get the public key. Search back for the function and see how it's done.

This code is also good as a template for writing in other languages.
eg. some bits chopped out,
Code:
var ecparams = EllipticCurve.getSECCurveByName("secp256k1");

ECKey.prototype.getPub = function () {
if (this.pub) return this.pub;
return this.pub = ecparams.getG().multiply(this.priv).getEncoded(0);
};

ECKey.prototype.getPubKeyHex = function () {
if (this.pubKeyHex) return this.pubKeyHex;
return this.pubKeyHex = Crypto.util.bytesToHex(this.getPub()).toString().toUpperCase();
};
A bit more digging and should have it.

🏰 TradeFortress 🏰 (OP)
Bitcoin Veteran
VIP
Legendary
*
Offline Offline

Activity: 1316
Merit: 1043

👻


View Profile
January 06, 2013, 10:00:41 AM
 #3

Look at bitaddress.org source code. It's very easy to read. Near the end there is the wallet details tab. You'll see there which functions are called to get the public key. Search back for the function and see how it's done.

This code is also good as a template for writing in other languages.
eg. some bits chopped out,
Code:
var ecparams = EllipticCurve.getSECCurveByName("secp256k1");

ECKey.prototype.getPub = function () {
if (this.pub) return this.pub;
return this.pub = ecparams.getG().multiply(this.priv).getEncoded(0);
};

ECKey.prototype.getPubKeyHex = function () {
if (this.pubKeyHex) return this.pubKeyHex;
return this.pubKeyHex = Crypto.util.bytesToHex(this.getPub()).toString().toUpperCase();
};
A bit more digging and should have it.
Thanks, did some testing but it's absolutely useless as an vanity address generator as it takes like 600ms to generate on a i7...
bluemeanie1
Sr. Member
****
Offline Offline

Activity: 280
Merit: 257


bluemeanie


View Profile WWW
November 26, 2013, 10:36:38 PM
 #4

Just curious, how did this turn out?  Interested in your experiences with SJCL.

Just who IS bluemeanie?    On NXTautoDAC and a Million Stolen NXT

feel like your voice isn't being heard? PM me.   |   stole 1M NXT?
Kouye
Sr. Member
****
Offline Offline

Activity: 336
Merit: 250


Cuddling, censored, unicorn-shaped troll.


View Profile
November 26, 2013, 11:34:56 PM
 #5

Just curious, how did this turn out?  Interested in your experiences with SJCL.

Err, you know TF ran away with thousands of coins and most likely won't come back just to reply to you, right?  Grin

[OVER] RIDDLES 2nd edition --- this was claimed. Look out for 3rd edition!
I won't ever ask for a loan nor offer any escrow service. If I do, please consider my account as hacked.
jp
Member
**
Offline Offline

Activity: 69
Merit: 10



View Profile WWW
February 08, 2014, 08:29:03 AM
 #6

For anyone still looking at it, I wrote an article that may help you: http://procbits.com/2013/08/27/generating-a-bitcoin-address-with-javascript

Helping the world exit the traditional financial system.
minzie
Member
**
Offline Offline

Activity: 110
Merit: 10



View Profile WWW
February 09, 2014, 01:01:19 PM
 #7

@JP, I hate submitting one-line posts, but thanks for sharing that.

Professional Freelance Web Apps Engineer ° Portfolio °  ModoBot Automated Trading Platform ° BitThingy ° My Github  ° Skype: cclites_1
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!