<p>I wrote a long and detailed tutorial on it <a href="http://procbits.com/2013/08/27/generating-a-bitcoin-address-with-javascript" rel="nofollow">http://procbits.com/2013/08/27/generating-a-bitcoin-address-with-javascript</a></p>

<p>In short, scroll all the way down to the summary to see this short version:</p>

<pre><code>var randArr = new Uint8Array(32) //create a typed array of 32 bytes (256 bits)
window.crypto.getRandomValues(randArr) //populate array with cryptographically secure random numbers

//some Bitcoin and Crypto methods don't like Uint8Array for input. They expect regular JS arrays.
var privateKeyBytes = []
for (var i = 0; i &lt; randArr.length; ++i)
  privateKeyBytes[i] = randArr[i]

var eckey = new Bitcoin.ECKey(privateKeyBytes)
eckey.compressed = true
var address = eckey.getBitcoinAddress().toString()
console.log(address)// 1FkKMsKNJqWSDvTvETqcCeHcUQQ64kSC6s

var privateKeyBytesCompressed = privateKeyBytes.slice(0) //clone array
privateKeyBytesCompressed.push(0x01)
var privateKeyWIFCompressed = new Bitcoin.Address(privateKeyBytesCompressed)
privateKeyWIFCompressed.version = 0x80
privateKeyWIFCompressed = privateKeyWIFCompressed.toString()
</code></pre>

<p>Open up the JavaScript console on the page (in your browser) and follow along. You can create your very own address right there in the browser. I wouldn't recommend using this newly created address to actually conduct commerce. Just use it as an academic exercise.</p>

CC BY-SA 3.0
2017-11-30T22:46:57.030Z
`I wouldn't recommend using this newly created address to actually conduct commerce. Just use it as an academic exercise.` Why do you say that? Are there any risks associated with this method (as I intend to use it for generating personal cold-storage keys)
Albert Renshaw
CC BY-SA 3.0
2017-12-02T11:31:56.013Z
Yes, generating a private key in the browser where other scripts/plugins may have access to the keys puts your money at risk.
JP Richardson
CC BY-SA 3.0
2017-12-02T12:06:10.603Z
Gotcha, but I can use my own personal Javascript IDE or something just fine. Just wanted to make sure there wasn't a potential risk with the code itself (as opposed to the environment) Thanks for clarification
Albert Renshaw
CC BY-SA 3.0
2013-12-07T20:28:20.177Z
2013-12-07T20:28:20.177Z
JP Richardson
<p>There are a number of sample programs here: <a href="https://bitcointalk.org/index.php?topic=1026.0" rel="nofollow">https://bitcointalk.org/index.php?topic=1026.0</a></p>

<p>Also see the wiki for the <a href="https://en.bitcoin.it/wiki/Technical_background_of_Bitcoin_addresses" rel="nofollow">step-by-step algorithm for generating a valid address.</a></p>

CC BY-SA 3.0
2013-12-03T16:16:43.017Z
2013-12-03T16:16:43.017Z
Neil Neyman
<p>There are plenty of very easy-to-use tools that can generate addresses for you, the exact process is detailed <a href="https://en.bitcoin.it/wiki/Technical_background_of_Bitcoin_addresses" rel="nofollow">in the Bitcoin wiki</a>.</p>

<p>Some examples of such tools are:</p>

<ul>
<li><a href="https://www.bitaddress.org/" rel="nofollow">BitAddress.org</a></li>
<li><a href="http://brainwallet.org" rel="nofollow">BrainWallet</a></li>
</ul>

CC BY-SA 3.0
2014-01-06T21:31:12.927Z
2014-01-06T21:31:12.927Z
Steven Roose
<p><a href="https://coinbase.com/" rel="nofollow">Coinbase </a>Your wallet on Coinbase is a collection of bitcoin addresses. New bitcoin addresses are automatically generated for each payment on Coinbase and stay associated with your account forever (so it is safe to reuse them).</p>

CC BY-SA 3.0
2013-12-02T20:40:37.637Z
I meant programatically, that's why I mentioned the blockchain API. And here you are giving me your "referral" link to coinbase.
Coup de Grace
CC BY-SA 3.0
2013-12-02T19:11:13.497Z
2013-12-07T12:17:11.730Z
2013-12-07T12:17:11.730Z
user9933
<p>Is there any way to generate bitcoin addresses  other than the Blockchain API? (given the fact that it is not public)</p>

<blockchain><wallet><api><address-generation>
How can I generate a bitcoin address?
Coup de Grace
# How can I generate a bitcoin address?

(Asked by: username_0 on 2013-12-02)

Is there any way to generate bitcoin addresses other than the Blockchain API? (given the fact that it is not public)

**Tags:** blockchain, wallet, api, address-generation


---

## 4 answers

### Answer by username_1 on 2013-12-07. Score: 2 | Accepted answer

I wrote a long and detailed tutorial on it http://procbits.com/2013/08/27/generating-a-bitcoin-address-with-javascript
In short, scroll all the way down to the summary to see this short version:
var randArr = new Uint8Array(32) //create a typed array of 32 bytes (256 bits)
window.crypto.getRandomValues(randArr) //populate array with cryptographically secure random numbers

//some Bitcoin and Crypto methods don't like Uint8Array for input. They expect regular JS arrays.
var privateKeyBytes = []
for (var i = 0; i < randArr.length; ++i)
  privateKeyBytes[i] = randArr[i]

var eckey = new Bitcoin.ECKey(privateKeyBytes)
eckey.compressed = true
var address = eckey.getBitcoinAddress().toString()
console.log(address)// 1FkKMsKNJqWSDvTvETqcCeHcUQQ64kSC6s

var privateKeyBytesCompressed = privateKeyBytes.slice(0) //clone array
privateKeyBytesCompressed.push(0x01)
var privateKeyWIFCompressed = new Bitcoin.Address(privateKeyBytesCompressed)
privateKeyWIFCompressed.version = 0x80
privateKeyWIFCompressed = privateKeyWIFCompressed.toString()

Open up the JavaScript console on the page (in your browser) and follow along. You can create your very own address right there in the browser. I wouldn't recommend using this newly created address to actually conduct commerce. Just use it as an academic exercise.

> **Comments:**
> **username_2**: `I wouldn't recommend using this newly created address to actually conduct commerce. Just use it as an academic exercise.` Why do you say that? Are there any risks associated with this method (as I intend to use it for generating personal cold-storage keys)  
> **username_1**: Yes, generating a private key in the browser where other scripts/plugins may have access to the keys puts your money at risk.  
> **username_2**: Gotcha, but I can use my own personal Javascript IDE or something just fine. Just wanted to make sure there wasn't a potential risk with the code itself (as opposed to the environment) Thanks for clarification  

---

### Answer by username_3 on 2013-12-03. Score: 1

There are a number of sample programs here: <https://bitcointalk.org/index.php?topic=1026.0>

Also see the wiki for the [step-by-step algorithm for generating a valid address.](https://en.bitcoin.it/wiki/Technical_background_of_Bitcoin_addresses)


---

### Answer by username_4 on 2014-01-06. Score: 0

There are plenty of very easy-to-use tools that can generate addresses for you, the exact process is detailed [in the Bitcoin wiki](https://en.bitcoin.it/wiki/Technical_background_of_Bitcoin_addresses).

Some examples of such tools are:

* [BitAddress.org](https://www.bitaddress.org/)
* [BrainWallet](http://brainwallet.org)


---

### Answer by username_5 on 2013-12-02. Score: -3

[Coinbase](https://coinbase.com/) Your wallet on Coinbase is a collection of bitcoin addresses. New bitcoin addresses are automatically generated for each payment on Coinbase and stay associated with your account forever (so it is safe to reuse them).

> **Comments:**
> **username_0**: I meant programatically, that's why I mentioned the blockchain API. And here you are giving me your "referral" link to coinbase.  

---

