<p><a href="https://en.bitcoin.it/wiki/Technical_background_of_version_1_Bitcoin_addresses" rel="nofollow noreferrer">According to this wiki page</a> to create a bitcoin address,</p>

<p>1) you have your public key of the properly derived path</p>

<p>2) Then SHA256 it</p>

<p>3) Then RIPEMD-160 it,</p>

<p>Add version byte at the front and boom blam you’re good.</p>

<p>But in <a href="https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/test/integration/bip32.js#L11" rel="nofollow noreferrer">bitcoinjs-lib</a>, they have this function getAddress which seems to skip step 2  and continue down the path ensuring Base58Checking</p>

<pre><code>function getAddress (node) {
  return baddress.toBase58Check(bcrypto.hash160(node.publicKey), bitcoin.networks.bitcoin.pubKeyHash)
}
</code></pre>

<p>My question is, why is bitcoinjs-lib skipping step 1? Don’t you have to SHA256 the pub key again?</p>

<p>Derivation occurs pretty straightforwardly with <code>derivePath</code></p>

<p><code>var child1 = root.derivePath("m/44'/0'/0'/0/0")</code></p>

CC BY-SA 4.0
2018-05-23T21:24:03.100Z
https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/src/crypto.js `hash160(buffer)` _is_ `ripemd160(sha256(buffer))`
dave_thompson_085
CC BY-SA 4.0
2018-05-23T21:25:36.977Z
Yes, that is obvious. The step skipped is the extra SHA256
arshbot
CC BY-SA 4.0
2018-05-23T21:49:30.393Z
Ah I see, my bad. Leave a proper answer so I can give you credit
arshbot
<address><address-generation><bitcoinjs><bip44>
bitcoinjs-lib seems to skip a step in deriving addresses from a BIP 44 wallet
arshbot
# bitcoinjs-lib seems to skip a step in deriving addresses from a BIP 44 wallet

(Asked by: username_0 on 2018-05-23)

[According to this wiki page](https://en.bitcoin.it/wiki/Technical_background_of_version_1_Bitcoin_addresses) to create a bitcoin address,

1) you have your public key of the properly derived path

2) Then SHA256 it

3) Then RIPEMD-160 it,

Add version byte at the front and boom blam you’re good.

But in [bitcoinjs-lib](https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/test/integration/bip32.js#L11), they have this function getAddress which seems to skip step 2 and continue down the path ensuring Base58Checking

```
function getAddress (node) {
  return baddress.toBase58Check(bcrypto.hash160(node.publicKey), bitcoin.networks.bitcoin.pubKeyHash)
}

```

My question is, why is bitcoinjs-lib skipping step 1? Don’t you have to SHA256 the pub key again?

Derivation occurs pretty straightforwardly with `derivePath`

`var child1 = root.derivePath("m/44'/0'/0'/0/0")`

**Tags:** address, address-generation, bitcoinjs, bip44

> **Comments:**
> **username_1**: https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/src/crypto.js `hash160(buffer)` _is_ `ripemd160(sha256(buffer))`  
> **username_0**: Yes, that is obvious. The step skipped is the extra SHA256  
> **username_0**: Ah I see, my bad. Leave a proper answer so I can give you credit  

---

## 0 answers

